struct PNGUtil::Canvas

Defined in:

png_util/canvas.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(width : Int32, height : Int32) #

[View source]

Instance Method Detail

def ==(other) #

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


[View source]
def [](x, y) #

Short form for #get


[View source]
def []=(x, y, color) #

Short form for #set


[View source]
def 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.


[View source]
def get(x, y) #

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


[View source]
def height : Int32 #

[View source]
def pixels : Slice(RGBA::Data) #

[View source]
def resize(new_width : Int32, new_height : Int32) #

very basic nearest neighbor image scaling algorithm


[View source]
def set(x, y, color) #

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


[View source]
def width : Int32 #

[View source]