class Breadbin::Image::Multicolor

Overview

A low resolution image using any three colors plus the background color within each 4x8 pixel cell.

Each pixel in a Multicolor image has double horizontal width. When converted from a PNG image with .from_png only even horizontal pixels are considered.

Included Modules

Defined in:

breadbin/image/multicolor.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Breadbin::Image

[](x : Int32, y : Int32) [], []=(x : Int32, y : Int32, color : Int32 | Color) []=, cell_height : Int32 cell_height, cell_width : Int32 cell_width, colfix : String | Nil colfix, colfix=(colfix : String | Nil) colfix=, convert_png(png : StumpyPNG::PNG, rect : Rectangle) convert_png, height : Int32 height, height=(height : Int32) height=, palette : Palette palette, palette=(palette : Palette) palette=, width : Int32 width, width=(width : Int32) width=, write_png(pathname : String) write_png

Constructor Detail

def self.new(width : Int32, height : Int32, palette : Breadbin::Palette = Palette.new("colodore")) #

Creates an image with the given width, height and palette.


[View source]

Class Method Detail

def self.from_png(pathname : String, rect : Tuple | Rectangle | Nil = nil) #

[View source]

Instance Method Detail

def byte_at(x : Int32, y : Int32, clist : ColorList) : UInt8 #

Get the byte representation of the 4x1 pixel area at x and y, with clist holding the triplet of colors that should be mapped to the "01", "10" and "11" bit pairs respectively


[View source]
def cell_at(col : Int32, row : Int32, bgcolor : UInt8 = 0, sort_first : Bool = false) : Array(UInt8) #

Get a 10 bytes representation of the 4x8 pixel cell at the given col and row, where the first byte holds the screen color nybbles, the second byte holds the color map nybble and the remaining 8 bytes holds the bitmap data


[View source]
def chars_at(x : Int32, y : Int32, cols : Int32, rows : Int32, clist : ColorList, blank : Bool = true) : Array(UInt8) #

[View source]
def fixcount : Int32 #

[View source]
def fixcount=(fixcount : Int32) #

[View source]
def sprite_at(x : Int32, y : Int32, clist : ColorList) : Bytes #

Get a 63 bytes sprite representation of the 12x21 pixel region at the given x and y position, with clist holding the triplet of colors that should be mapped to the "01", "10" and "11" bit pairs respectively


[View source]
def to_bytes(bgcolor : UInt8 = 0_u8, pad : Bool = false) : Bytes #

Get a bytes representation of an image whose dimensions are 160x200 pixels. If optional parameter pad if set to true, pads bitmap and screen data so the following sections are page aligned


[View source]