fixes for image transparency with PDF output

This commit is contained in:
Ben Fry
2013-10-06 15:46:21 -04:00
parent ef06f13dbc
commit e6d7ff653d
3 changed files with 17 additions and 11 deletions
+2
View File
@@ -10,6 +10,8 @@ X https://github.com/processing/processing/issues/2100
X not handled by BufferedReader (or XML parser)
X http://stackoverflow.com/questions/10556875/list-of-unicode-characters-that-should-be-filtered-in-output
X http://stackoverflow.com/questions/3072152/what-is-unicode-character-2028-ls-line-separator-used-for
X fix image transparency in PDF output
X https://github.com/processing/processing/pull/2070
_ Sort out blending differences with P2D/P3D
_ https://github.com/processing/processing/issues/1844
@@ -22,16 +22,13 @@ package processing.pdf;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Image;
import java.io.*;
import java.util.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
// Tried iText 5, but it was too slow
//import com.itextpdf.text.*;
//import com.itextpdf.text.pdf.*;
import processing.core.*;
@@ -405,20 +402,19 @@ public class PGraphicsPDF extends PGraphicsJava2D {
protected void imageImpl(PImage image,
float x1, float y1, float x2, float y2,
int u1, int v1, int u2, int v2) {
float x1, float y1, float x2, float y2,
int u1, int v1, int u2, int v2) {
pushMatrix();
translate(x1, y1);
int imageWidth = image.width;
int imageHeight = image.height;
scale((x2 - x1) / (float)imageWidth,
(y2 - y1) / (float)imageHeight);
if (u2-u1 != imageWidth || v2-v1 != imageHeight) {
PImage tmp = new PImage(u2-u1, v2-v1, ARGB);
tmp.copy(image, u1, v1, u2, v2, 0, 0, u2-u1, v2-v1);
g2.drawImage(image.getImage(), 0, 0, null);
if (u2-u1 == imageWidth && v2-v1 == imageHeight) {
g2.drawImage((Image) image.getNative(), 0, 0, null);
} else {
g2.drawImage(image.getImage(), u1, v1, null);
PImage tmp = image.get(u1, v1, u2-u1, v2-v1);
g2.drawImage((Image) tmp.getNative(), 0, 0, null);
}
popMatrix();
}
+8
View File
@@ -14,12 +14,20 @@ X https://github.com/processing/processing/pull/2093
X cmd-left is bringing up the text area popup
X https://github.com/processing/processing/issues/2103
_ still having right-click issues
_ https://github.com/processing/processing/issues/2103
X add appbundler.jar, otherwise folks have to include Xcode
_ if they want to build appbundler, they'll need Xcode
_ and the command line tools Preferences > Downloads > Command Line Tools
_ appbundler will have an NPE if the osx binary isn't built
_ also need to have 10.8 version of the SDK (old Xcode won't work)
_ type looks a little feeble on OS X
_ retina problem? may need to turn off (on?) smoothing
_ also need to have a central menubar
_ add the offscreen window hack
_ otherwise mode change causes "do you want to quit?" on OS X
_ fix console font on Windows and Linux with 7u40
_ the message area text also looks ugly.. can we fix?
_ add pref to select PDE font (so that CJKV languages work better)