Package java.awt.image

Examples of java.awt.image.VolatileImage


            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height, caps);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here


            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here

            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height, caps);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here

            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here

public class XGraphics2DRTest extends TestCase {
    public void testNullClip() {
        try {
            GraphicsConfiguration gconf =
                    GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
            VolatileImage vim = gconf.createCompatibleVolatileImage(10, 10);
            Graphics2D g2 = (Graphics2D) vim.getGraphics();
            g2.setClip(null);
        } catch(Exception e) {
            e.printStackTrace();
            fail("Cannot set null clip");
        }
View Full Code Here

    }

    public void testCopyArea() {
        GraphicsConfiguration gconf =
                GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
        VolatileImage vim = gconf.createCompatibleVolatileImage(20, 20);
        Graphics2D g2 = (Graphics2D) vim.getGraphics();
        g2.setColor(Color.WHITE);
        g2.fillRect(0,0,20,20);
        g2.setColor(Color.RED);
        g2.fillRect(2,2,1,1);
        g2.copyArea(2,2,1,1,2,4);
        int pix[] = vim.getSnapshot().getRaster().getPixel(4,6,(int [])null);
        assertEquals("copyArea failed for untranslated graphics", pix[0],255);
        assertEquals("copyArea failed for untranslated graphics", pix[1],0);
        assertEquals("copyArea failed for untranslated graphics", pix[2],0);
        g2.setTransform(AffineTransform.getTranslateInstance(2,2));
        g2.copyArea(0,0,1,1,4,8);
        pix = vim.getSnapshot().getRaster().getPixel(6,10,(int [])null);
        assertEquals("copyArea failed for translated graphics", pix[0],255);
        assertEquals("copyArea failed for translated graphics", pix[1],0);
        assertEquals("copyArea failed for translated graphics", pix[2],0);
    }
View Full Code Here

    GraphicsEnvironment e = GraphicsEnvironment
        .getLocalGraphicsEnvironment();
    GraphicsDevice d = e.getDefaultScreenDevice();
    GraphicsConfiguration c = d.getDefaultConfiguration();
    VolatileImage compatibleImage = c.createCompatibleVolatileImage(width,
        height, Transparency.TRANSLUCENT);
    return compatibleImage;
  }
View Full Code Here

    gc.dispose();
    return ret;
  }

  public static VolatileImage asCompatibleVolatileImage(Image img) {
    VolatileImage ret = defaultScreenDeviceConfiguration().createCompatibleVolatileImage(img.getWidth(null), img.getHeight(null));
    Graphics2D gc = ret.createGraphics();
    gc.drawImage(img, 0, 0, null);
    gc.dispose();
    return ret;
  }
View Full Code Here

    gc.dispose();
    return ret;
  }

  public static VolatileImage asCompatibleVolatileImage(Image img, int transparency) {
    VolatileImage ret = defaultScreenDeviceConfiguration().createCompatibleVolatileImage(img.getWidth(null), img.getHeight(null), transparency);
    Graphics2D gc = ret.createGraphics();
    gc.setComposite(AlphaComposite.Src);
    gc.drawImage(img, 0, 0, null);
    gc.dispose();
    return ret;
  }
View Full Code Here

      {
        comp = comp.parent;
        p = comp == null ? null : comp.peer;
      }

    VolatileImage im = null;
    if (p != null)
      im = p.createVolatileImage(width, height);
    return im;
  }
View Full Code Here

TOP

Related Classes of java.awt.image.VolatileImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.