Color selector and draw in shapes
I have two suggestion, let me know your thought on it!
In the the color picker in code (like:"#fff" and pressing ctrl) there should be an option to choose the output format(hex or rgb) and be able to choose an alpha value
I'd just really like to have a draw function that you pass a polygon and makes the future drawing function only draw in this zone (the polygon)
2 . If the polygon is a rectangle, you can use the Image object - draw on it and then just draw on the screen again (copy the bitmap content to the screen) - scrren.drawImage.
If you want to use a different shape, you can use the PIXI library. There you can mask with the shape of another object.
- I will add that there is an option in the screen object and the Image class
setBlending which can be used as a mask.
You create two Image objects - one is a mask and by setting setBlending
to "multiply" and "darken" you use the bitmap mask effect.
https://microstudio.dev/community/help/how-to-implement-xor-for-a-canvas-drawing/808/
https://microstudio.io/i/Loginus/mask/