Package java.awt

Examples of java.awt.GraphicsConfiguration.createCompatibleImage()


            // Paint the display into an offscreen buffer
            GraphicsConfiguration gc = graphics.getDeviceConfiguration();
            java.awt.Rectangle clipBounds = graphics.getClipBounds();
            java.awt.image.BufferedImage bufferedImage =
                gc.createCompatibleImage(clipBounds.width, clipBounds.height,
                    Transparency.OPAQUE);

            if (bufferedImage != null) {
                Graphics2D bufferedImageGraphics = (Graphics2D)bufferedImage.getGraphics();
                bufferedImageGraphics.setClip(0, 0, clipBounds.width, clipBounds.height);
View Full Code Here


            preferredSize = new Dimension();
            int is = getFont().getSize() * 4;
            BufferedImage image = null;
            GraphicsConfiguration graphicsConfiguration = getGraphicsConfiguration();
            if (graphicsConfiguration != null)
                image = graphicsConfiguration.createCompatibleImage(is, is);
            else
                image = new BufferedImage(is, is, BufferedImage.TYPE_4BYTE_ABGR);
            Graphics2D g = image.createGraphics();
            g.setFont(getFont());
            FontMetrics fm = g.getFontMetrics();
View Full Code Here

        if (image == null)
        {
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            GraphicsDevice gd = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gd.getDefaultConfiguration();
            BufferedImage bi = gc.createCompatibleImage(getIconWidth(), getIconHeight(),
                    Transparency.TRANSLUCENT);
            paintIcon(null, bi.getGraphics(), 0, 0);
        }
        return image;
    }
View Full Code Here

  {
    BufferedImage image = null;
    GraphicsConfiguration gc = getGraphicsConfiguration();
    if (gc != null)
    {
      image = gc.createCompatibleImage(getWidth(), getHeight());
    }
    else
    {
      image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
    }
View Full Code Here

    }
 
  public Sprite createString(String text, Color textColor)
    {
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Image image = gc.createCompatibleImage(g.getFontMetrics().stringWidth(text),16,Transparency.BITMASK);   
    Graphics g2d=image.getGraphics();

    g2d.setColor(Color.black);
    g2d.drawString(text,-1,9);
    g2d.drawString(text,-1,11);
View Full Code Here

    {
    int lineLengthPixels=g.getFontMetrics().stringWidth(text);
    int numLines=(lineLengthPixels/width)+1;
   
    GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
    Image image = gc.createCompatibleImage(((lineLengthPixels<width)?lineLengthPixels:width)+4,16*numLines,Transparency.BITMASK);
   
    Graphics g2d=image.getGraphics();
    g2d.setColor(fillColor);
    g2d.fillRect(0,0,((lineLengthPixels<width)?lineLengthPixels:width)+4,16*numLines);

 
View Full Code Here

  // Fruits
  this.sprite_fruit = new Vector<Sprite>();
  Sprite tempSprite = new Sprite(ImageList.getImage("fruits"));
  for (int i=0;i<=13;i++)
    {
        Image image = gc.createCompatibleImage(PIXEL_SCALE,PIXEL_SCALE,Transparency.BITMASK);
        tempSprite.draw(image.getGraphics(),0,0,i*PIXEL_SCALE,0);
        sprite_fruit.add(new Sprite(image));
    }
 
  // KILLed Sprite
View Full Code Here

  // KILLed Sprite
  this.sprite_EatenSprite = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("eatensign"));
  for (int i=0;i<=2;i++)
    {
        Image image = gc.createCompatibleImage(PIXEL_SCALE,PIXEL_SCALE,Transparency.BITMASK);
        tempSprite.draw(image.getGraphics(),0,0,i*PIXEL_SCALE,0);
        sprite_EatenSprite.add(new Sprite(image));
    }
 
  // ZoneChangePoints
View Full Code Here

  // add Ghost sprites 
  this.sprite_GhostR = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("GhostR"));
  for (int i=0;i<=9;i++)
    {
        Image image = gc.createCompatibleImage(PIXEL_SCALE,PIXEL_SCALE,Transparency.BITMASK);
        tempSprite.draw(image.getGraphics(),0,0,i*PIXEL_SCALE,0);
        sprite_GhostR.add(new Sprite(image));
    }
 
  this.sprite_GhostG = new Vector<Sprite>();
View Full Code Here

 
  this.sprite_GhostG = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("GhostG"));
  for (int i=0;i<=9;i++)
    {
        Image image = gc.createCompatibleImage(PIXEL_SCALE,PIXEL_SCALE,Transparency.BITMASK);
        tempSprite.draw(image.getGraphics(),0,0,i*PIXEL_SCALE,0);
        sprite_GhostG.add(new Sprite(image));
    }
 
  // add Player Images
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.