Device-Chip-SSD1306
view release on metacpan or search on metacpan
lib/Device/Chip/SSD1306.pm view on Meta::CPAN
=cut
method draw_blit ( $x0, $y, @lines )
{
$_framebuffer or
_framebuffer_new( $_framebuffer, $_rows, $_columns );
# TODO: more efficient in XS, somehow...?
for( ; @lines; $y++ ) {
my @pixels = split m//, shift @lines;
@pixels or next;
my $x = $x0;
for( ; @pixels; $x++ ) {
my $p = shift @pixels;
$p eq " " ? next :
$p eq "-" ? _framebuffer_draw_pixel( $_framebuffer, $x, $y, 0 ) :
_framebuffer_draw_pixel( $_framebuffer, $x, $y, 1 );
}
( run in 0.790 second using v1.01-cache-2.11-cpan-71847e10f99 )