Examples of BufferedImage


Examples of java.awt.image.BufferedImage

                                 final double deviceScaleFactor) throws UnsupportedEncoderException, IOException
  {
    final int imageWidth = (int) StrictGeomUtility.toExternalValue(width);
    final int imageHeight = (int) StrictGeomUtility.toExternalValue(height);
    // first clip.
    final BufferedImage bi = ImageUtils.createTransparentImage(imageWidth, imageHeight);
    final Graphics2D graphics = (Graphics2D) bi.getGraphics();
    graphics.scale(deviceScaleFactor, deviceScaleFactor);

    if (image instanceof BufferedImage)
    {
      if (graphics.drawImage(image, null, null) == false)
View Full Code Here

Examples of java.awt.image.BufferedImage

  /**
   * @see Graphics2D#drawImage(BufferedImage, BufferedImageOp, int, int)
   */
  public void drawImage(final BufferedImage img, final BufferedImageOp op, final int x, final int y)
  {
    BufferedImage result = img;
    if (op != null)
    {
      result = op.createCompatibleDestImage(img, img.getColorModel());
      result = op.filter(img, result);
    }
View Full Code Here

Examples of java.awt.image.BufferedImage

   * @noinspection UseOfObsoleteCollectionType
   * @see Graphics2D#drawRenderedImage(RenderedImage, AffineTransform)
   */
  public void drawRenderedImage(final RenderedImage img, final AffineTransform xform)
  {
    final BufferedImage image;
    if (img instanceof BufferedImage)
    {
      image = (BufferedImage) img;
    }
    else
    {
      final ColorModel cm = img.getColorModel();
      final int width = img.getWidth();
      final int height = img.getHeight();
      final WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
      final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
      final Hashtable properties = new Hashtable();
      final String[] keys = img.getPropertyNames();
      if (keys != null)
      {
        final int keyCount = keys.length;
        for (int i = 0; i < keyCount; i++)
        {
          properties.put(keys[i], img.getProperty(keys[i]));
        }
      }
      final BufferedImage result = new BufferedImage(cm, raster, isAlphaPremultiplied, properties);
      img.copyData(raster);
      image = result;
    }
    drawImage(image, xform, null);
  }
View Full Code Here

Examples of java.awt.image.BufferedImage

    final double transx = sx1 * scalex;
    final double transy = sy1 * scaley;
    final AffineTransform tx = AffineTransform.getTranslateInstance(dx1 - transx, dy1 - transy);
    tx.scale(scalex, scaley);

    final BufferedImage mask = new BufferedImage(img.getWidth(observer), img.getHeight(observer),
        BufferedImage.TYPE_BYTE_BINARY);
    final Graphics g = mask.getGraphics();
    g.fillRect(sx1, sy1, (int) swidth, (int) sheight);
    drawImage(img, mask, tx, null, observer);
    g.dispose();
    return true;
  }
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.