Converts the canvas to a string formatted according to the PPM Netpbm color image format formatted
The flavour of PPM used here is plain P3 and not the P6 format.You can read more about the PPM format here
A string formatted in the PPM P3 flavour that can be directly output to a file.
Generated using TypeDoc
Class representing a canvas A canvas is a simply a collection of pixels/colors. It may be more accurate to think of this canvas class as a container for a 2D array of colors, where each color represents a pixel that will display in a image.
Remarks
It is instantiated with width and height and an optional default color for every pixel. Leaving the initial pixel value unset, will fall back on a default of Color(0, 0, 0)/black for every pixel.
Example
We can instantiate a 2 x 2 canvas like so:
When you look at it in this array form it actually looks more like a 3D array with the dimension 2 x 2 x 3. The third Dimension '3' is actually for the R, G & B channel values