126 |
native public void dispose (); |
native public void dispose (); |
127 |
|
|
128 |
native void copyPixmap (Graphics g, int x, int y, int width, int height); |
native void copyPixmap (Graphics g, int x, int y, int width, int height); |
129 |
|
native void copyAndScalePixmap (Graphics g, boolean flip_x, boolean flip_y, |
130 |
|
int src_x, int src_y, |
131 |
|
int src_width, int src_height, |
132 |
|
int dest_x, int dest_y, |
133 |
|
int dest_width, int dest_height); |
134 |
public boolean drawImage (Image img, int x, int y, |
public boolean drawImage (Image img, int x, int y, |
135 |
Color bgcolor, ImageObserver observer) |
Color bgcolor, ImageObserver observer) |
136 |
{ |
{ |
166 |
{ |
{ |
167 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
168 |
{ |
{ |
169 |
throw new RuntimeException (); |
copyAndScalePixmap (img.getGraphics (), false, false, |
170 |
|
0, 0, img.getWidth (null), img.getHeight (null), |
171 |
|
x, y, width, height); |
172 |
|
return true; |
173 |
} |
} |
174 |
|
|
175 |
GtkImage image = (GtkImage) img; |
GtkImage image = (GtkImage) img; |
194 |
{ |
{ |
195 |
if (img instanceof GtkOffScreenImage) |
if (img instanceof GtkOffScreenImage) |
196 |
{ |
{ |
197 |
throw new RuntimeException (); |
int dx_start, dy_start, d_width, d_height; |
198 |
|
int sx_start, sy_start, s_width, s_height; |
199 |
|
boolean x_flip = false; |
200 |
|
boolean y_flip = false; |
201 |
|
|
202 |
|
if (dx1 < dx2) |
203 |
|
{ |
204 |
|
dx_start = dx1; |
205 |
|
d_width = dx2 - dx1; |
206 |
|
} |
207 |
|
else |
208 |
|
{ |
209 |
|
dx_start = dx2; |
210 |
|
d_width = dx1 - dx2; |
211 |
|
x_flip ^= true; |
212 |
|
} |
213 |
|
if (dy1 < dy2) |
214 |
|
{ |
215 |
|
dy_start = dy1; |
216 |
|
d_height = dy2 - dy1; |
217 |
|
} |
218 |
|
else |
219 |
|
{ |
220 |
|
dy_start = dy2; |
221 |
|
d_height = dy1 - dy2; |
222 |
|
y_flip ^= true; |
223 |
|
} |
224 |
|
if (sx1 < sx2) |
225 |
|
{ |
226 |
|
sx_start = sx1; |
227 |
|
s_width = sx2 - sx1; |
228 |
|
} |
229 |
|
else |
230 |
|
{ |
231 |
|
sx_start = sx2; |
232 |
|
s_width = sx1 - sx2; |
233 |
|
x_flip ^= true; |
234 |
|
} |
235 |
|
if (sy1 < sy2) |
236 |
|
{ |
237 |
|
sy_start = sy1; |
238 |
|
s_height = sy2 - sy1; |
239 |
|
} |
240 |
|
else |
241 |
|
{ |
242 |
|
sy_start = sy2; |
243 |
|
s_height = sy1 - sy2; |
244 |
|
y_flip ^= true; |
245 |
|
} |
246 |
|
|
247 |
|
copyAndScalePixmap (img.getGraphics (), x_flip, y_flip, |
248 |
|
sx_start, sy_start, s_width, s_height, |
249 |
|
dx_start, dy_start, d_width, d_height); |
250 |
|
return true; |
251 |
} |
} |
252 |
|
|
253 |
GtkImage image = (GtkImage) img; |
GtkImage image = (GtkImage) img; |