90 |
GdkGraphics (GtkComponentPeer component) |
GdkGraphics (GtkComponentPeer component) |
91 |
{ |
{ |
92 |
this.component = component; |
this.component = component; |
93 |
|
font = component.awtComponent.getFont (); |
94 |
|
|
95 |
|
if (component.isRealized ()) |
96 |
|
initComponentGraphics (); |
97 |
|
else |
98 |
|
connectSignals (component); |
99 |
|
} |
100 |
|
|
101 |
|
void initComponentGraphics () |
102 |
|
{ |
103 |
initState (component); |
initState (component); |
104 |
color = component.awtComponent.getForeground (); |
color = component.awtComponent.getForeground (); |
|
font = component.awtComponent.getFont (); |
|
105 |
Dimension d = component.awtComponent.getSize (); |
Dimension d = component.awtComponent.getSize (); |
106 |
clip = new Rectangle (0, 0, d.width, d.height); |
clip = new Rectangle (0, 0, d.width, d.height); |
107 |
} |
} |
108 |
|
|
109 |
|
native void connectSignals (GtkComponentPeer component); |
110 |
|
|
111 |
public native void clearRect (int x, int y, int width, int height); |
public native void clearRect (int x, int y, int width, int height); |
112 |
|
|
113 |
public void clipRect (int x, int y, int width, int height) |
public void clipRect (int x, int y, int width, int height) |
114 |
{ |
{ |
115 |
|
if (component != null && ! component.isRealized ()) |
116 |
|
return; |
117 |
|
|
118 |
clip = clip.intersection (new Rectangle (x, y, width, height)); |
clip = clip.intersection (new Rectangle (x, y, width, height)); |
119 |
setClipRectangle (clip.x, clip.y, clip.width, clip.height); |
setClipRectangle (clip.x, clip.y, clip.width, clip.height); |
120 |
} |
} |
147 |
public boolean drawImage (Image img, int x, int y, |
public boolean drawImage (Image img, int x, int y, |
148 |
Color bgcolor, ImageObserver observer) |
Color bgcolor, ImageObserver observer) |
149 |
{ |
{ |
150 |
|
if (component != null && ! component.isRealized ()) |
151 |
|
return false; |
152 |
|
|
153 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
154 |
{ |
{ |
155 |
copyPixmap (img.getGraphics (), |
copyPixmap (img.getGraphics (), |
164 |
|
|
165 |
public boolean drawImage (Image img, int x, int y, ImageObserver observer) |
public boolean drawImage (Image img, int x, int y, ImageObserver observer) |
166 |
{ |
{ |
167 |
|
if (component != null && ! component.isRealized ()) |
168 |
|
return false; |
169 |
|
|
170 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
171 |
{ |
{ |
172 |
copyPixmap (img.getGraphics (), |
copyPixmap (img.getGraphics (), |
183 |
public boolean drawImage (Image img, int x, int y, int width, int height, |
public boolean drawImage (Image img, int x, int y, int width, int height, |
184 |
Color bgcolor, ImageObserver observer) |
Color bgcolor, ImageObserver observer) |
185 |
{ |
{ |
186 |
|
if (component != null && ! component.isRealized ()) |
187 |
|
return false; |
188 |
|
|
189 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
190 |
{ |
{ |
191 |
copyAndScalePixmap (img.getGraphics (), false, false, |
copyAndScalePixmap (img.getGraphics (), false, false, |
202 |
public boolean drawImage (Image img, int x, int y, int width, int height, |
public boolean drawImage (Image img, int x, int y, int width, int height, |
203 |
ImageObserver observer) |
ImageObserver observer) |
204 |
{ |
{ |
205 |
|
if (component != null && ! component.isRealized ()) |
206 |
|
return false; |
207 |
|
|
208 |
if (component != null) |
if (component != null) |
209 |
return drawImage (img, x, y, width, height, component.getBackground (), |
return drawImage (img, x, y, width, height, component.getBackground (), |
210 |
observer); |
observer); |
217 |
int sx1, int sy1, int sx2, int sy2, |
int sx1, int sy1, int sx2, int sy2, |
218 |
Color bgcolor, ImageObserver observer) |
Color bgcolor, ImageObserver observer) |
219 |
{ |
{ |
220 |
|
if (component != null && ! component.isRealized ()) |
221 |
|
return false; |
222 |
|
|
223 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
224 |
{ |
{ |
225 |
int dx_start, dy_start, d_width, d_height; |
int dx_start, dy_start, d_width, d_height; |
288 |
int sx1, int sy1, int sx2, int sy2, |
int sx1, int sy1, int sx2, int sy2, |
289 |
ImageObserver observer) |
ImageObserver observer) |
290 |
{ |
{ |
291 |
|
if (component != null && ! component.isRealized ()) |
292 |
|
return false; |
293 |
|
|
294 |
if (component != null) |
if (component != null) |
295 |
return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, |
return drawImage (img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, |
296 |
component.getBackground (), observer); |
component.getBackground (), observer); |
409 |
|
|
410 |
public void setClip (int x, int y, int width, int height) |
public void setClip (int x, int y, int width, int height) |
411 |
{ |
{ |
412 |
|
if (component != null && ! component.isRealized ()) |
413 |
|
return; |
414 |
|
|
415 |
clip.x = x; |
clip.x = x; |
416 |
clip.y = y; |
clip.y = y; |
417 |
clip.width = width; |
clip.width = width; |
476 |
|
|
477 |
public void translate (int x, int y) |
public void translate (int x, int y) |
478 |
{ |
{ |
479 |
|
if (component != null && ! component.isRealized ()) |
480 |
|
return; |
481 |
|
|
482 |
clip.x -= x; |
clip.x -= x; |
483 |
clip.y -= y; |
clip.y -= y; |
484 |
|
|