I'm working more and more on various functions that allow to use Canvas in yet unforeseen ways. For example, in GridMenu, apart from the Canvas used to draw the menu itself, an additional Canvas together with MockOutput is used to crop the text in the grid cell so that it doesn't overflow. So, there are two functions I think we should have
[x] Add Canvas.paste(image, coords), which would paste the supplied PIL.Image onto the canvas, with top left corner of the image positioned at coords. There's already the Canvas.image.paste(image, coords) method that does exactly that, we just need to wrap it into our own API, add a check_coordinates call, documentation and tests.
[x] Add Canvas.rotate(degrees), which would take a canvas with a WxH image, rotate the image to a certain amount of degrees and update the canvas to have proper width and height attributes.
[x] For a start, it would be OK to only support 0/90/180/270 rotation, but having an option to supply arbitrary degrees would be great.
I'm working more and more on various functions that allow to use
Canvas
in yet unforeseen ways. For example, inGridMenu
, apart from theCanvas
used to draw the menu itself, an additionalCanvas
together withMockOutput
is used to crop the text in the grid cell so that it doesn't overflow. So, there are two functions I think we should haveCanvas.paste(image, coords)
, which would paste the suppliedPIL.Image
onto the canvas, with top left corner of the image positioned atcoords
. There's already theCanvas.image.paste(image, coords)
method that does exactly that, we just need to wrap it into our own API, add acheck_coordinates
call, documentation and tests.Canvas.rotate(degrees)
, which would take a canvas with a WxH image, rotate the image to a certain amount of degrees and update the canvas to have properwidth
andheight
attributes.