11# coding: utf-8
22
3- =begin
4- The `BlockCanvas` is also Unicode-based.
5- It has half the resolution of the `BrailleCanvas`.
6- In contrast to BrailleCanvas, the pixels don't
7- have visible spacing between them.
8- This canvas effectively turns every character
9- into 4 pixels that can individually be manipulated
10- using binary operations.
11- =end
12-
133module UnicodePlot
4+ # The `BlockCanvas` is also Unicode-based.
5+ # It has half the resolution of the `BrailleCanvas`.
6+ # In contrast to BrailleCanvas, the pixels don't
7+ # have visible spacing between them.
8+ # This canvas effectively turns every character
9+ # into 4 pixels that can individually be manipulated
10+ # using binary operations.
1411 class BlockCanvas < LookupCanvas
1512 X_PIXEL_PER_CHAR = 2
1613 Y_PIXEL_PER_CHAR = 2
@@ -23,14 +20,17 @@ def initialize(width, height, fill_char=0, **kw)
2320 **kw )
2421 end
2522
26- BLOCK_SIGNS = [ [ 0b1000 , 0b0010 ] . freeze ,
27- [ 0b0100 , 0b0001 ] . freeze
28- ] . freeze
23+ BLOCK_SIGNS = [
24+ [ 0b1000 , 0b0010 ] . freeze ,
25+ [ 0b0100 , 0b0001 ] . freeze
26+ ] . freeze
2927
30- BLOCK_DECODE = [ ' ' , '▗' , '▖' , '▄' ,
31- '▝' , '▐' , '▞' , '▟' ,
32- '▘' , '▚' , '▌' , '▙' ,
33- '▀' , '▜' , '▛' , '█' ] . freeze
28+ BLOCK_DECODE = [
29+ ' ' , '▗' , '▖' , '▄' ,
30+ '▝' , '▐' , '▞' , '▟' ,
31+ '▘' , '▚' , '▌' , '▙' ,
32+ '▀' , '▜' , '▛' , '█'
33+ ] . freeze
3434
3535 def lookup_encode ( x , y ) ; BLOCK_SIGNS [ x ] [ y ] ; end
3636 def lookup_decode ( x ) ; BLOCK_DECODE [ x ] ; end
0 commit comments