1 /* Copyright (C) 2000, 2003 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 import gnu
.gcj
.RawData
;
12 import java
.awt
.Rectangle
;
15 * An X11 graphics context. Unlike a traditional X11 graphics
16 * context, the target drawable is part of the GC state.
18 * Implementation notes: There is no need to do coalescing of changes
19 * since Xlib will do this for us. The implementation relies on the
20 * Xlib GC cache and will not try to be clever.
22 * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
24 public class GC
implements Cloneable
27 public GC(Drawable target
)
35 GC gcClone
= (GC
) super.clone();
36 gcClone
.structure
= null;
37 gcClone
.initStructure(this);
42 private native void initStructure(GC copyFrom
);
49 public void finalize()
59 public synchronized native void disposeImpl();
61 public native void setForeground(long pixel
);
62 public native void setFont(gnu
.gcj
.xlib
.Font font
);
65 * Set the clip region for the graphics operations performed by the
68 * This is one of the few costly operations of this class. It is
69 * suggested that the clip is only set or changed if really
70 * necessary. Higher level APIs can make such optimizations
73 * @param rectangles the union of these rectangles describe the clip
76 public void setClipRectangles(Rectangle
[] rectangles
)
78 clip
= new Clip(rectangles
);
82 public native void drawString(String text
, int x
, int y
);
83 public native void drawLine(int x1
, int y1
, int x2
, int y2
);
84 public native void drawRectangle(int x
, int y
, int w
, int h
);
86 public native void fillRectangle(int x
, int y
, int w
, int h
);
87 public native void fillPolygon(int[] xPoints
, int[] yPoints
, int nPoints
,
88 int translateX
, int translateY
);
92 * Clear area using the background pixel or pixmap of the drawable.
93 * Note that this operation does not adhere to the current clip.
95 public native void clearArea(int x
, int y
, int w
, int h
,
99 public native void putImage(XImage image
,
101 int destX
, int destY
,
102 int width
, int height
);
104 public Drawable
getDrawable()
109 private native void updateClip();
111 private Drawable target
;
112 private RawData structure
;