pixelpapercraft / pixel-papercraft-generator-builder

Generator builder for Pixel Papercraft.
https://www.pixelpapercraft.com/print
32 stars 13 forks source link

Add ability to get and set the color at a single pixel #7

Open pixelpapercraft opened 3 years ago

pixelpapercraft commented 3 years ago

From @NinjolasNJM

The ability to do this is crucial for a layer outlining function, making seamless item generators, and several other things. They should be able to read or write a pixel's color and alpha information on a texture or image, directly from the canvas, or from an individual drawn layer.

NinjolasNJM commented 2 years ago

getImagePixelColor()and getCanvasPixelColor() - like getTexturePixelColor but for images and the generator canvas, respectively. Since for folds lines to be drawn the textures need to be drawn to the canvas, we need to be able to get the pixel colors there.

drawPixel() - draws a pixel of a certain color directly onto the canvas. This allows for drawing the fold lines without using a more costly image or texture. If not immediately difficult, methods for drawing simple shapes like rectangles, straight lines or circles might also prove useful.

fillTransparentWithWhite() - fills any pixels on the canvas that aren't fully opaque with white. Since the algorithm will need an object to be surrounded in transparency in order to work, this method will make the design fully opaque in the end.

pixelpapercraft commented 2 years ago

Thanks @NinjolasNJM, I'll look into these.