Showing the changes to java/pkg/awt/iGraphics.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,606 @@ | ||
| 1 | +package inferno.awt; | |
| 2 | + | |
| 3 | +import java.awt.*; | |
| 4 | +import java.awt.peer.*; | |
| 5 | +import java.io.*; | |
| 6 | +import java.util.*; | |
| 7 | +import java.awt.image.ImageObserver; | |
| 8 | +import inferno.awt.iFontPeer; | |
| 9 | + | |
| 10 | +//import sun.awt.image.OffScreenImageSource; | |
| 11 | +//import sun.awt.image.ImageRepresentation; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * iGraphics is an object that encapsulates a graphics context for a | |
| 15 | + * particular canvas. | |
| 16 | + * | |
| 17 | + * @version 1.18 18 Mar 1996 | |
| 18 | + */ | |
| 19 | + | |
| 20 | +public class iGraphics extends Graphics { | |
| 21 | + // Object pcanvas; | |
| 22 | + Object refImage; | |
| 23 | + Object refOffScreenImage; | |
| 24 | + Component target; | |
| 25 | + Color foreground; | |
| 26 | + Font font; | |
| 27 | + private iFontPeer ifontpeer; | |
| 28 | + int originX; | |
| 29 | + int originY; | |
| 30 | + Rectangle clipRect; | |
| 31 | + Rectangle initialClipRect; | |
| 32 | + boolean dirty; | |
| 33 | + | |
| 34 | + //private native void imageCreate(ImageRepresentation ir); | |
| 35 | + private native void pSetForeground(int r, int g, int b); | |
| 36 | + | |
| 37 | + private Image image; | |
| 38 | + | |
| 39 | + private Object awt; // Pointer to awt object | |
| 40 | + | |
| 41 | + private native void createGraphics(); | |
| 42 | + | |
| 43 | + public iGraphics(Object refImage, Object refOffScreenImage, Rectangle initialClipRect, Component target) | |
| 44 | + { | |
| 45 | + this.refImage = refImage; | |
| 46 | + this.refOffScreenImage = refOffScreenImage; | |
| 47 | + this.initialClipRect = new Rectangle(initialClipRect); | |
| 48 | + this.clipRect = new Rectangle(initialClipRect); | |
| 49 | + this.target = target; | |
| 50 | + this.font = target.getFont(); | |
| 51 | + if (font != null) { | |
| 52 | + this.ifontpeer = (iFontPeer)font.getPeer(); | |
| 53 | + } | |
| 54 | + dirty = false; | |
| 55 | + createGraphics(); | |
| 56 | + } | |
| 57 | + | |
| 58 | +// a dummy constructor for testing | |
| 59 | + public iGraphics(Object im) { | |
| 60 | + } | |
| 61 | + | |
| 62 | + | |
| 63 | + public iGraphics(Image image) { | |
| 64 | + } | |
| 65 | + | |
| 66 | + /** | |
| 67 | + * Create a new iGraphics Object based on this one. | |
| 68 | + */ | |
| 69 | + public Graphics create() { | |
| 70 | + iGraphics g = new iGraphics(refImage, refOffScreenImage, initialClipRect, target); | |
| 71 | + g.foreground = foreground; | |
| 72 | + g.font = font; | |
| 73 | + g.ifontpeer = ifontpeer; | |
| 74 | + g.originX = originX; | |
| 75 | + g.originY = originY; | |
| 76 | + g.image = image; | |
| 77 | + //g.clipRect = clipRect; | |
| 78 | + //g.initialClipRect = initialClipRect; | |
| 79 | + return g; | |
| 80 | + } | |
| 81 | + | |
| 82 | + private void checkDirty() | |
| 83 | + { | |
| 84 | + if (dirty) | |
| 85 | + { | |
| 86 | + dirty = false; | |
| 87 | + copyOffscreenImage(clipRect.x,clipRect.y,clipRect.width,clipRect.height); | |
| 88 | + } | |
| 89 | + | |
| 90 | + } | |
| 91 | + | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Translate | |
| 95 | + */ | |
| 96 | + public void translate(int x, int y) { | |
| 97 | + originX += x; | |
| 98 | + originY += y; | |
| 99 | + clipRect.translate(-x,-y); | |
| 100 | + initialClipRect.translate(-x,-y); | |
| 101 | + } | |
| 102 | + | |
| 103 | + /** | |
| 104 | + * Disposes of this iGraphics context. It cannot be used after being | |
| 105 | + * disposed. | |
| 106 | + */ | |
| 107 | + private native void pDispose(); | |
| 108 | + | |
| 109 | + public void dispose() | |
| 110 | + { | |
| 111 | + checkDirty(); | |
| 112 | + pDispose(); | |
| 113 | + } | |
| 114 | + | |
| 115 | + public void setFont(Font font) { | |
| 116 | + if ((font != null) && (this.font != font)) { | |
| 117 | + synchronized (this.font) { | |
| 118 | + this.font = font; | |
| 119 | + ifontpeer = (iFontPeer)font.getPeer(); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + } | |
| 123 | + public Font getFont() { | |
| 124 | + return this.font; | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * Gets font metrics for the given font. | |
| 129 | + */ | |
| 130 | + public FontMetrics getFontMetrics(Font font) { | |
| 131 | + return iFontMetrics.getFontMetrics(font); | |
| 132 | + } | |
| 133 | + | |
| 134 | + | |
| 135 | + private void ourSetForeground() | |
| 136 | + { | |
| 137 | + pSetForeground(foreground.getRed(), foreground.getGreen(), foreground.getBlue()); | |
| 138 | + } | |
| 139 | + | |
| 140 | + /** | |
| 141 | + * Sets the foreground color. | |
| 142 | + */ | |
| 143 | + public void setColor(Color c) { | |
| 144 | + if ((c != null) && (c != foreground)) { | |
| 145 | + foreground = c; | |
| 146 | + pSetForeground(c.getRed(), c.getGreen(), c.getBlue()); | |
| 147 | + } | |
| 148 | + } | |
| 149 | + public Color getColor() { | |
| 150 | + return foreground; | |
| 151 | + } | |
| 152 | + | |
| 153 | + | |
| 154 | + /** | |
| 155 | + * Sets the paint mode to overwrite the destination with the | |
| 156 | + * current color. This is the default paint mode. | |
| 157 | + */ | |
| 158 | + public native void setPaintMode(); | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Sets the paint mode to alternate between the current color | |
| 162 | + * and the given color. | |
| 163 | + */ | |
| 164 | + public native void setXORMode(Color c1); | |
| 165 | + | |
| 166 | + /** | |
| 167 | + * Gets the current clipping area | |
| 168 | + */ | |
| 169 | + public Rectangle getClipBounds() | |
| 170 | + { | |
| 171 | + return new Rectangle(clipRect); | |
| 172 | + } | |
| 173 | + | |
| 174 | + private native void changeClip(int X, int Y, int W, int H, boolean set); | |
| 175 | + | |
| 176 | + private void removeClip() | |
| 177 | + { | |
| 178 | + checkDirty(); | |
| 179 | + clipRect = new Rectangle(initialClipRect); | |
| 180 | + } | |
| 181 | + | |
| 182 | + private void ourSetClip() | |
| 183 | + { | |
| 184 | + dirty = true; | |
| 185 | + changeClip(clipRect.x,clipRect.y,clipRect.width,clipRect.height,true); | |
| 186 | + } | |
| 187 | + | |
| 188 | + /** Crops the clipping rectangle for this iGraphics context. */ | |
| 189 | + public void clipRect(int X, int Y, int W, int H) { | |
| 190 | + checkDirty(); | |
| 191 | + clipRect = clipRect.intersection(new Rectangle(X,Y,W,H)); // test lg | |
| 192 | + // System.out.println("java == intersection: "+ clipRect); | |
| 193 | + //changeClip(X, Y, W, H, false); | |
| 194 | + } | |
| 195 | + | |
| 196 | + /** Sets the clipping rectangle for this iGraphics context. */ | |
| 197 | + public void setClip(int X, int Y, int W, int H) { | |
| 198 | + checkDirty(); | |
| 199 | + clipRect = new Rectangle(X,Y,W,H); | |
| 200 | + //changeClip(X, Y, W, H, true); | |
| 201 | + } | |
| 202 | + | |
| 203 | + /** Returns a Shape object representing the clip. */ | |
| 204 | + public Shape getClip() { | |
| 205 | + return getClipBounds(); | |
| 206 | + } | |
| 207 | + | |
| 208 | + /** Sets the clip to a Shape (only Rectangle allowed). */ | |
| 209 | + public void setClip(Shape clip) { | |
| 210 | + if (clip == null) { | |
| 211 | + removeClip(); | |
| 212 | + } else if (clip instanceof Rectangle) { | |
| 213 | + Rectangle r = (Rectangle) clip; | |
| 214 | + checkDirty(); | |
| 215 | + clipRect = new Rectangle(r); | |
| 216 | + //changeClip(r.x, r.y, r.width, r.height, true); | |
| 217 | + } else { | |
| 218 | + throw new IllegalArgumentException("setClip(Shape) only supports Rectangle objects"); | |
| 219 | + } | |
| 220 | + } | |
| 221 | + | |
| 222 | + /** Clears the rectangle indicated by x,y,w,h. */ | |
| 223 | + private native void pClearRect(int x, int y, int w, int h); | |
| 224 | + | |
| 225 | + public void clearRect(int x, int y, int w, int h) | |
| 226 | + { | |
| 227 | + ourSetClip(); | |
| 228 | + pClearRect(x,y,w,h); | |
| 229 | + } | |
| 230 | + | |
| 231 | + /** Fills the given rectangle with the foreground color. */ | |
| 232 | + private native void pFillRect(int X, int Y, int W, int H); | |
| 233 | + | |
| 234 | + public void fillRect(int X, int Y, int W, int H) | |
| 235 | + { | |
| 236 | + ourSetClip(); | |
| 237 | + pFillRect(X,Y,W,H); | |
| 238 | + } | |
| 239 | + | |
| 240 | + /** Draws the given rectangle. */ | |
| 241 | + private native void pDrawRect(int X, int Y, int W, int H); | |
| 242 | + | |
| 243 | + public void drawRect(int X, int Y, int W, int H) | |
| 244 | + { | |
| 245 | + ourSetClip(); | |
| 246 | + pDrawRect(X,Y,W,H); | |
| 247 | + } | |
| 248 | + | |
| 249 | + | |
| 250 | + /** Draws the given string. */ | |
| 251 | + public void drawString(String str, int x, int y) { | |
| 252 | + drawStringWidth(str, x, y); | |
| 253 | + } | |
| 254 | + | |
| 255 | + /** Draws the given character array. */ | |
| 256 | + public void drawChars(char data[], int offset, int length, int x, int y) { | |
| 257 | + String str = new String(data, offset, length); | |
| 258 | + drawStringWidth(str, x, y); | |
| 259 | + // drawCharsWidth(data, offset, length, x, y); | |
| 260 | + } | |
| 261 | + | |
| 262 | + /** Draws the given byte array. */ | |
| 263 | + public void drawBytes(byte data[], int offset, int length, int x, int y) { | |
| 264 | + String str = new String(data, offset, length); | |
| 265 | + drawStringWidth(str, x, y); | |
| 266 | + // drawBytesWidth(data, offset, length, x, y); | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** Draws the given string and returns the length of the drawn | |
| 270 | + string in pixels. If font is not set then returns -1. */ | |
| 271 | + private native int pDrawStringWidth(String str, int x, int y); | |
| 272 | + | |
| 273 | + private int drawStringWidth(String str, int x, int y) | |
| 274 | + { | |
| 275 | + int r; | |
| 276 | + ourSetClip(); | |
| 277 | + if (ifontpeer == null) { | |
| 278 | + return 0; | |
| 279 | + } | |
| 280 | + r = pDrawStringWidth(str, x, y - ifontpeer.iAscent - ifontpeer.fLeading); | |
| 281 | + // System.out.println("Length of string "+r); | |
| 282 | + return r; | |
| 283 | + } | |
| 284 | + | |
| 285 | + /** Draws the given character array and return the width in | |
| 286 | + pixels. If font is not set then returns -1. */ | |
| 287 | +// public native int drawCharsWidth(char data[], int offset, int length, | |
| 288 | +// int x, int y); | |
| 289 | + | |
| 290 | + /** Draws the given character array and return the width in | |
| 291 | + pixels. If font is not set then returns -1. */ | |
| 292 | +// public native int drawBytesWidth(byte data[], int offset, int length, | |
| 293 | +// int x, int y); | |
| 294 | + | |
| 295 | + /** Draws the given line. */ | |
| 296 | + private native void pDrawLine(int x1, int y1, int x2, int y2); | |
| 297 | + | |
| 298 | + public void drawLine(int x1, int y1, int x2, int y2) { | |
| 299 | + ourSetClip(); | |
| 300 | + pDrawLine(x1, y1, x2, y2); | |
| 301 | + } | |
| 302 | + | |
| 303 | + /** | |
| 304 | + * Draws an image at x,y in nonblocking mode with a callback object. | |
| 305 | + */ | |
| 306 | + public boolean drawImage(Image img, int x, int y, ImageObserver observer) { | |
| 307 | + // We need to get the bits. | |
| 308 | + if ( img == null ) | |
| 309 | + return false; | |
| 310 | + java.awt.image.ImageProducer ip = img.getSource(); | |
| 311 | + java.awt.image.ImageConsumer ic = new iImageConsumer(this, img, x, y); | |
| 312 | + ip.startProduction(ic); | |
| 313 | + ip.removeConsumer(ic); | |
| 314 | + /*WImage wImg = (WImage) img; | |
| 315 | + if (wImg.hasError()) { | |
| 316 | + if (observer != null) { | |
| 317 | + observer.imageUpdate(img, | |
| 318 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 319 | + -1, -1, -1, -1); | |
| 320 | + } | |
| 321 | + return false; | |
| 322 | + } | |
| 323 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 324 | + return ir.drawImage(this, x, y, null, observer); | |
| 325 | + */ | |
| 326 | + return false; | |
| 327 | + } | |
| 328 | + | |
| 329 | + /** | |
| 330 | + * Draws an image scaled to x,y,w,h in nonblocking mode with a | |
| 331 | + * callback object. | |
| 332 | + */ | |
| 333 | + public boolean drawImage(Image img, int x, int y, int width, int height, | |
| 334 | + ImageObserver observer) { | |
| 335 | + /*if (width == 0 || height == 0) { | |
| 336 | + return true; | |
| 337 | + } | |
| 338 | + WImage wImg = (WImage) img; | |
| 339 | + if (wImg.hasError()) { | |
| 340 | + if (observer != null) { | |
| 341 | + observer.imageUpdate(img, | |
| 342 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 343 | + -1, -1, -1, -1); | |
| 344 | + } | |
| 345 | + return false; | |
| 346 | + } | |
| 347 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 348 | + return ir.drawScaledImage(this, x, y, width, height, null, observer); | |
| 349 | + */ | |
| 350 | + return false; | |
| 351 | + } | |
| 352 | + | |
| 353 | + /** | |
| 354 | + * Draws an image at x,y in nonblocking mode with a solid background | |
| 355 | + * color and a callback object. | |
| 356 | + */ | |
| 357 | + public boolean drawImage(Image img, int x, int y, Color bg, | |
| 358 | + ImageObserver observer) { | |
| 359 | + /*WImage wImg = (WImage) img; | |
| 360 | + if (wImg.hasError()) { | |
| 361 | + if (observer != null) { | |
| 362 | + observer.imageUpdate(img, | |
| 363 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 364 | + -1, -1, -1, -1); | |
| 365 | + } | |
| 366 | + return false; | |
| 367 | + } | |
| 368 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 369 | + return ir.drawImage(this, x, y, bg, observer); | |
| 370 | + */ | |
| 371 | + return false; | |
| 372 | + } | |
| 373 | + | |
| 374 | + /** | |
| 375 | + * Draws an image scaled to x,y,w,h in nonblocking mode with a | |
| 376 | + * solid background color and a callback object. | |
| 377 | + */ | |
| 378 | + public boolean drawImage(Image img, int x, int y, int width, int height, | |
| 379 | + Color bg, ImageObserver observer) { | |
| 380 | + /*if (width == 0 || height == 0) { | |
| 381 | + return true; | |
| 382 | + } | |
| 383 | + WImage wImg = (WImage) img; | |
| 384 | + if (wImg.hasError()) { | |
| 385 | + if (observer != null) { | |
| 386 | + observer.imageUpdate(img, | |
| 387 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 388 | + -1, -1, -1, -1); | |
| 389 | + } | |
| 390 | + return false; | |
| 391 | + } | |
| 392 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 393 | + return ir.drawScaledImage(this, x, y, width, height, bg, observer); | |
| 394 | + */ | |
| 395 | + return false; | |
| 396 | + } | |
| 397 | + | |
| 398 | + /** | |
| 399 | + * Draws a subrectangle of an image scaled to a destination rectangle | |
| 400 | + * in nonblocking mode with a callback object. | |
| 401 | + */ | |
| 402 | + public boolean drawImage(Image img, | |
| 403 | + int dx1, int dy1, int dx2, int dy2, | |
| 404 | + int sx1, int sy1, int sx2, int sy2, | |
| 405 | + ImageObserver observer) { | |
| 406 | + /*if (dx1 == dx2 || dy1 == dy2) { | |
| 407 | + return true; | |
| 408 | + } | |
| 409 | + WImage wImg = (WImage) img; | |
| 410 | + if (wImg.hasError()) { | |
| 411 | + if (observer != null) { | |
| 412 | + observer.imageUpdate(img, | |
| 413 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 414 | + -1, -1, -1, -1); | |
| 415 | + } | |
| 416 | + return false; | |
| 417 | + } | |
| 418 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 419 | + return ir.drawStretchImage(this, | |
| 420 | + dx1, dy1, dx2, dy2, | |
| 421 | + sx1, sy1, sx2, sy2, | |
| 422 | + null, observer); | |
| 423 | + */ | |
| 424 | + return false; | |
| 425 | + } | |
| 426 | + | |
| 427 | + /** | |
| 428 | + * Draws a subrectangle of an image scaled to a destination rectangle in | |
| 429 | + * nonblocking mode with a solid background color and a callback object. | |
| 430 | + */ | |
| 431 | + public boolean drawImage(Image img, | |
| 432 | + int dx1, int dy1, int dx2, int dy2, | |
| 433 | + int sx1, int sy1, int sx2, int sy2, | |
| 434 | + Color bgcolor, ImageObserver observer) { | |
| 435 | + /*if (dx1 == dx2 || dy1 == dy2) { | |
| 436 | + return true; | |
| 437 | + } | |
| 438 | + WImage wImg = (WImage) img; | |
| 439 | + if (wImg.hasError()) { | |
| 440 | + if (observer != null) { | |
| 441 | + observer.imageUpdate(img, | |
| 442 | + ImageObserver.ERROR|ImageObserver.ABORT, | |
| 443 | + -1, -1, -1, -1); | |
| 444 | + } | |
| 445 | + return false; | |
| 446 | + } | |
| 447 | + ImageRepresentation ir = wImg.getImageRep(); | |
| 448 | + return ir.drawStretchImage(this, | |
| 449 | + dx1, dy1, dx2, dy2, | |
| 450 | + sx1, sy1, sx2, sy2, | |
| 451 | + bgcolor, observer); | |
| 452 | + */ | |
| 453 | + return false; | |
| 454 | + } | |
| 455 | + | |
| 456 | + /** | |
| 457 | + * Actually draws the image on the Inferno display in a blocking mode. | |
| 458 | + */ | |
| 459 | + private native void pGenDraw(int x, int y, int w, int h, byte pixels[]); | |
| 460 | + | |
| 461 | + protected void drawImage(int x, int y, int w, int h, byte pixels[]) { | |
| 462 | + ourSetClip(); | |
| 463 | + //ourSetForeground(); | |
| 464 | + pGenDraw(x, y, w, h, pixels); | |
| 465 | + return; | |
| 466 | + } | |
| 467 | + | |
| 468 | + /** | |
| 469 | + * Copies an area of the canvas that this graphics context paints to. | |
| 470 | + * @param X the x-coordinate of the source. | |
| 471 | + * @param Y the y-coordinate of the source. | |
| 472 | + * @param W the width. | |
| 473 | + * @param H the height. | |
| 474 | + * @param dx the x-coordinate of the destination. | |
| 475 | + * @param dy the y-coordinate of the destination. | |
| 476 | + */ | |
| 477 | + public native void copyArea(int X, int Y, int W, int H, int dx, int dy); | |
| 478 | + | |
| 479 | + | |
| 480 | + /** Draws a rounded rectangle. */ | |
| 481 | + private native void pDrawRoundRect(int x, int y, int w, int h, | |
| 482 | + int arcWidth, int arcHeight); | |
| 483 | + | |
| 484 | + public void drawRoundRect(int x, int y, int w, int h, | |
| 485 | + int arcWidth, int arcHeight) | |
| 486 | + { | |
| 487 | + ourSetClip(); | |
| 488 | + pDrawRoundRect(x,y,w,h,arcWidth,arcHeight); | |
| 489 | + } | |
| 490 | + | |
| 491 | + /** Draws a filled rounded rectangle. */ | |
| 492 | + private native void pFillRoundRect(int x, int y, int w, int h, | |
| 493 | + int arcWidth, int arcHeight); | |
| 494 | + | |
| 495 | + public void fillRoundRect(int x, int y, int w, int h, | |
| 496 | + int arcWidth, int arcHeight) | |
| 497 | + { | |
| 498 | + ourSetClip(); | |
| 499 | + pFillRoundRect(x,y,w,h,arcWidth,arcHeight); | |
| 500 | + } | |
| 501 | + | |
| 502 | + /** Draws a polygon defined by an array of x points and y points */ | |
| 503 | + private native void pDrawPolygon(int xPoints[], int yPoints[], int nPoints); | |
| 504 | + | |
| 505 | + public void drawPolygon(int xPoints[], int yPoints[], int nPoints) | |
| 506 | + { | |
| 507 | + ourSetClip(); | |
| 508 | + pDrawPolygon(xPoints,yPoints,nPoints); | |
| 509 | + } | |
| 510 | + | |
| 511 | + /** Draws a polygon defined by an array of x points and y points */ | |
| 512 | + private native void pDrawPolyline(int xPoints[], int yPoints[], int nPoints); | |
| 513 | + | |
| 514 | + public void drawPolyline(int xPoints[], int yPoints[], int nPoints) | |
| 515 | + { | |
| 516 | + ourSetClip(); | |
| 517 | + pDrawPolyline(xPoints,yPoints,nPoints); | |
| 518 | + } | |
| 519 | + | |
| 520 | + /** Fills a polygon with the current fill mask */ | |
| 521 | + private native void pFillPolygon(int xPoints[], int yPoints[], int nPoints); | |
| 522 | + | |
| 523 | + public void fillPolygon(int xPoints[], int yPoints[], int nPoints) | |
| 524 | + { | |
| 525 | + ourSetClip(); | |
| 526 | + pFillPolygon(xPoints,yPoints,nPoints); | |
| 527 | + } | |
| 528 | + | |
| 529 | + /** Draws an oval to fit in the given rectangle */ | |
| 530 | + private native void pDrawOval(int x, int y, int w, int h); | |
| 531 | + | |
| 532 | + public void drawOval(int x, int y, int w, int h) | |
| 533 | + { | |
| 534 | + ourSetClip(); | |
| 535 | + pDrawOval(x,y,w,h); | |
| 536 | + } | |
| 537 | + | |
| 538 | + /** Fills an oval to fit in the given rectangle */ | |
| 539 | + private native void pFillOval(int x, int y, int w, int h); | |
| 540 | + | |
| 541 | + public void fillOval(int x, int y, int w, int h) | |
| 542 | + { | |
| 543 | + ourSetClip(); | |
| 544 | + pFillOval(x,y,w,h); | |
| 545 | + } | |
| 546 | + | |
| 547 | + /** | |
| 548 | + * Draws an arc bounded by the given rectangle from startAngle to | |
| 549 | + * endAngle. 0 degrees is a vertical line straight up from the | |
| 550 | + * center of the rectangle. Positive angles indicate clockwise | |
| 551 | + * rotations, negative angle are counter-clockwise. | |
| 552 | + */ | |
| 553 | + private native void pDrawArc(int x, int y, int w, int h, | |
| 554 | + int startAngle, | |
| 555 | + int endAngle); | |
| 556 | + | |
| 557 | + public void drawArc(int x, int y, int w, int h, | |
| 558 | + int startAngle, | |
| 559 | + int endAngle) | |
| 560 | + { | |
| 561 | + ourSetClip(); | |
| 562 | + pDrawArc(x,y,w,h,startAngle,endAngle); | |
| 563 | + } | |
| 564 | + | |
| 565 | + /** fills an arc. arguments are the same as drawArc. */ | |
| 566 | + private native void pFillArc(int x, int y, int w, int h, | |
| 567 | + int startAngle, | |
| 568 | + int endAngle); | |
| 569 | + | |
| 570 | + public void fillArc(int x, int y, int w, int h, | |
| 571 | + int startAngle, | |
| 572 | + int endAngle) | |
| 573 | + { | |
| 574 | + ourSetClip(); | |
| 575 | + pFillArc(x,y,w,h,startAngle,endAngle); | |
| 576 | + } | |
| 577 | + | |
| 578 | + | |
| 579 | + public String toString() { | |
| 580 | + return (getClass().getName() + "[" + originX + "," + originY + | |
| 581 | + "[font=" + getFont() + "], color=" + getColor() + "]"); | |
| 582 | + } | |
| 583 | + | |
| 584 | + // Print a peer using this graphics object. | |
| 585 | + void print(ComponentPeer peer) | |
| 586 | + { | |
| 587 | + } | |
| 588 | + | |
| 589 | + /* Outline the given region. */ | |
| 590 | + //public native void drawRegion(Region r); | |
| 591 | + | |
| 592 | + /* Fill the given region. */ | |
| 593 | + //public native void fillRegion(Region r); | |
| 594 | + | |
| 595 | + /** Terminates a PrintJob and releases resources */ | |
| 596 | + public void close(PrintJob pj) | |
| 597 | + { | |
| 598 | + } | |
| 599 | + | |
| 600 | + private native void copyOffscreenImage(int X, int Y, int W, int H); | |
| 601 | + | |
| 602 | +} | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |