Package java.awt

Examples of java.awt.Graphics2D.drawImage()


                    });
                } catch (Exception ex) { }
            }
        }
        Graphics2D g = createGraphics();
        g.drawImage(image, 0, 0, canvas.getWidth(), canvas.getHeight(), null);
        releaseGraphics(g);
    }
    public void showImage(Image image, double scale) {
        if (image == null)
            return;
View Full Code Here


            if (rect != null)
            {
                int w = img.getWidth(this);
                int h = img.getHeight(this);
                if (w >= 0 && h >= 0)
                    g2d.drawImage(img, 0, 0, rect.width, rect.height, 0, 0, w, h, this);
            }
        }
    }

    public boolean getMouseDown()
View Full Code Here

            d = Math.min(dx, dy);
            g2d.scale(d, d);
            g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, m_interpolation);
            Rectangle rect = g2d.getClipBounds();
            if (rect != null)
                g2d.drawImage(m_img, (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), this);
        }
        return false;
    }

    public int print(Graphics pg, PageFormat pageFormat, int pageIndex)
View Full Code Here

            BufferedImage temp = new BufferedImage(width, (int) (width / ratio), BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = temp.createGraphics();
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                    RenderingHints.VALUE_INTERPOLATION_BILINEAR);
            g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null);
            g2.dispose();

            thumb = temp;
        } while (width != requestedThumbSize);
View Full Code Here

      float imgRatio = (float)image.getWidth() / (float)image.getHeight();

      if (imgRatio > panelRatio) {
        float tw = (float)getWidth();
        float th = (float)getWidth() / imgRatio;
        gg.drawImage(image, 0, (int)(getHeight()/2 - th/2), (int) tw, (int) th, null);
      } else {
        float tw = (float)getHeight() * imgRatio;
        float th = (float)getHeight();
        gg.drawImage(image, (int)((float)getWidth()/2 - tw/2), 0, (int) tw, (int) th, null);
      }
View Full Code Here

        float th = (float)getWidth() / imgRatio;
        gg.drawImage(image, 0, (int)(getHeight()/2 - th/2), (int) tw, (int) th, null);
      } else {
        float tw = (float)getHeight() * imgRatio;
        float th = (float)getHeight();
        gg.drawImage(image, (int)((float)getWidth()/2 - tw/2), 0, (int) tw, (int) th, null);
      }

    } else if (image != null && useRegion) {
      float panelRatio = (float)getWidth() / (float)getHeight();
      float imgRatio = (float)width / (float)height;
View Full Code Here

      if (imgRatio > panelRatio) {
        int tw = getWidth();
        int th = (int) (getWidth() / imgRatio);
        int tx = 0;
        int ty = getHeight()/2 - th/2;
        gg.drawImage(image, tx, ty, tx + tw, ty + th, x, y, x + width, y + width, null);
      } else {
        int tw = (int) (getHeight() * imgRatio);
        int th = getHeight();
        int tx = getWidth()/2 - tw/2;
        int ty = 0;
View Full Code Here

      } else {
        int tw = (int) (getHeight() * imgRatio);
        int th = getHeight();
        int tx = getWidth()/2 - tw/2;
        int ty = 0;
        gg.drawImage(image, tx, ty, tx + tw, ty + th, x, y, x + width, y + width, null);
      }
    }
  }
}
View Full Code Here

        }

        if (savdest != null) {
            Graphics2D big = savdest.createGraphics();
      try {
          big.drawImage(dest, 0, 0, null);
      } finally {
          big.dispose();
      }
            return savdest;
        } else {
View Full Code Here

                    double sx = (double)getWidth() / (double)artwork.getWidth();
                    double sy = (double)getHeight() / (double)artwork.getHeight();
                    sx = Math.min(sx, sy);
                    sy = Math.min(sx, sy);
                    AffineTransform tx = AffineTransform.getScaleInstance(sx, sy);
                    g2.drawImage(artwork, new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR), 0, 0);
                }

                @Override
                public Dimension getPreferredSize() {
                    return new Dimension(artwork.getWidth(), artwork.getHeight());
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.