Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,32 @@ public AndroidDrawDevice(Bitmap bitmap) {
this(bitmap, 0, 0, true);
}

public static Bitmap drawPage(Page page, Matrix ctm) {
public static Bitmap drawPage(Page page, Matrix ctm, boolean isLuminanceInverted) {
RectI ibox = new RectI(page.getBounds().transform(ctm));
int w = ibox.x1 - ibox.x0;
int h = ibox.y1 - ibox.y0;
Bitmap bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
AndroidDrawDevice dev = new AndroidDrawDevice(bmp, ibox.x0, ibox.y0);
try {
page.run(dev, ctm, null);
if (isLuminanceInverted) dev.invertLuminance();
dev.close();
} finally {
dev.destroy();
}
return bmp;
}

public static Bitmap drawPage(Page page, Matrix ctm) {
return drawPage(page, ctm, false);
}

public static Bitmap drawPage(Page page, float dpi, int rotate) {
return drawPage(page, new Matrix(dpi / 72).rotate(rotate));
return drawPage(page, new Matrix(dpi / 72).rotate(rotate), false);
}

public static Bitmap drawPage(Page page, float dpi) {
return drawPage(page, new Matrix(dpi / 72));
return drawPage(page, new Matrix(dpi / 72), false);
}

public static Matrix fitPage(Page page, int fitW, int fitH) {
Expand Down