Commit 81f7282f by Scott Gilbertson Committed by Scott Gilbertson

Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.

	* Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.
	* Makefile.in: re-generated.
	* gnu/awt/j2d/IntegerGraphicsState.java
	(ScreenCoupledImage): new interface.
	(drawImage): detect ScreenCoupledImage instances.
	* gnu/awt/xlib/XCanvasPeer.java (createImage) implemented.
	* gnu/awt/xlib/XEventLoop.java
	(createEvent): re-formatted, and rearranged to avoid null pointer.
	* gnu/awt/xlib/XGraphics.java
	(drawImage): added XOffScreenImage handling.
	* gnu/awt/xlib/XOffScreenImage.java: new file.
	* gnu/gcj/xlib/Drawable.java (getDepth): new native method.
	* gnu/gcj/xlib/GC.java (copyArea): new native method.
	* gnu/gcj/xlib/XAnyEvent.java
	(TYPE_KEY_PRESS): new constant.
	(TYPE_KEY_RELEASE): new constant.
	(TYPE_MOTION_NOTIFY): new constant.
	(TYPE_ENTER_NOTIFY): new constant.
	(TYPE_LEAVE_NOTIFY): new constant.
	(TYPE_FOCUS_IN): new constant.
	(TYPE_FOCUS_OUT): new constant.
	(TYPE_KEYMAP_NOTIFY): new constant.
	(TYPE_GRAPHICS_EXPOSE): new constant.
	(TYPE_NO_EXPOSE): new constant.
	(TYPE_VISIBILITY_NOTIFY): new constant.
	(TYPE_CREATE_NOTIFY): new constant.
	(TYPE_DESTROY_NOTIFY): new constant.
	(TYPE_MAP_REQUEST): new constant.
	(TYPE_CONFIGURE_REQUEST): new constant.
	(TYPE_GRAVITY_NOTIFY): new constant.
	(TYPE_RESIZE_REQUEST): new constant.
	(TYPE_CIRCULATE_NOTIFY): new constant.
	(TYPE_CIRCULATE_REQUEST): new constant.
	(TYPE_PROPERTY_NOTIFY): new constant.
	(TYPE_SELECTION_CLEAR): new constant.
	(TYPE_SELECTION_REQUEST): new constant.
	(TYPE_SELECTION_NOTIFY): new constant.
	(TYPE_COLORMAP_NOTIFY): new constant.
	(TYPE_MAPPING_NOTIFY): new constant.
	* gnu/gcj/xlib/natDrawable.cc (getDepth): new method.
	* gnu/gcj/xlib/natGC.cc (copyArea): new method
	* java/awt/Component.java (createImage): changed to use peer method.

