Package java.awt.image

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


        : BufferedImage.TYPE_INT_ARGB);

    // Setup the rendering resources to match the source image's
    BufferedImage result = new BufferedImage(targetWidth, targetHeight,
        imageType);
    Graphics2D resultGraphics = result.createGraphics();

    // Scale the image to the new buffer using the specified rendering hint.
    resultGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
        interpolationHintValue);
    resultGraphics.drawImage(src, 0, 0, targetWidth, targetHeight, null);
View Full Code Here


            Rectangle r = chart.getBounds();
            BufferedImage img = new BufferedImage((int)r.getWidth(),
                                                  (int)r.getHeight(),
                                                  BufferedImage.TYPE_INT_RGB);

            Graphics2D grafx = img.createGraphics();
            chart.render(grafx);
            success = ImageIO.write(img, "jpeg", os);
            os.flush();       
        } catch(Throwable t) {
            throw new EncodingException(t.getMessage(), t);
View Full Code Here

            Rectangle r = chart.getBounds();
            BufferedImage img = new BufferedImage((int)r.getWidth(),
                                                  (int)r.getHeight(),
                                                  BufferedImage.TYPE_INT_RGB);

            Graphics2D grafx = img.createGraphics();
            chart.render(grafx);
            success = ImageIO.write(img, "png", os);
            os.flush();
        } catch(Throwable t) {
            t.printStackTrace();
View Full Code Here

            Rectangle r = chart.getBounds();
            BufferedImage img = new BufferedImage((int)r.getWidth(),
                                                  (int)r.getHeight(),
                                                  BufferedImage.TYPE_INT_RGB);

            Graphics2D grafx = img.createGraphics();
            chart.render(grafx);
            success = ImageIO.write(img, format, os);
            os.flush();
        } catch(Throwable t) {
            throw new EncodingException(t.getMessage(), t);
View Full Code Here

                    try {mediaTracker.waitForID(0);} catch (final InterruptedException e) {}

                    // make a BufferedImage out of that
                    final BufferedImage i = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
                    try {
                        i.createGraphics().drawImage(scaled, 0, 0, width, height, null);
                        image = i;
                        // check outcome
                        final Raster raster = i.getData();
                        int[] pixel = new int[3];
                        pixel = raster.getPixel(0, 0, pixel);
View Full Code Here

                        // generate an byte array from the generated image
                        int width = i.getWidth(null); if (width < 0) width = 96; // bad hack
                        int height = i.getHeight(null); if (height < 0) height = 96; // bad hack
                        final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
                        bi.createGraphics().drawImage(i, 0, 0, width, height, null);
                        final ByteBuffer result = RasterPlotter.exportImage(bi, targetExt);

                        // write the array to the client
                        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, 200, null, mimeType, result.length(), targetDate, null, null, null, null, nocache);
                        if (!method.equals(HeaderFramework.METHOD_HEAD)) {
View Full Code Here

        int width = CELL_PAD + (CELLS_SIZE + CELL_PAD) * jarNames.length;

        BufferedImage img = new BufferedImage(width + LABEL_WIDTH, heigh
                + LABEL_WIDTH, BufferedImage.TYPE_INT_RGB);

        Graphics2D g = img.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);

        g.setColor(Color.WHITE);
        g.fillRect(0, 0, width + LABEL_WIDTH, heigh + LABEL_WIDTH);
View Full Code Here

        int imageType = "image/png".equals(contentType)
                        ? BufferedImage.TYPE_INT_ARGB
                        : BufferedImage.TYPE_INT_RGB;
        BufferedImage bImg = new BufferedImage(width, resizedHeight, imageType);
        Graphics2D g2d = bImg.createGraphics();
        g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
        g2d.drawImage(icon.getImage(), 0, 0, width, resizedHeight, null);
        g2d.dispose();

        String formatName = "";
View Full Code Here

               int height = (int) (icon.getIconHeight() * ratio);
              
               int imageType = "image/png".equals(contentType) ?
                     BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB;                 
               BufferedImage bImg = new BufferedImage(width, height, imageType);
               Graphics2D g2d = bImg.createGraphics();
               g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
                     RenderingHints.VALUE_INTERPOLATION_BICUBIC);
               g2d.drawImage(icon.getImage(), 0, 0, width, height, null);
               g2d.dispose();
  
View Full Code Here

            char charToPrint = allChars[i];
            int charWidth = fontMetrics.charWidth(charToPrint);
            int charDim = Math.max(maxAdvance, fontHeight);
            int halfCharDim = (charDim / 2);
            BufferedImage charImage = new BufferedImage(charDim, charDim, BufferedImage.TYPE_INT_ARGB);
            Graphics2D charGraphics = charImage.createGraphics();
            charGraphics.translate(halfCharDim, halfCharDim);
            double angle = (Math.random() - 0.5) * rotationRange;
            charGraphics.transform(AffineTransform.getRotateInstance(angle));
            charGraphics.translate(-halfCharDim, -halfCharDim);
            int charColor = 60 + (int) (Math.random() * 90);
 
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.