Instance methods
[](x : UInt32, y : UInt32)
Get the data at x, y into the canvas.
This returns the Bytes that represent the pixel.
Source[](x : Number, y : Number)
Get the data at x, y into the canvas.
This returns the Bytes that represent the pixel.
Source[]=(x : UInt32, y : UInt32, c : Int, value : UInt8)
Set an individual channel in a color at x,y
Source[]=(x : UInt32, y : UInt32, values : Indexable(UInt8))
Set the pixel at x, y on the canvas via bytes that correspond to the
color type and bit depth.
For example, an image with 8bits per channel in RGB (PNG::ColorType::TrueColor)
would be set with 3 bytes: canvas[0, 0] = Bytes[255, 0, 255]
A canvas with 16bits in RGB would accept 6 bytes, (2 bytes per channel):
canvas[0, 0] = Bytes[255, 255, 0, 0, 255, 255]
Source[]=(x, y, values : Indexable(UInt8))
Source[]=(x, y, values : Indexable(UInt16))
Source[]=(x, y, values : Indexable(Number))
Source[]=(x : Number, y : Number, value : Int)
Sourcebg_color=(bg_color : Bytes | Nil)
Sourcebit_depth(*args, **options)
Sourcebit_depth(*args, **options, &)
Sourcebit_index(x : UInt32, y : UInt32)
Calculates the index into the canvas that a value would be at, accounting
for padding that would exist at the end of a scanline where bit depth < 8
Sourcebits_per_pixel(*args, **options)
Sourcebits_per_pixel(*args, **options, &)
Sourcebyte_index(x : UInt32, y : UInt32)
Sourcebytes_per_pixel(*args, **options)
Sourcebytes_per_pixel(*args, **options, &)
Sourcebytes_per_row(*args, **options)
Sourcebytes_per_row(*args, **options, &)
Sourceclone
Return a deep clone of this canvas
Sourcecolor(x, y) : Enumerable
Sourcecolor_type(*args, **options)
Sourcecolor_type(*args, **options, &)
Sourcecopy_ancilarry(to : Canvas)
Copy the ancillarry data to a new canvas
Sourcecrop(start_x : Int, start_y : Int, end_x : Int, end_y : Int)
Crop a canvas in absolute coordinates
Sourcegama=(gama : UInt32 | Nil)
Sourceheight(*args, **options)
Sourceheight(*args, **options, &)
Sourcelast_modified=(last_modified : Time | Nil)
Sourcepalette=(palette : Palette | Nil)
Sourcepixel_size=(pixel_size : PixelSize | Nil)
Sourceresize_bilinear(width, height)
Sourceresize_nearest_neighbor(width, height)
Sourcescanline(y)
Return the bytes corresponding to scanline
Sourceset_color(x, y, color : Enumerable)
Sourcetransparency=(transparency : Bytes | Nil)
Sourcewidth(*args, **options, &)
Source