Package java.awt

Examples of java.awt.Graphics2D.transform()


            if (g instanceof Graphics2D) {
                Graphics2D gfx = (Graphics2D) g;

                if (transform != null) {
                    gfx.transform(transform);
                }

                gfx.translate(x, y);
                p.paint(gfx, ctx.getComponent(), w, h);
                gfx.translate(-x, -y);
View Full Code Here


                gfx.translate(-x, -y);

                if (transform != null) {

                    try {
                        gfx.transform(transform.createInverse());
                    } catch (NoninvertibleTransformException e) {

                        // this should never happen as we are in control of all
                        // calls into this method and only ever pass in simple
                        // transforms of rotate, flip and translates
View Full Code Here

                // it is not a instance of Graphics2D
                BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
                Graphics2D    gfx = img.createGraphics();

                if (transform != null) {
                    gfx.transform(transform);
                }

                p.paint(gfx, ctx.getComponent(), w, h);
                gfx.dispose();
                g.drawImage(img, x, y, null);
View Full Code Here

                if (paint.getTransparency() == Transparency.OPAQUE) {
                    type = BufferedImage.TYPE_3BYTE_BGR;
                }
                img = new BufferedImage((int)width, (int)height, type);
                Graphics2D g = (Graphics2D)img.getGraphics();
                g.transform(transform);
                AffineTransform inv = transform.createInverse();
                Shape fillRect = new Rectangle2D.Double(0,0,img.getWidth(),img.getHeight());
                fillRect = inv.createTransformedShape(fillRect);
                g.setPaint(paint);
                g.fill(fillRect);
View Full Code Here

        );
   
    Graphics2D grx = (Graphics2D) image.getGraphics();
    AffineTransform transform = new AffineTransform();
    transform.scale(realZoom, realZoom);
    grx.transform(transform);

    drawPageError((Graphics2D) grx);
   
    return image;
  }
View Full Code Here

            if (ico != null) {
                Graphics2D g2d = (Graphics2D) g;
                g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                AffineTransform oldt = g2d.getTransform();
                g2d.transform(AffineTransform.getScaleInstance(zoom, zoom));
                ico.paintIcon(c, g2d, (int) (x / zoom), (int) (y / zoom));
                g2d.setTransform(oldt);
            }
        }
        public void setIcon(Icon ico) {
View Full Code Here

                if (paint.getTransparency() == Transparency.OPAQUE) {
                    type = BufferedImage.TYPE_3BYTE_BGR;
                }
                img = new BufferedImage((int)width, (int)height, type);
                Graphics2D g = (Graphics2D)img.getGraphics();
                g.transform(transform);
                AffineTransform inv = transform.createInverse();
                Shape fillRect = new Rectangle2D.Double(0,0,img.getWidth(),img.getHeight());
                fillRect = inv.createTransformedShape(fillRect);
                g.setPaint(paint);
                g.fill(fillRect);
View Full Code Here

 
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.transform(getScaleTransform());
    GridCell[][] cells = ((IGridWorld) model).getGrid().getCells();
    g2d.setColor(Color.lightGray);
    for(int h = 0; h < cells[0].length; h++) {
        for(int w = 0; w < cells.length; w++) {
          g2d.draw(cells[w][h]);
View Full Code Here

 
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.transform(getScaleTransform());
    GridCell[][] cells = ((IGridWorld) model).getGrid().getCells();
    for(int h = 0; h < cells[0].length; h++)
        for(int w = 0; w < cells.length; w++) {
          g2d.setColor(Color.yellow);
          g2d.draw(cells[w][h]);
View Full Code Here

  protected void paintComponent(Graphics g) {
    //TODO add possibility to draw joints and contacts
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g;
    saveXform = g2d.getTransform();
    g2d.transform(scaleXform);
    g2d.setColor(Color.white);
    g2d.fillRect(0, 0, (int)modelWidth, (int)modelHeight);
    g2d.setColor(Color.black);
    for ( BodyView view : bodies ) {
      view.draw(g);
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.