gcc/libjava/gnu/gcj/xlib/GC.java

114 lines
2.6 KiB
Java
Raw Normal View History

Makefile.am: Added rules for libgcjx library. * Makefile.am: Added rules for libgcjx library. * Makefile.in: Rebuilt. * configure.in: Added check for X. * configure: Rebuilt. * gnu/awt/LightweightRedirector.java: New file. * gnu/awt/j2d/AbstractGraphicsState.java: New file. * gnu/awt/j2d/DirectRasterGraphics.java: New file. * gnu/awt/j2d/Graphics2DImpl.java: New file. * gnu/awt/j2d/IntegerGraphicsState.java: New file. * gnu/awt/j2d/MappedRaster.java: New file. * gnu/awt/xlib/XCanvasPeer.java: New file. * gnu/awt/xlib/XEventLoop.java: New file. * gnu/awt/xlib/XEventQueue.java: New file. * gnu/awt/xlib/XFontMetrics.java: New file. * gnu/awt/xlib/XFramePeer.java: New file. * gnu/awt/xlib/XGraphics.java: New file. * gnu/awt/xlib/XGraphicsConfiguration.java: New file. * gnu/awt/xlib/XPanelPeer.java: New file. * gnu/awt/xlib/XToolkit.java: New file. * gnu/gcj/xlib/Clip.java: New file. * gnu/gcj/xlib/Colormap.java: New file. * gnu/gcj/xlib/Display.java: New file. * gnu/gcj/xlib/Drawable.java: New file. * gnu/gcj/xlib/Font.java: New file. * gnu/gcj/xlib/GC.java: New file. * gnu/gcj/xlib/Pixmap.java: New file. * gnu/gcj/xlib/Screen.java: New file. * gnu/gcj/xlib/Visual.java: New file. * gnu/gcj/xlib/WMSizeHints.java: New file. * gnu/gcj/xlib/Window.java: New file. * gnu/gcj/xlib/WindowAttributes.java: New file. * gnu/gcj/xlib/XAnyEvent.java: New file. * gnu/gcj/xlib/XButtonEvent.java: New file. * gnu/gcj/xlib/XColor.java: New file. * gnu/gcj/xlib/XConfigureEvent.java: New file. * gnu/gcj/xlib/XConnectException.java: New file. * gnu/gcj/xlib/XEvent.java: New file. * gnu/gcj/xlib/XException.java: New file. * gnu/gcj/xlib/XExposeEvent.java: New file. * gnu/gcj/xlib/XID.java: New file. * gnu/gcj/xlib/XImage.java: New file. * gnu/gcj/xlib/XUnmapEvent.java: New file. * gnu/gcj/xlib/natClip.cc: New file. * gnu/gcj/xlib/natColormap.cc: New file. * gnu/gcj/xlib/natDisplay.cc: New file. * gnu/gcj/xlib/natDrawable.cc: New file. * gnu/gcj/xlib/natFont.cc: New file. * gnu/gcj/xlib/natGC.cc: New file. * gnu/gcj/xlib/natPixmap.cc: New file. * gnu/gcj/xlib/natScreen.cc: New file. * gnu/gcj/xlib/natVisual.cc: New file. * gnu/gcj/xlib/natWMSizeHints.cc: New file. * gnu/gcj/xlib/natWindow.cc: New file. * gnu/gcj/xlib/natWindowAttributes.cc: New file. * gnu/gcj/xlib/natXAnyEvent.cc: New file. * gnu/gcj/xlib/natXButtonEvent.cc: New file. * gnu/gcj/xlib/natXColor.cc: New file. * gnu/gcj/xlib/natXConfigureEvent.cc: New file. * gnu/gcj/xlib/natXException.cc: New file. * gnu/gcj/xlib/natXExposeEvent.cc: New file. * gnu/gcj/xlib/natXImage.cc: New file. * gnu/gcj/xlib/natXUnmapEvent.cc: New file. * java/awt/EventDispatchThread.java: Start thead on creation. From-SVN: r37005
2000-10-23 01:46:09 +08:00
/* Copyright (C) 2000 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.gcj.xlib;
import gnu.gcj.RawData;
import java.awt.Rectangle;
/**
* An X11 graphics context. Unlike a traditional X11 graphics
* context, the target drawable is part of the GC state.
*
* Implementation notes: There is no need to do coalescing of changes
* since Xlib will do this for us. The implementation relies on the
* Xlib GC cache and will not try to be clever.
*
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
public class GC implements Cloneable
{
public GC(Drawable target)
{
this.target = target;
initStructure(null);
}
public Object clone()
{
GC gcClone = (GC) super.clone();
gcClone.structure = null;
gcClone.initStructure(this);
gcClone.updateClip();
return gcClone;
}
private native void initStructure(GC copyFrom);
public GC create()
{
return (GC) clone();
}
public void finalize()
{
disposeImpl();
}
public void dispose()
{
disposeImpl();
}
public synchronized native void disposeImpl();
public native void setForeground(long pixel);
public native void setFont(gnu.gcj.xlib.Font font);
/**
* Set the clip region for the graphics operations performed by the
* GC.
*
* This is one of the few costly operations of this class. It is
* suggested that the clip is only set or changed if really
* necessary. Higher level APIs can make such optimizations
* transparent.
*
* @param rectangles the union of these rectangles describe the clip
* region.
*/
public void setClipRectangles(Rectangle[] rectangles)
{
clip = new Clip(rectangles);
updateClip();
}
public native void drawString(String text, int x, int y);
public native void drawLine(int x1, int y1, int x2, int y2);
public native void drawRectangle(int x, int y, int w, int h);
public native void fillRectangle(int x, int y, int w, int h);
/**
*
* Clear area using the background pixel or pixmap of the drawable.
* Note that this operation does not adhere to the current clip.
*/
public native void clearArea(int x, int y, int w, int h,
boolean exposures);
public native void putImage(XImage image,
int srcX, int srcY,
int destX, int destY,
int width, int height);
public Drawable getDrawable()
{
return target;
}
private native void updateClip();
private Drawable target;
private RawData structure;
private Clip clip;
}