From-SVN: r70776
parent 1281fe11
2003-08-25 Scott Gilbertson <scottg@mantatest.com>
* Makefile.am: added gnu/awt/xlib/XOffScreenImage.java.
* Makefile.in: re-generated.
* gnu/awt/j2d/IntegerGraphicsState.java
(ScreenCoupledImage): new interface.
(drawImage): detect ScreenCoupledImage instances.
* gnu/awt/xlib/XCanvasPeer.java (createImage) implemented.
* gnu/awt/xlib/XEventLoop.java
(createEvent): re-formatted, and rearranged to avoid null pointer.
* gnu/awt/xlib/XGraphics.java
(drawImage): added XOffScreenImage handling.
* gnu/awt/xlib/XOffScreenImage.java: new file.
* gnu/gcj/xlib/Drawable.java (getDepth): new native method.
* gnu/gcj/xlib/GC.java (copyArea): new native method.
* gnu/gcj/xlib/XAnyEvent.java
(TYPE_KEY_PRESS): new constant.
(TYPE_KEY_RELEASE): new constant.
(TYPE_MOTION_NOTIFY): new constant.
(TYPE_ENTER_NOTIFY): new constant.
(TYPE_LEAVE_NOTIFY): new constant.
(TYPE_FOCUS_IN): new constant.
(TYPE_FOCUS_OUT): new constant.
(TYPE_KEYMAP_NOTIFY): new constant.
(TYPE_GRAPHICS_EXPOSE): new constant.
(TYPE_NO_EXPOSE): new constant.
(TYPE_VISIBILITY_NOTIFY): new constant.
(TYPE_CREATE_NOTIFY): new constant.
(TYPE_DESTROY_NOTIFY): new constant.
(TYPE_MAP_REQUEST): new constant.
(TYPE_CONFIGURE_REQUEST): new constant.
(TYPE_GRAVITY_NOTIFY): new constant.
(TYPE_RESIZE_REQUEST): new constant.
(TYPE_CIRCULATE_NOTIFY): new constant.
(TYPE_CIRCULATE_REQUEST): new constant.
(TYPE_PROPERTY_NOTIFY): new constant.
(TYPE_SELECTION_CLEAR): new constant.
(TYPE_SELECTION_REQUEST): new constant.
(TYPE_SELECTION_NOTIFY): new constant.
(TYPE_COLORMAP_NOTIFY): new constant.
(TYPE_MAPPING_NOTIFY): new constant.
* gnu/gcj/xlib/natDrawable.cc (getDepth): new method.
* gnu/gcj/xlib/natGC.cc (copyArea): new method
* java/awt/Component.java (createImage): changed to use peer method.
2003-08-22 Thomas Fitzsimmons <fitzsim@redhat.com> 2003-08-22 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GdkGraphics.java (drawString): Pass font * gnu/java/awt/peer/gtk/GdkGraphics.java (drawString): Pass font
......
...@@ -2651,6 +2651,7 @@ gnu/awt/xlib/XFontMetrics.java \ ...@@ -2651,6 +2651,7 @@ gnu/awt/xlib/XFontMetrics.java \
gnu/awt/xlib/XFramePeer.java \ gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \ gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \ gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \ gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java gnu/awt/xlib/XToolkit.java
......
...@@ -2416,6 +2416,7 @@ gnu/awt/xlib/XFontMetrics.java \ ...@@ -2416,6 +2416,7 @@ gnu/awt/xlib/XFontMetrics.java \
gnu/awt/xlib/XFramePeer.java \ gnu/awt/xlib/XFramePeer.java \
gnu/awt/xlib/XGraphics.java \ gnu/awt/xlib/XGraphics.java \
gnu/awt/xlib/XGraphicsConfiguration.java \ gnu/awt/xlib/XGraphicsConfiguration.java \
gnu/awt/xlib/XOffScreenImage.java \
gnu/awt/xlib/XPanelPeer.java \ gnu/awt/xlib/XPanelPeer.java \
gnu/awt/xlib/XToolkit.java gnu/awt/xlib/XToolkit.java
...@@ -2710,10 +2711,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2710,10 +2711,11 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/awt/xlib/XFontMetrics.P .deps/gnu/awt/xlib/XFramePeer.P \ .deps/gnu/awt/xlib/XFontMetrics.P .deps/gnu/awt/xlib/XFramePeer.P \
.deps/gnu/awt/xlib/XGraphics.P \ .deps/gnu/awt/xlib/XGraphics.P \
.deps/gnu/awt/xlib/XGraphicsConfiguration.P \ .deps/gnu/awt/xlib/XGraphicsConfiguration.P \
.deps/gnu/awt/xlib/XPanelPeer.P .deps/gnu/awt/xlib/XToolkit.P \ .deps/gnu/awt/xlib/XOffScreenImage.P .deps/gnu/awt/xlib/XPanelPeer.P \
.deps/gnu/classpath/Configuration.P .deps/gnu/gcj/Core.P \ .deps/gnu/awt/xlib/XToolkit.P .deps/gnu/classpath/Configuration.P \
.deps/gnu/gcj/RawData.P .deps/gnu/gcj/convert/BytesToUnicode.P \ .deps/gnu/gcj/Core.P .deps/gnu/gcj/RawData.P \
.deps/gnu/gcj/convert/Convert.P .deps/gnu/gcj/convert/IOConverter.P \ .deps/gnu/gcj/convert/BytesToUnicode.P .deps/gnu/gcj/convert/Convert.P \
.deps/gnu/gcj/convert/IOConverter.P \
.deps/gnu/gcj/convert/Input_8859_1.P \ .deps/gnu/gcj/convert/Input_8859_1.P \
.deps/gnu/gcj/convert/Input_ASCII.P \ .deps/gnu/gcj/convert/Input_ASCII.P \
.deps/gnu/gcj/convert/Input_EUCJIS.P \ .deps/gnu/gcj/convert/Input_EUCJIS.P \
......
...@@ -44,6 +44,19 @@ public class IntegerGraphicsState extends AbstractGraphicsState ...@@ -44,6 +44,19 @@ public class IntegerGraphicsState extends AbstractGraphicsState
DirectRasterGraphics directGfx; DirectRasterGraphics directGfx;
Shape clip; Shape clip;
/** Interface for images which are coupled to a GraphicsConfiguration,
* as is typically the case for an off-screen buffer used in
* double-buffering. Any image which implements this interface is
* rendered directly by DirectRasterGraphics (i.e. by directGfx.drawImage)
*/
public interface ScreenCoupledImage
{
/** Get the GraphicsConfiguration to which this image is coupled
* @return the GraphicsConfiguration
*/
GraphicsConfiguration getGraphicsConfiguration ();
}
public IntegerGraphicsState(DirectRasterGraphics directGfx) public IntegerGraphicsState(DirectRasterGraphics directGfx)
{ {
this.directGfx = directGfx; this.directGfx = directGfx;
...@@ -245,25 +258,31 @@ public class IntegerGraphicsState extends AbstractGraphicsState ...@@ -245,25 +258,31 @@ public class IntegerGraphicsState extends AbstractGraphicsState
x += tx; x += tx;
y += ty; y += ty;
if (image instanceof ScreenCoupledImage)
{
GraphicsConfiguration config
= ((ScreenCoupledImage)image).getGraphicsConfiguration ();
if (config == frontend.config)
return directGfx.drawImage (image, x, y, observer);
}
if (image instanceof BufferedImage) if (image instanceof BufferedImage)
{ {
BufferedImage bImage = (BufferedImage) image; BufferedImage bImage = (BufferedImage) image;
Object config = // FIXME: eliminate? ScreenCoupledImage is probably more efficient
bImage.getProperty("java.awt.GraphicsConfiguration"); Object config = bImage.getProperty ("java.awt.GraphicsConfiguration");
if (config == frontend.config) if (config == frontend.config)
return directGfx.drawImage(image, x, y, observer); return directGfx.drawImage (image, x, y, observer);
int width = image.getWidth(null); int width = image.getWidth (null);
int height = image.getHeight(null); int height = image.getHeight (null);
Rectangle bounds = new Rectangle(x, y, width, height); Rectangle bounds = new Rectangle (x, y, width, height);
MappedRaster mr = directGfx.mapRaster(bounds); MappedRaster mr = directGfx.mapRaster (bounds);
// manipulate raster here... // manipulate raster here...
ColorModel colorModel = mr.getColorModel(); ColorModel colorModel = mr.getColorModel ();
WritableRaster raster = mr.getRaster(); WritableRaster raster = mr.getRaster ();
int xEnd = x + width; int xEnd = x + width;
int yEnd = y + height; int yEnd = y + height;
...@@ -275,14 +294,14 @@ public class IntegerGraphicsState extends AbstractGraphicsState ...@@ -275,14 +294,14 @@ public class IntegerGraphicsState extends AbstractGraphicsState
{ {
for (int xx=0; xx<width; xx++) for (int xx=0; xx<width; xx++)
{ {
int srgb = bImage.getRGB(xx, yy); int srgb = bImage.getRGB (xx, yy);
int sa = ((srgb >>> 24) & 0xff) + 1; int sa = ((srgb >>> 24) & 0xff) + 1;
int sr = ((srgb >>> 16) & 0xff) + 1; int sr = ((srgb >>> 16) & 0xff) + 1;
int sg = ((srgb >>> 8) & 0xff) + 1; int sg = ((srgb >>> 8) & 0xff) + 1;
int sb = (srgb & 0xff) + 1; int sb = (srgb & 0xff) + 1;
rgbElem = raster.getDataElements(xx+x, yy+y, rgbElem); rgbElem = raster.getDataElements (xx+x, yy+y, rgbElem);
int drgb = colorModel.getRGB(rgbElem); int drgb = colorModel.getRGB (rgbElem);
int dr = ((drgb >>> 16) & 0xff) + 1; int dr = ((drgb >>> 16) & 0xff) + 1;
int dg = ((drgb >>> 8) & 0xff) + 1; int dg = ((drgb >>> 8) & 0xff) + 1;
int db = (drgb & 0xff) + 1; int db = (drgb & 0xff) + 1;
...@@ -294,16 +313,16 @@ public class IntegerGraphicsState extends AbstractGraphicsState ...@@ -294,16 +313,16 @@ public class IntegerGraphicsState extends AbstractGraphicsState
drgb = (dr<<16) | (dg<<8) | db; drgb = (dr<<16) | (dg<<8) | db;
rgbElem = colorModel.getDataElements(drgb, rgbElem); rgbElem = colorModel.getDataElements (drgb, rgbElem);
raster.setDataElements(xx+x, yy+y, rgbElem); raster.setDataElements (xx+x, yy+y, rgbElem);
} }
} }
directGfx.unmapRaster(mr); directGfx.unmapRaster (mr);
return true; return true;
} }
throw new UnsupportedOperationException("drawing image " + image + throw new UnsupportedOperationException ("drawing image " + image +
"not implemented"); "not implemented");
} }
......
...@@ -214,7 +214,7 @@ public class XCanvasPeer implements CanvasPeer ...@@ -214,7 +214,7 @@ public class XCanvasPeer implements CanvasPeer
} }
public Image createImage(int width, int height) public Image createImage(int width, int height)
{ {
throw new UnsupportedOperationException("FIXME, not implemented"); return new XOffScreenImage (config, window, width, height);
} }
public void dispose() public void dispose()
{ {
......
...@@ -118,14 +118,28 @@ public class XEventLoop implements Runnable ...@@ -118,14 +118,28 @@ public class XEventLoop implements Runnable
* AWT event. * AWT event.
*/ */
AWTEvent createEvent() AWTEvent createEvent ()
{ {
int type = anyEvent.getType ();
// Ignore some events without further processing
switch (type)
{
// ignore "no expose" events, which are generated whenever a pixmap
// is copied to copied to a window which is entirely unobscured
case XAnyEvent.TYPE_NO_EXPOSE:
case XAnyEvent.TYPE_UNMAP_NOTIFY: // ignore for now
case XAnyEvent.TYPE_MAP_NOTIFY: // ignore for now
case XAnyEvent.TYPE_REPARENT_NOTIFY: // ignore for now
return null;
default:
break; // continue processing events not in ignore list
}
/* avoid attempting to get client data before client data has /* avoid attempting to get client data before client data has
been set. */ been set. */
Object peer; Object peer;
synchronized (this) synchronized (this)
{ {
peer = anyEvent.getWindow().getClientData(); peer = anyEvent.getWindow ().getClientData ();
} }
Component source = null; Component source = null;
...@@ -134,38 +148,33 @@ public class XEventLoop implements Runnable ...@@ -134,38 +148,33 @@ public class XEventLoop implements Runnable
if (peer instanceof XCanvasPeer) if (peer instanceof XCanvasPeer)
{ {
source = ((XCanvasPeer) peer).getComponent(); source = ((XCanvasPeer) peer).getComponent ();
} }
if (source == null) if (source == null)
{ {
String msg = "unable to locate source for event (" + String msg = "unable to locate source for event (" +
anyEvent + ")"; anyEvent + "): peer=" + peer;
throw new RuntimeException(msg); throw new RuntimeException (msg);
} }
/* if a mapping from anyEvent to AWTEvent is possible, construct a /* if a mapping from anyEvent to AWTEvent is possible, construct a
new AWTEvent and return it. */ new AWTEvent and return it. */
int type = anyEvent.getType();
switch (type) switch (type)
{ {
case XAnyEvent.TYPE_EXPOSE: case XAnyEvent.TYPE_EXPOSE:
return createPaintEvent(source); return createPaintEvent (source);
case XAnyEvent.TYPE_BUTTON_PRESS: case XAnyEvent.TYPE_BUTTON_PRESS:
case XAnyEvent.TYPE_BUTTON_RELEASE: case XAnyEvent.TYPE_BUTTON_RELEASE:
return createMouseEvent(type, source); return createMouseEvent (type, source);
case XAnyEvent.TYPE_UNMAP_NOTIFY:
case XAnyEvent.TYPE_MAP_NOTIFY:
case XAnyEvent.TYPE_REPARENT_NOTIFY:
return null; // ignore for now
case XAnyEvent.TYPE_CONFIGURE_NOTIFY: case XAnyEvent.TYPE_CONFIGURE_NOTIFY:
configureNotify(peer); configureNotify (peer);
return null; return null;
default: default:
String msg = "Do no know how to handle event (" + anyEvent + ")"; String msg = "Do no know how to handle event (" + anyEvent + ")";
throw new RuntimeException(msg); throw new RuntimeException (msg);
} }
} }
......
...@@ -20,6 +20,7 @@ import gnu.gcj.xlib.XImage; ...@@ -20,6 +20,7 @@ import gnu.gcj.xlib.XImage;
import gnu.gcj.xlib.Drawable; import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Window; import gnu.gcj.xlib.Window;
import gnu.gcj.xlib.Drawable; import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Pixmap;
import gnu.gcj.xlib.Visual; import gnu.gcj.xlib.Visual;
import gnu.awt.j2d.DirectRasterGraphics; import gnu.awt.j2d.DirectRasterGraphics;
import gnu.awt.j2d.MappedRaster; import gnu.awt.j2d.MappedRaster;
...@@ -199,6 +200,16 @@ public class XGraphics implements Cloneable, DirectRasterGraphics ...@@ -199,6 +200,16 @@ public class XGraphics implements Cloneable, DirectRasterGraphics
public boolean drawImage(Image img, int x, int y, public boolean drawImage(Image img, int x, int y,
ImageObserver observer) ImageObserver observer)
{ {
if (img instanceof XOffScreenImage)
{
// FIXME: have to enforce clip, or is it OK as-is?
XGraphicsConfiguration.XOffScreenImage offScreenImage
= ((XGraphicsConfiguration.XOffScreenImage)img);
Pixmap pixmap = offScreenImage.getPixmap ();
context.copyArea (pixmap, 0, 0, x, y,
offScreenImage.getWidth (), offScreenImage.getHeight ());
return true;
}
if (clipBounds == null) if (clipBounds == null)
return false; // ***FIXME*** return false; // ***FIXME***
......
/* Copyright (C) 2000, 2003 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.awt.xlib;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.util.Hashtable;
import gnu.awt.j2d.DirectRasterGraphics;
import gnu.awt.j2d.Graphics2DImpl;
import gnu.awt.j2d.IntegerGraphicsState;
import gnu.gcj.xlib.Drawable;
import gnu.gcj.xlib.Pixmap;
import gnu.gcj.xlib.Screen;
import gnu.gcj.xlib.Visual;
/** Image class for xlib off-screen buffers.
* The image is stored in a server-side pixmap for best performance.
* This class supports getGraphics, so you can draw on the pixmap, and is
* specially handled when doing drawImage, so that the image copy is done
* entirely in the X server.
* This class does not support rasterization, for which you'd need an XImage.
*
* @author scott gilbertson <scottg@mantatest.com> <sgilbertson@cogeco.ca>
*/
public class XOffScreenImage extends Image
implements IntegerGraphicsState.ScreenCoupledImage
{
private Pixmap pixmap;
private XGraphicsConfiguration config;
private int width;
private int height;
/** Create a new XOffScreenImage
* @param config Graphics configuration, to compare against on-screen
* components and to create the appropriate Graphics
* @param drawable The drawable with which the image is compatible
* @param width The width of the image
* @param height The height of the image
*/
XOffScreenImage (XGraphicsConfiguration config, Drawable drawable, int width, int height)
{
this.config = config;
this.width = width;
this.height = height;
pixmap = new Pixmap (drawable, width, height, drawable.getDepth ());
}
/** Get the pixmap which contains this image
* @return The pixmap
*/
public Pixmap getPixmap ()
{
return pixmap;
}
/** Flushes (that is, destroys) any resources used for this image. This
* includes the actual image data.
*/
public void flush ()
{
// FIXME: should dispose pixmap
pixmap = null;
}
/** Returns a graphics context object for drawing an off-screen object.
* This method is only valid for off-screen objects.
*
* @return a graphics context object for an off-screen object
* @see Graphics#createImage(int, int)
*/
public Graphics getGraphics ()
{
DirectRasterGraphics gfxDevice = new XGraphics (pixmap, config);
IntegerGraphicsState igState = new IntegerGraphicsState (gfxDevice);
Graphics2DImpl gfx2d = new Graphics2DImpl (config);
gfx2d.setState (igState);
return gfx2d;
}
/** Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when
* the value is known.
*
* @param observer the image observer for this object
* @return the height in pixels
* @see #getWidth(ImageObserver)
*/
public int getHeight (ImageObserver observer)
{
return height;
}
/** Returns the height of the image, or -1 if it is unknown. If the
* image height is unknown, the observer object will be notified when
* the value is known.
*
* @return the height in pixels
* @see #getWidth()
*/
public int getHeight ()
{
return height;
}
/** Returns the image producer object for this object. The producer is the
* object which generates pixels for this image.
*
* @return the image producer for this object
*/
public ImageProducer getSource ()
{
throw new UnsupportedOperationException ("getSource not supported");
}
/** Returns the width of the image, or -1 if it is unknown. If the
* image width is unknown, the observer object will be notified when
* the value is known.
*
* @param observer the image observer for this object
* @return the width in pixels
* @see #getHeight(ImageObserver)
*/
public int getWidth (ImageObserver observer)
{
return width;
}
/** Returns the width of the image, or -1 if it is unknown. If the
* image width is unknown, the observer object will be notified when
* the value is known.
*
* @return the width in pixels
* @see #getHeight()
*/
public int getWidth ()
{
return width;
}
/** This method requests a named property for an object. The value of the
* property is returned. The value <code>UndefinedProperty</code> is
* returned if there is no property with the specified name. The value
* <code>null</code> is returned if the properties for the object are
* not yet known. In this case, the specified image observer is notified
* when the properties are known.
*
* @param name the requested property name
* @param observer the image observer for this object
* @return the named property, if available
* @see #UndefinedProperty
*/
public Object getProperty (String name, ImageObserver observer)
{
return null;
}
/** Get the GraphicsConfiguration to which this image is coupled
* @return the GraphicsConfiguration
*/
public GraphicsConfiguration getGraphicsConfiguration ()
{
return config;
}
}
...@@ -79,6 +79,8 @@ public class Drawable extends XID ...@@ -79,6 +79,8 @@ public class Drawable extends XID
public native Rectangle getBounds(Rectangle rv); public native Rectangle getBounds(Rectangle rv);
public native int getDepth ();
private static final String MSG_XGETSUBIMAGE_FAILED = private static final String MSG_XGETSUBIMAGE_FAILED =
"XGetSubImage() failed."; "XGetSubImage() failed.";
......
...@@ -138,6 +138,11 @@ public class GC implements Cloneable ...@@ -138,6 +138,11 @@ public class GC implements Cloneable
int destX, int destY, int destX, int destY,
int width, int height); int width, int height);
public native void copyArea (Drawable source,
int srcX, int srcY,
int destX, int destY,
int width, int height);
public Drawable getDrawable() public Drawable getDrawable()
{ {
return target; return target;
......
...@@ -19,14 +19,40 @@ import gnu.gcj.RawData; ...@@ -19,14 +19,40 @@ import gnu.gcj.RawData;
public final class XAnyEvent public final class XAnyEvent
{ {
// Must match the definitions in X.h: // Must match the definitions in X.h:
public static final int TYPE_BUTTON_PRESS = 4, public static final int
TYPE_KEY_PRESS = 2,
TYPE_KEY_RELEASE = 3,
TYPE_BUTTON_PRESS = 4,
TYPE_BUTTON_RELEASE = 5, TYPE_BUTTON_RELEASE = 5,
TYPE_MOTION_NOTIFY = 6,
TYPE_ENTER_NOTIFY = 7,
TYPE_LEAVE_NOTIFY = 8,
TYPE_FOCUS_IN = 9,
TYPE_FOCUS_OUT = 10,
TYPE_KEYMAP_NOTIFY = 11,
TYPE_EXPOSE = 12, TYPE_EXPOSE = 12,
TYPE_GRAPHICS_EXPOSE = 13,
TYPE_NO_EXPOSE = 14,
TYPE_VISIBILITY_NOTIFY = 15,
TYPE_CREATE_NOTIFY = 16,
TYPE_DESTROY_NOTIFY = 17,
TYPE_UNMAP_NOTIFY = 18, TYPE_UNMAP_NOTIFY = 18,
TYPE_MAP_NOTIFY = 19, TYPE_MAP_NOTIFY = 19,
TYPE_MAP_REQUEST = 20,
TYPE_REPARENT_NOTIFY = 21, TYPE_REPARENT_NOTIFY = 21,
TYPE_CONFIGURE_NOTIFY = 22, TYPE_CONFIGURE_NOTIFY = 22,
TYPE_CLIENT_MESSAGE = 33; TYPE_CONFIGURE_REQUEST = 23,
TYPE_GRAVITY_NOTIFY = 24,
TYPE_RESIZE_REQUEST = 25,
TYPE_CIRCULATE_NOTIFY = 26,
TYPE_CIRCULATE_REQUEST = 27,
TYPE_PROPERTY_NOTIFY = 28,
TYPE_SELECTION_CLEAR = 29,
TYPE_SELECTION_REQUEST = 30,
TYPE_SELECTION_NOTIFY = 31,
TYPE_COLORMAP_NOTIFY = 32,
TYPE_CLIENT_MESSAGE = 33,
TYPE_MAPPING_NOTIFY = 34;
// Must match the definitions in X.h: // Must match the definitions in X.h:
public final static long MASK_SUBSTRUCTURE_NOTIFY = 1L<<19, public final static long MASK_SUBSTRUCTURE_NOTIFY = 1L<<19,
......
...@@ -43,6 +43,26 @@ jboolean gnu::gcj::xlib::Drawable::copyIntoXImageImpl(XImage* image, ...@@ -43,6 +43,26 @@ jboolean gnu::gcj::xlib::Drawable::copyIntoXImageImpl(XImage* image,
return true; return true;
} }
jint gnu::gcj::xlib::Drawable::getDepth ()
{
::Display* dpy = (::Display*) (getDisplay ()->display);
::Window root;
int x, y;
unsigned int w, h, bw, depth;
Status status = XGetGeometry (dpy, getXID(), &root,
&x, &y, &w, &h,
&bw, &depth);
switch (status)
{
case BadDrawable:
throw new XException (display, status);
default:
; // All OK, NOP.
}
return (jint)depth;
}
java::awt::Rectangle* java::awt::Rectangle*
gnu::gcj::xlib::Drawable::getBounds(java::awt::Rectangle* rv) gnu::gcj::xlib::Drawable::getBounds(java::awt::Rectangle* rv)
{ {
......
...@@ -237,3 +237,18 @@ void gnu::gcj::xlib::GC::updateClip() ...@@ -237,3 +237,18 @@ void gnu::gcj::xlib::GC::updateClip()
ordering); ordering);
// no fast fail // no fast fail
} }
void gnu::gcj::xlib::GC::copyArea (gnu::gcj::xlib::Drawable * source,
jint srcX, jint srcY,
jint destX, jint destY,
jint width, jint height)
{
Display* display = target->getDisplay ();
::Display* dpy = (::Display*) (display->display);
::Drawable drawableXID = target->getXID ();
::GC gc = (::GC) structure;
::Drawable srcXID = source->getXID ();
XCopyArea (dpy, srcXID, drawableXID, gc, srcX, srcY, width, height,
destX, destY);
}
...@@ -1866,12 +1866,17 @@ public abstract class Component ...@@ -1866,12 +1866,17 @@ public abstract class Component
* @param height the height of the image * @param height the height of the image
* @return the requested image, or null if it is not supported * @return the requested image, or null if it is not supported
*/ */
public Image createImage(int width, int height) public Image createImage (int width, int height)
{ {
if (GraphicsEnvironment.isHeadless()) Image returnValue = null;
return null; if (!GraphicsEnvironment.isHeadless ())
GraphicsConfiguration config = getGraphicsConfiguration(); {
return config == null ? null : config.createCompatibleImage(width, height); if (isLightweight () && parent != null)
returnValue = parent.createImage (width, height);
else if (peer != null)
returnValue = peer.createImage (width, height);
}
return returnValue;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment