Skip to content

Commit

Permalink
Add U220 image support
Browse files Browse the repository at this point in the history
Adds support for dotDensity 0,1
Closes qzind#10
  • Loading branch information
lite1979 committed Mar 12, 2020
1 parent 03454b6 commit 8e9971f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/qz/printer/ImageWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ private void appendEpsonSlices(ByteArrayBuilder builder) {
// draw the bitmap in multiple passes, then we'll end up with some
// whitespace between slices of the image since the default line
// height--how much the printer moves on a newline--is 30 dots.
builder.append(new byte[] {0x1B, 0x33, 24});
int stripeWidth = dotDensity <=1 ? 1 : 3;
int stripeHeight = dotDensity <= 1 ? 16 : 24;
builder.append(new byte[] {0x1B, 0x33, (byte)stripeHeight });

// OK. So, starting from x = 0, read 24 bits down and send that data
// to the printer. The offset variable keeps track of our global 'y'
Expand Down Expand Up @@ -513,7 +515,7 @@ private void appendEpsonSlices(ByteArrayBuilder builder) {
// Remember, 24 dots = 24 bits = 3 bytes.
// The 'k' variable keeps track of which of those
// three bytes that we're currently scribbling into.
for(int k = 0; k < 3; ++k) {
for(int k = 0; k < stripeWidth; ++k) {
byte slice = 0;

// A byte is 8 bits. The 'b' variable keeps track
Expand Down Expand Up @@ -554,7 +556,7 @@ private void appendEpsonSlices(ByteArrayBuilder builder) {
// We're done with this 24-dot high pass. Render a newline
// to bump the print head down to the next line
// and keep on trucking.
offset += 24;
offset += 8 * stripeWidth;
builder.append(new byte[] {10});
}

Expand Down

0 comments on commit 8e9971f

Please sign in to comment.