@@ -9,11 +9,11 @@ export blockize, brailize, blockize!, brailize!
9
9
brailize(a, cutoff=0)
10
10
Convert an array to a block unicode string, filling values above the cutoff point.
11
11
"""
12
- blockize (a, cutoff= 0 ) = begin
13
- yrange, xrange = axes (a)
14
- out = Array {Char,2} (undef, length (xrange) + 1 , ( length (yrange) - 1 ) ÷ 2 + 1 )
15
- blockize! (out, a, cutoff )
16
- end
12
+ blockize (a, cutoff= 0 ) = blockize! ( initblock ( size (a)), a, cutoff)
13
+
14
+ # x and y are inverted: repl rows are columns.
15
+ initblock ((y, x)) = initblock (y, x )
16
+ initblock (y, x) = Array {Char,2} (undef, x + 1 , (y - 1 ) ÷ 2 + 1 )
17
17
18
18
"""
19
19
blockize!(out, a, cutoff=0)
@@ -54,11 +54,11 @@ const braile_hex = ((0x01, 0x08), (0x02, 0x10), (0x04, 0x20), (0x40, 0x80))
54
54
brailize(a, cutoff=0)
55
55
Convert an array to a braile unicode string, filling values above the cutoff point.
56
56
"""
57
- brailize (a, cutoff= 0 ) = begin
58
- yrange, xrange = axes (a)
59
- out = Array {Char,2} (undef, ( length (xrange) - 1 ) ÷ 2 + 2 , ( length (yrange) - 1 ) ÷ 4 + 1 )
60
- brailize! (out, a, cutoff )
61
- end
57
+ brailize (a, cutoff= 0 ) = brailize! ( initbraile ( size (a)), a, cutoff)
58
+
59
+ # x and y are inverted: repl rows are columns.
60
+ initbraile ((y, x)) = initbraile (y, x )
61
+ initbraile (y, x) = Array {Char,2} (undef, (x - 1 ) ÷ 2 + 2 , (y - 1 ) ÷ 4 + 1 )
62
62
63
63
"""
64
64
brailize!(out, a, cutoff=0)
0 commit comments