imagewriter 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/imagewriter +12 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77ca6f3e137ccfeaeba35f244dec9120228c2d97bb2d142ac6921e35499c83fd
|
4
|
+
data.tar.gz: aef292b460bd049619cca44df720210d45f82c4214056edbcb9be5c62829393d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf720fa12f2165a6f3fe9fde2e3cb8ca4089876fcd482bdd8169010fdcabf24850843e1892356b9201184c6d27dddedd1ee0d5ffef7ec49f84d966cf2f6684a7
|
7
|
+
data.tar.gz: 15f1050d9fdcf75c07fb39693b010a4057fd1f46f740e905a20caa4d38c20d3c325ca02f37583123b7d1d1b07be4284af743b4917d0038b8f7c137dee5a3ab17
|
data/bin/imagewriter
CHANGED
@@ -46,18 +46,18 @@ class ImageWriter
|
|
46
46
|
y = -16 # start here to provide any necessary margin for dovetailing
|
47
47
|
|
48
48
|
while (y <= @img.height) do
|
49
|
-
bytes1 = 0.upto(width).map{|x| b1(x, y) & dovemask1}
|
50
|
-
bytes2 = 0.upto(width).map{|x| b2(x, y) & dovemask2}
|
49
|
+
bytes1 = 0.upto(width-1).map{|x| b1(x, y) & dovemask1}
|
50
|
+
bytes2 = 0.upto(width-1).map{|x| b2(x, y) & dovemask2}
|
51
51
|
|
52
52
|
printf "\eG%.4d", bytes1.length
|
53
53
|
bytes1.each{|b| print b.chr}
|
54
|
-
|
54
|
+
print "\r"
|
55
55
|
|
56
|
-
|
56
|
+
print "\x1F1" # one line feed
|
57
57
|
|
58
58
|
printf "\eG%.4d", bytes2.length
|
59
59
|
bytes2.each{|b| print b.chr}
|
60
|
-
|
60
|
+
print "\r"
|
61
61
|
|
62
62
|
printf "\x1F%s", LINE_FEEDS[lines_per_double_pass - 1]
|
63
63
|
|
@@ -126,17 +126,17 @@ Options:
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
parser.on("-q", "--quality QUALITY", Integer, "Print quality. 1 (fastest) to
|
130
|
-
if n > 0 && n <
|
129
|
+
parser.on("-q", "--quality QUALITY", Integer, "Print quality. 1 (fastest) to 7 (best); default #{options[:quality]}") do |n|
|
130
|
+
if n > 0 && n < 8
|
131
131
|
options[:quality] = n
|
132
132
|
else
|
133
|
-
STDERR.puts "Bad quality setting #{n} (must be 1-
|
133
|
+
STDERR.puts "Bad quality setting #{n} (must be 1-7)"
|
134
134
|
STDERR.puts parser
|
135
135
|
exit 1
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
parser.on("-s", "--sleep", Float, "Sleep this many seconds between passes. Default #{options[:sleep]}") do |n|
|
139
|
+
parser.on("-s", "--sleep SECONDS", Float, "Sleep this many seconds between passes. Default #{options[:sleep]}") do |n|
|
140
140
|
options[:sleep] = n
|
141
141
|
end
|
142
142
|
|
@@ -186,20 +186,17 @@ Options:
|
|
186
186
|
0b10000000 * get(x, y+15)
|
187
187
|
end
|
188
188
|
|
189
|
-
## Returns
|
189
|
+
## Returns 1 for black pixels that exist, 0 otherwise
|
190
190
|
def get(x, y)
|
191
191
|
x = @img[x, y] & 0xffffff00 # strip alpha channel
|
192
192
|
return 0 if x > 0
|
193
193
|
1
|
194
194
|
rescue
|
195
|
-
|
195
|
+
0
|
196
196
|
end
|
197
197
|
|
198
198
|
def init_printer!
|
199
|
-
|
200
|
-
printf "\e\x6C1" # do not insert carriage return before LF and FF
|
201
|
-
printf "\eZ\x80\x00" # no line feed added after CR
|
202
|
-
printf "\eT01" # set line feed to 1/144 inch
|
199
|
+
print "\eT01" # set line feed to 1/144 inch
|
203
200
|
printf "\e%s", HORIZ_DPI_CODE[@hdpi]
|
204
201
|
end
|
205
202
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imagewriter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pete gamache
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: pete@gamache.org
|