Package java.awt

Examples of java.awt.GraphicsConfiguration$DefaultBufferCapabilities


    @Override
    public FontRenderContext getFontRenderContext() {
        AffineTransform at;
        if (frc == null){
            GraphicsConfiguration gc = getDeviceConfiguration();
            if (gc != null){
                at = gc.getDefaultTransform();
                at.concatenate(gc.getNormalizingTransform());
            }
            else
                at = null;

            boolean isAa = (hints.get(RenderingHints.KEY_TEXT_ANTIALIASING) ==
View Full Code Here


    draw(sprite, g,wx,wy);
    }
 
  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

  public Sprite createTextBox(String text, int width, Color textColor, Color fillColor)
    {
    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

 
  private GameScreen(BufferStrategy strategy, int sw, int sh,int wuWidth, int wuHeight, JPanel panel, String charname)
    {
 
    // needed for splitting Images to multpile sprites
  GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
   
   
  ChatMessages = new Vector<String>();
  zoneChangePoints = new Vector<ZoneChangePoint>();
  EatenSigns = new Vector<EatenSign>();
  ww=wuWidth;
  wh=wuHeight;
  clear();
 
    this.sw=sw;
    this.sh=sh;
  this.myPlayerName = charname;
  //  INIT IMAGES !!
  ImageList = new Images(panel);
  // Walls
  this.wall_sprite = new Sprite(ImageList.getImage("wall0"));
  this.sprite_wall = new Sprite[16];
  for (int i=0;i<=15;i++)
  {
    this.sprite_wall[i]= new Sprite(ImageList.getImage("wall"+i));
  }
  // Dots, Sueprdots, Powerpills
  this.sprite_dot = new Sprite(ImageList.getImage("dot"))
  this.sprite_superdot = new Sprite(ImageList.getImage("superdot"));
  this.sprite_powerpill = new Sprite(ImageList.getImage("powerpill"));
 
  // 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
  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
  this.sprite_zonechange = new Sprite(ImageList.getImage("zonechange"));
  // 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>();
  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
  // for my Player
  this.sprite_mplayer = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("mplayer"));
  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_mplayer.add(new Sprite(image));
    }
  // and other Players
  this.sprite_oplayer = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("oplayer"));
  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_oplayer.add(new Sprite(image));
   
  // and other Players
  this.sprite_pplayer = new Vector<Sprite>();
  tempSprite = new Sprite(ImageList.getImage("pplayer"));
  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_pplayer.add(new Sprite(image));
   
  // ALL IMAGES ADDED
 
View Full Code Here

            backColor = newBackColor;
        }
    }

    public void paintIcon( Component c, Graphics g, int x, int y ) {
        GraphicsConfiguration gc = (g instanceof Graphics2D) ?
                                     (GraphicsConfiguration)((Graphics2D)g).
                                     getDeviceConfiguration() : null;

        if ((buffer == null) || !buffer.hasSameConfiguration(gc, topColor, shadowColor, backColor)) {
            buffer = createBuffer(gc, topColor, shadowColor, backColor);
View Full Code Here

  if (pmSize.width==0) {
      pmSize = pm.getPreferredSize();
  }
  Point position = getLocationOnScreen();
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        GraphicsConfiguration gc = getGraphicsConfiguration();
        Rectangle screenBounds = new Rectangle(toolkit.getScreenSize());
        GraphicsEnvironment ge =
            GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsDevice[] gd = ge.getScreenDevices();
        for(int i = 0; i < gd.length; i++) {
            if(gd[i].getType() == GraphicsDevice.TYPE_RASTER_SCREEN) {
                GraphicsConfiguration dgc =
                    gd[i].getDefaultConfiguration();
                if(dgc.getBounds().contains(position)) {
                    gc = dgc;
                    break;
                }
            }
        }
View Full Code Here

            }
        }

        // Create a translucent intermediate image in which we can perform soft
        // clipping.
        GraphicsConfiguration gc = ((Graphics2D) g).getDeviceConfiguration();
        BufferedImage img = gc.createCompatibleImage(bounds.width, bounds.height, Transparency.TRANSLUCENT);
        Graphics2D g2d = img.createGraphics();

        // Clear the image so all pixels have zero alpha
        g2d.setComposite(AlphaComposite.Clear);
        g2d.fillRect(0, 0, bounds.width, bounds.height);
View Full Code Here

        if (rootParent instanceof JFrame) {
            JFrame frame = (JFrame) rootParent;
            int    state = frame.getExtendedState();

            if (maximize) {
                GraphicsConfiguration gc = frame.getGraphicsConfiguration();
                Insets                i  = Toolkit.getDefaultToolkit().getScreenInsets(gc);
                Rectangle             r  = gc.getBounds();

                r.x      += i.left;
                r.y      += i.top;
                r.width  -= i.left + i.right;
                r.height -= i.top + i.bottom;
View Full Code Here

                transparency = Transparency.TRANSLUCENT;
            }

            // Create the buffered image
            GraphicsDevice        gs = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gs.getDefaultConfiguration();

            bimage = gc.createCompatibleImage(width, height, transparency);
        } catch (HeadlessException e) {
            // The system does not have a screen
        }

        if (bimage == null) {
View Full Code Here

                transparency = Transparency.BITMASK;
            }

            // Create the buffered image
            GraphicsDevice        gs = ge.getDefaultScreenDevice();
            GraphicsConfiguration gc = gs.getDefaultConfiguration();

            bimage = gc.createCompatibleImage(image.getWidth(null), image.getHeight(null), transparency);
        } catch (HeadlessException e) {
            // The system does not have a screen
        }

        if (bimage == null) {
View Full Code Here

TOP

Related Classes of java.awt.GraphicsConfiguration$DefaultBufferCapabilities

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.