struct

PNGUtil::Canvas

Inherits Struct < Value < Object

Constructors

new(width : Int32, height : Int32)
Source

Instance methods

==(other)

Two canvases are considered equal if they are of equal size and all their pixels are equal

Source
[](x, y)

Short form for get

Source
[]=(x, y, color)

Short form for set

Source
each_row

Iterate over each row of the canvas (a Slice(RGBA) of size @width). The main usecase for this is writing code that encodes images in some file format.

Source
get(x, y)

Get the value of pixel (x, y) without checking if (x, y) is a valid position.

Source
height
Source
pixels
Source
resize(new_width : Int32, new_height : Int32)

very basic nearest neighbor image scaling algorithm

Source
set(x, y, color)

Set the value of pixel (x, y) to color without checking if (x, y) is a valid position.

Source
width
Source