This introduces a system property in XGraphics2D, which turns on opaque
image rendering for all images, even translucent ones. This is intended
for debugging and demostration purposes only.
2008-02-18 Roman Kennke <[EMAIL PROTECTED]>
* gnu/java/awt/peer/x/XGraphics2D.java
(RENDER_OPAQUE): New constant with system property to
turn on opaque image rendering.
(rawDrawImage): Render images opaque when system property
is set. This is for demonstration and debugging purposes only.
/Roman
--
Dipl.-Inform. (FH) Roman Kennke, Software Engineer, http://kennke.org
aicas Allerton Interworks Computer Automated Systems GmbH
Haid-und-Neu-Straße 18 * D-76131 Karlsruhe * Germany
http://www.aicas.com * Tel: +49-721-663 968-0
USt-Id: DE216375633, Handelsregister HRB 109481, AG Karlsruhe
Geschäftsführer: Dr. James J. Hunt
Index: gnu/java/awt/peer/x/XGraphics2D.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/x/XGraphics2D.java,v
retrieving revision 1.9
diff -u -1 -0 -r1.9 XGraphics2D.java
--- gnu/java/awt/peer/x/XGraphics2D.java 18 Feb 2008 19:45:48 -0000 1.9
+++ gnu/java/awt/peer/x/XGraphics2D.java 18 Feb 2008 19:59:38 -0000
@@ -63,20 +63,28 @@
import gnu.x11.Colormap;
import gnu.x11.Drawable;
import gnu.x11.GC;
import gnu.x11.image.ZPixmap;
public class XGraphics2D
extends AbstractGraphics2D
{
/**
+ * When this property is set to true, then images are always rendered as
+ * opaque images, ignoring their translucence. This is intended for
+ * debugging and demonstration purposes.
+ */
+ private static final boolean RENDER_OPAQUE =
+ Boolean.getBoolean("escherpeer.renderopaque");
+
+ /**
* The X Drawable to draw on.
*/
private Drawable xdrawable;
/**
* The X graphics context (GC).
*/
private GC xgc;
/**
@@ -362,21 +370,21 @@
else
{
int transparency = bi.getTransparency();
int w = bi.getWidth();
int h = bi.getHeight();
if (imageCache.containsKey(image))
{
ZPixmap zpixmap = imageCache.get(image);
xdrawable.put_image(xgc, zpixmap, x, y);
}
- else if (transparency == Transparency.OPAQUE)
+ else if (transparency == Transparency.OPAQUE || RENDER_OPAQUE)
{
XGraphicsDevice gd = XToolkit.getDefaultDevice();
ZPixmap zpixmap = new ZPixmap(gd.getDisplay(), w, h);
for (int yy = 0; yy < h; yy++)
{
for (int xx = 0; xx < w; xx++)
{
int rgb = bi.getRGB(xx, yy);
zpixmap.set(xx, yy, rgb);
}