Examples of BufferedImage


Examples of java.awt.image.BufferedImage

        response.getOutputStream().write(buffer);
        response.getOutputStream().flush();
        response.getOutputStream().close();
      } else {

        BufferedImage image = ImageIO.read(tfile);

        BufferedImage myImage =
          new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
        Graphics g = myImage.getGraphics();
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, w, h);

        int width = image.getWidth();
        int height = image.getHeight();
View Full Code Here

Examples of java.awt.image.BufferedImage

  public void setStandardColor(Color color) {
    mStandardColor = color;
  }

  private Icon createIcon() {
    BufferedImage img = new BufferedImage(25, 15, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = GraphicsEnvironment.getLocalGraphicsEnvironment().createGraphics(img);

    g.setColor(Color.WHITE);
    g.fillRect(1, 1, 23, 13);
View Full Code Here

Examples of java.awt.image.BufferedImage

    String path = "D:\\Documents and Settings\\Administrator\\����\\2006������\\IMG_4737.JPG";
    File img = new File(path);
    showEXIF(img);
   
    BufferedImage old_img = (BufferedImage)ImageIO.read(img)
    int width = old_img.getWidth();
    int height = old_img.getHeight();
   
    BufferedImage new_img = new BufferedImage(height,width,BufferedImage.TYPE_INT_BGR);       
        Graphics2D g2d =new_img.createGraphics();
       
        AffineTransform origXform = g2d.getTransform();
        AffineTransform newXform = (AffineTransform)(origXform.clone());
        // center of rotation is center of the panel
        double xRot = width/2.0;
View Full Code Here

Examples of java.awt.image.BufferedImage

public class LineButton extends JButton {

  public LineButton() {
    super();
   
    BufferedImage image = new BufferedImage(22, 22, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    g2.setColor(new Color(255,0,0,0));
    g2.fillRect(0, 0, 22, 22);
   
    g2.setColor(getForeground());
    g2.drawLine(0, 11, 22, 11);
View Full Code Here

Examples of java.awt.image.BufferedImage

* A wrapper for an image that uses the ImageIO Framework.
*/
public class ImageIOGenerator extends ImageGenerator {

    protected void write(ImageWrapper wrapper, ImageWriter writer, float quality, boolean alpha) throws IOException {
        BufferedImage bi = wrapper.getBufferedImage();
        // Set some parameters
        ImageWriteParam param = writer.getDefaultWriteParam();
        if (param.canWriteCompressed() &&
            quality >= 0.0 && quality <= 1.0) {
            param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
            String[] types = param.getCompressionTypes();
            // If compression types are defined, but none is set, set the first one,
            // since setCompressionQuality, which requires MODE_EXPLICIT to be set,
            // will complain otherwise.
            if (types != null && param.getCompressionType() == null) {
                param.setCompressionType(types[0]);
            }
            param.setCompressionQuality(quality);
        }
        if (param.canWriteProgressive())
            param.setProgressiveMode(ImageWriteParam.MODE_DISABLED);
        // if bi has type ARGB and alpha is false, we have to tell the writer to not use the alpha channel:
        // this is especially needed for jpeg files where imageio seems to produce wrong jpeg files right now...
        if (bi.getType() == BufferedImage.TYPE_INT_ARGB
            && !alpha) {
            // create a new BufferedImage that uses a WritableRaster of bi, with all the bands except the alpha band:
            WritableRaster raster = bi.getRaster();
            WritableRaster newRaster = raster.createWritableChild(
                0, 0, raster.getWidth(), raster.getHeight(),
                0, 0, new int[] {0, 1, 2 }
            );
            // create a ColorModel that represents the one of the ARGB except the alpha channel:
            DirectColorModel cm = (DirectColorModel) bi.getColorModel();
            DirectColorModel newCM = new DirectColorModel(
                cm.getPixelSize(), cm.getRedMask(),
                cm.getGreenMask(), cm.getBlueMask());
            // now create the new buffer that is used ot write the image:
            BufferedImage rgbBuffer = new BufferedImage(newCM,
                newRaster, false, null);
            writer.write(null, new IIOImage(rgbBuffer, null,
                null), param);
        } else {
            writer.write(null, new IIOImage(bi, null, null),
View Full Code Here

Examples of java.awt.image.BufferedImage

   */
  protected static BufferedImage createImage(JComponent component, Rectangle region)
  throws IOException {
    boolean opaqueValue = component.isOpaque();
    component.setOpaque( true );
    BufferedImage image = new BufferedImage(region.width,
        region.height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = image.createGraphics();
    g2d.translate(-region.getX(), -region.getY());
    //g2d.setClip( region );
    component.paint( g2d );
    g2d.dispose();
    component.setOpaque( opaqueValue );
View Full Code Here

Examples of java.awt.image.BufferedImage

            try {
                tracker.waitForAll();
            } catch (InterruptedException e) {
                throw new IOException(e.getMessage());
            }
            BufferedImage bufImage = new BufferedImage(
                    image.getWidth(null),
                    image.getHeight(null),
                    BufferedImage.TYPE_INT_ARGB);

            Graphics g = bufImage.createGraphics();
            g.drawImage(image, 0, 0, null);
            return bufImage;
        }
    }
View Full Code Here

Examples of java.awt.image.BufferedImage

                  false,
                  tree.isExpanded(path),
                  tree.getModel() .isLeaf(path.getLastPathComponent()),
                  0, false);// returning the label
          lbl.setBounds(pathBounds);// setting bounds to lbl
          image = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
              java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE);// buffered
                                      // image
                                      // reference
                                      // passing
                                      // the
View Full Code Here

Examples of java.awt.image.BufferedImage

    private void export(Circuit circuit) {
      Bounds bds = circuit.getBounds(canvas.getGraphics())
        .expand(BORDER_SIZE);
      int width = (int) Math.round(bds.getWidth() * scale);
      int height = (int) Math.round(bds.getHeight() * scale);
      BufferedImage img = new BufferedImage(width, height,
          BufferedImage.TYPE_INT_RGB);
      Graphics base = img.getGraphics();
      Graphics g = base.create();
      g.setColor(Color.white);
      g.fillRect(0, 0, width, height);
      g.setColor(Color.black);
      if (g instanceof Graphics2D) {
View Full Code Here

Examples of java.awt.image.BufferedImage

  public RenderedImage renderImage(Image img) {
    int width = img.getWidth(null);
    int height = img.getHeight(null);

    // Create a buffered image in which to draw
    BufferedImage bufferedImage = new BufferedImage(width, height,
        BufferedImage.TYPE_INT_ARGB);

    // Create a graphics contents on the buffered image
    Graphics2D g2d = bufferedImage.createGraphics();

    g2d.drawImage(img, 0, 0, null);

    // Graphics context no longer needed so dispose it
    g2d.dispose();
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.