Examples of createGraphics()


Examples of java.awt.image.BufferedImage.createGraphics()

    public void render(Graphics2D g) {       
        Dimension d = getPreferredSize();
        BufferedImage im = new BufferedImage((int)d.width,
                                             (int)d.height,
                                             BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = im.createGraphics();
        g2.setColor(Color.white);
        g2.fillRect(0, 0, d.width, d.height);
        g2.setColor(Color.black);
       
        paintDefault(g2);
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

    // scale it to the new size on-the-fly
    thumbImage = new BufferedImage(iThumbWidth, iThumbHeight, BufferedImage.TYPE_INT_RGB);

    if (DebugFile.trace) DebugFile.writeln("java.awt.Graphics2D = thumbImage.createGraphics()");

    graphics2D = thumbImage.createGraphics();
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BILINEAR);
    graphics2D.drawImage(oImg, 0, 0, iThumbWidth, iThumbHeight, null);
    graphics2D.dispose();

    if (DebugFile.trace) DebugFile.writeln("com.sun.image.codec.jpeg.JPEGImageEncoder = JPEGCodec.createJPEGEncoder([OutputStream]);");
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

      BufferedImage oBImg = new BufferedImage(iImageWidth, iImageHeight, BufferedImage.TYPE_INT_RGB);

      if (DebugFile.trace) DebugFile.writeln("java.awt.Graphics2D = thumbImage.createGraphics()");

      Graphics2D graphics2D = oBImg.createGraphics();
      graphics2D.drawImage(oImg, 0, 0, iImageWidth, iImageHeight, null);
      graphics2D.dispose();

      oEnc.encode(oBImg);
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

            int minHeight = Math.min(normalHeight, availableImageHeight);

            BufferedImage bi =
              new BufferedImage(minWidth, minHeight, BufferedImage.TYPE_INT_ARGB);

            Graphics2D g = bi.createGraphics();
            if (printImage.getModeValue() == ModeEnum.OPAQUE)
            {
              g.setColor(printImage.getBackcolor());
              g.fillRect(0, 0, minWidth, minHeight);
            }
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

            Rectangle bounds = r2d.getBounds();
            BufferedImage im = new BufferedImage(bounds.width + MARGIN * 2,
                                                 bounds.height + MARGIN * 2,
                                                 BufferedImage.TYPE_INT_ARGB);

            Graphics2D g2d = im.createGraphics();
            g2d.setColor(Color.WHITE);
            g2d.fillRect(0, 0, im.getWidth(), im.getHeight());

            g2d.setColor(Color.BLACK);
            draw(g2d, rx + MARGIN - bounds.x, ry + MARGIN - bounds.y);
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

      switch (element.getScaleImageValue())
      {
        case CLIP:
        {
          BufferedImage bi = new BufferedImage(availableImageWidth, availableImageHeight, BufferedImage.TYPE_INT_ARGB);
          Graphics2D grx = bi.createGraphics();
         
          int xoffset = (int) (xalignFactor * (availableImageWidth - normalWidth));
          int yoffset = (int) (yalignFactor * (availableImageHeight - normalHeight));

          Shape oldClipShape = grx.getClip();
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

          // in invalid image files for some viewers (browsers)
          (imageType == JRRenderable.IMAGE_TYPE_GIF || imageType == JRRenderable.IMAGE_TYPE_PNG
            ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB
          );

      Graphics g = bi.createGraphics();
      g.drawImage(image, 0, 0, null);
      g.dispose();
    }

    return encode(bi, imageType);
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

  }

  private Image createIcon(LayerType type, FeatureStyleInfo fsi, int iconSize, String iconUrl)
      throws AdvancedviewsException {
    BufferedImage bi = new BufferedImage(iconSize, iconSize, BufferedImage.TYPE_INT_ARGB);
    Graphics2D gr = bi.createGraphics();
    gr.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    switch (type) {
    case RASTER:
      drawRaster(gr, iconSize, (iconUrl == null ? DEFAULT_RASTER_IMAGE_PATH : iconUrl));
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

    return toBufferedImage(img, scaledSize.getWidth(), scaledSize.getHeight(), BufferedImage.TYPE_INT_RGB);
  }
 
  private static BufferedImage toBufferedImage(Image image, int w, int h, int type) {
    BufferedImage result = new BufferedImage(w, h, type);
    Graphics2D g = result.createGraphics();
    g.drawImage(image, 0, 0, null);
    g.dispose();
    return result;
  }
 
View Full Code Here

Examples of java.awt.image.BufferedImage.createGraphics()

            .get(0).rules().get(0), font);
      }
    }
    JComponent c = builder.buildComponent();
    BufferedImage image = new BufferedImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
    Graphics2D graphics = image.createGraphics();
    RenderingHints renderingHints = new Hints();
    renderingHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    graphics.setRenderingHints(renderingHints);
    c.print(graphics);
    return image;
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.