module

Mosaic

Constants

COMPLEX_BLOCKS = [Block.new('▙', {true, false, true, true}, "█ \n██"), Block.new('▟', {false, true, true, true}, " █\n██"), Block.new('▛', {true, true, true, false}, "██\n█ "), Block.new('▜', {true, true, false, true}, "██\n █"), Block.new('▚', {true, false, false, true}, "█ \n █"), Block.new('▞', {false, true, true, false}, " █\n█ ")]

Complex blocks

HALF_BLOCKS = [Block.new('▀', {true, true, false, false}, "██\n "), Block.new('▄', {false, false, true, true}, " \n██"), Block.new(' ', {false, false, false, false}, " \n "), Block.new('█', {true, true, true, true}, "██\n██")]

Half blocks (▀, ▄, space, █)

MIDDLE_THRESHOLD_LEVEL = 128_u8

In many contexts, a default threshold level is often set to 0.5 (or 50%), which means that values above this threshold are considered positive, while those below are considered negative. The value 128 represents the 0.5 of 0..255.

PLAN9_PALETTE = [StumpyCore::RGBA.new(0_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 68_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 68_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 68_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 68_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 136_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 136_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 136_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 136_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 204_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 204_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 204_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 204_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 221_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(17_u8, 17_u8, 17_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 85_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 85_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 76_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 73_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 153_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 153_u8, 76_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 153_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 147_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 221_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 221_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 221_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 238_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 238_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(34_u8, 34_u8, 34_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 102_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 102_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 102_u8, 102_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 85_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 79_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 170_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 170_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 170_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 158_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 238_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 238_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 255_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 255_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 255_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(51_u8, 51_u8, 51_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 119_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 0_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 119_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 119_u8, 119_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 93_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 85_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 187_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 187_u8, 93_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 187_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 170_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(0_u8, 255_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 0_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 0_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 0_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 68_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 68_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 68_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 68_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 136_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 136_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 136_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 136_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 204_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 204_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 204_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 204_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(68_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 0_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(76_u8, 0_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 0_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 85_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 85_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(76_u8, 76_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 73_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(76_u8, 153_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(76_u8, 153_u8, 76_u8, 255_u8), StumpyCore::RGBA.new(76_u8, 153_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 147_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 221_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 221_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 221_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(73_u8, 221_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 238_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(102_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(102_u8, 0_u8, 102_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 0_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 0_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(102_u8, 102_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(102_u8, 102_u8, 102_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 85_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 79_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 170_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 170_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 170_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 158_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 238_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 238_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(79_u8, 238_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 255_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 255_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(119_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(119_u8, 0_u8, 119_u8, 255_u8), StumpyCore::RGBA.new(93_u8, 0_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 0_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(119_u8, 119_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(119_u8, 119_u8, 119_u8, 255_u8), StumpyCore::RGBA.new(93_u8, 93_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 85_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(93_u8, 187_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(93_u8, 187_u8, 93_u8, 255_u8), StumpyCore::RGBA.new(93_u8, 187_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 170_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 255_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(85_u8, 255_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 0_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 0_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 68_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 68_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 68_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 68_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 136_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 136_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 136_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 136_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 204_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 204_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 204_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 204_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(136_u8, 0_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 0_u8, 76_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 0_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 0_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 76_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 76_u8, 76_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 76_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 73_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 153_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 153_u8, 76_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 153_u8, 153_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 147_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 221_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 221_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 221_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(147_u8, 221_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(153_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 0_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 0_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 0_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 85_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 85_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 85_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 79_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 170_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 170_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 170_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 158_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 238_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 238_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 238_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(158_u8, 238_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 255_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 0_u8, 93_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 0_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 0_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 93_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 93_u8, 93_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 93_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 85_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 187_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 187_u8, 93_u8, 255_u8), StumpyCore::RGBA.new(187_u8, 187_u8, 187_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 170_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 255_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 255_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(170_u8, 255_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 0_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 68_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 68_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 68_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 68_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 136_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 136_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 136_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 136_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 204_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 204_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 204_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 204_u8, 204_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 0_u8, 68_u8, 255_u8), StumpyCore::RGBA.new(204_u8, 0_u8, 136_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 0_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 0_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 73_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 73_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 73_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 73_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 147_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 147_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 147_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 147_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 221_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 221_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 221_u8, 147_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 221_u8, 221_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(221_u8, 0_u8, 73_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 0_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 0_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 0_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 79_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 79_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 79_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 79_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 158_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 158_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 158_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 158_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 238_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 238_u8, 79_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 238_u8, 158_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 238_u8, 238_u8, 255_u8), StumpyCore::RGBA.new(238_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 0_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 0_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 0_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 0_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 85_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 85_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 85_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 85_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 170_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 170_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 170_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 170_u8, 255_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 255_u8, 0_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 255_u8, 85_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 255_u8, 170_u8, 255_u8), StumpyCore::RGBA.new(255_u8, 255_u8, 255_u8, 255_u8)]

Plan9 palette (256 colors) from Go's image/color/palette package

QUARTER_BLOCKS = [Block.new('▘', {true, false, false, false}, "█ \n "), Block.new('▝', {false, true, false, false}, " █\n "), Block.new('▖', {false, false, true, false}, " \n█ "), Block.new('▗', {false, false, false, true}, " \n █"), Block.new('▌', {true, false, true, false}, "█ \n█ "), Block.new('▐', {false, true, false, true}, " █\n █"), Block.new('▀', {true, true, false, false}, "██\n "), Block.new('▄', {false, false, true, true}, " \n██")]

Quarter blocks

U8_MAX_VALUE = 255_u32

Represents 255.

VERSION = "0.1.0"

Constructors

new

New creates and returns a renderer. Added for API compatibility with Go's mosaic.New().

Source

Class methods

decode(path : String) : StumpyCore::Canvas

decode reads an image from path and converts it into a canvas.

Source
decode(io : IO) : StumpyCore::Canvas

decode reads an image from IO and converts it into a canvas.

Source
decode(bytes : Bytes) : StumpyCore::Canvas

decode reads an image from bytes and converts it into a canvas.

Source
premultiplied_16bit(color : StumpyCore::RGBA) : Tuple(UInt16, UInt16, UInt16, UInt16)

premultiplied_16bit returns premultiplied 16-bit components (RGBA) from a color. This mimics Go's color.Color.RGBA() which returns premultiplied values.

Source
premultiplied_shift(color : StumpyCore::RGBA) : Tuple(UInt8, UInt8, UInt8, UInt8)

premultiplied_shift returns premultiplied 8-bit components (RGBA) from a color. This mimics Go's color.Color.RGBA() which returns premultiplied values.

Source
render(canvas : StumpyCore::Canvas, width : Int, height : Int) : String

Render renders an image with width/height overrides. Added for API compatibility with Go's mosaic.Render(img, width, height).

Source
render(image : CrImage::Image, width : Int, height : Int) : String

Render renders a CrImage image with width/height overrides.

Source
render(path : String, width : Int, height : Int) : String

Render decodes an image from path and renders it with width/height overrides.

Source
render(io : IO, width : Int, height : Int) : String

Render decodes an image from IO and renders it with width/height overrides.

Source
render(bytes : Bytes, width : Int, height : Int) : String

Render decodes an image from bytes and renders it with width/height overrides.

Source
rgba_to_luminance(color : StumpyCore::RGBA) : UInt8

rgba_to_luminance converts RGBA color to luminance (brightness). Weighted RGB to account for human perception source: https://www.w3.org/TR/AERT/#color-contrast context: https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color

Source
shift(value : UInt32) : UInt32

Shift scales 16-bit color values (0-65535) down to 8-bit (0-255). If value > 255, shift right by 8 bits.

Source
shift_color(color : StumpyCore::RGBA) : Tuple(UInt8, UInt8, UInt8, UInt8)

shift_color returns 8-bit components from a premultiplied color. This mimics Go's shift function applied to RGBA() values.

Source
to_canvas(image : CrImage::Image) : StumpyCore::Canvas

to_canvas converts a CrImage image into a StumpyCore canvas.

Source

Nested types