Package java.awt.image

Examples of java.awt.image.BufferedImage


            if (isUseImageBuffer() && getBuffer() == null) {
                setBuffer(createAndPaintImageBuffer(list));
            }

            BufferedImage bufferedImage = getBuffer();

            if (composite != null) {
                ((Graphics2D) g).setComposite(composite);
            }
           
View Full Code Here


    protected void setBuffer(BufferedImage bi) {
        buffer = bi;
    }

    protected BufferedImage createAndPaintImageBuffer(OMGraphicList list) {
        BufferedImage bufferedImage = null;
        if (list != null && layer != null) {
            int w = layer.getProjection().getWidth();
            int h = layer.getProjection().getHeight();
            bufferedImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
            super.setRenderingHints(g2d);
            long startPaint = System.currentTimeMillis();
            list.render(g2d);
            long endPaint = System.currentTimeMillis();
            if (Debug.debugging("policy")) {
View Full Code Here

     */
    public static ImageIcon createColorIcon(BasicStroke stroke, int width,
                                       int height, boolean horizontalOrientation,
                                       Color color, Color background, Color matting) {

      BufferedImage bigImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
      Graphics2D g = (Graphics2D) bigImage.getGraphics();
     
      g.setBackground(OMColor.clear);
      g.setPaint(OMColor.clear);
      g.fillRect(0, 0, width, height);
     
View Full Code Here

    public ImageFormatter makeClone() {
        return new GIFImageIOFormatter();
    }

    public byte[] formatImage(BufferedImage bi) {
        BufferedImage reducedImage = ColorReducer.reduce24(bi, 256);
        try {
            ByteArrayOutputStream byo = new ByteArrayOutputStream();
            ImageIO.write(reducedImage, getFormatName(), byo);
            return byo.toByteArray();
        } catch (java.io.IOException e) {
View Full Code Here

        return attributeBox;
    }

    private ImageIcon getTextAccentToggleButtonImage(int width, int height,
                                                     Font f, String s) {
        BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        Graphics g = bi.getGraphics();
        g.setFont(f);
        g.setColor(Color.black);
        FontMetrics fm = g.getFontMetrics();

        int stringWidth = fm.stringWidth(s);
View Full Code Here

        }

        IndexColorModel colorModel = new IndexColorModel(8, r.length, r, g, b, a);

        // create a image with the reduced colors
        BufferedImage reducedImage = new BufferedImage(width, height,
                BufferedImage.TYPE_BYTE_INDEXED, colorModel);

        // manipulate raster directly for best performance & color match
        WritableRaster raster = reducedImage.getRaster();
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                // add 1 as transparent is first
                int value = transparent[x][y] ? 0 : (pixels[x][y] + 1);
                raster.setSample(x, y, 0, value);
View Full Code Here

        }

        IndexColorModel colorModel = new IndexColorModel(8, r.length, r, g, b, a);

        // create a image with the reduced colors
        BufferedImage reducedImage = new BufferedImage(width, height,
                BufferedImage.TYPE_BYTE_INDEXED, colorModel);

        // manipulate raster directly for best performance & color match
        WritableRaster raster = reducedImage.getRaster();
        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                int value = pixels[x][y];
                raster.setSample(x, y, 0, value);
            }
View Full Code Here

     * @param imageType image type - see BufferedImage
     * @return java.awt.Graphics object to use.
     * @see java.awt.image.BufferedImage
     */
    public Graphics getGraphics(int width, int height, int imageType) {
        bufferedImage = new BufferedImage(width, height, imageType);

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        Graphics g = ge.createGraphics(bufferedImage);
        g.setClip(0, 0, width, height);
        return g;
View Full Code Here

            Debug.output("Formatter: creating scaled image...");
        }

        try {

            BufferedImage buffi = BufferedImageHelper.getBufferedImage(image,
                    0,
                    0,
                    -1,
                    -1);
View Full Code Here

     * Return the image bytes of the formatted image.
     *
     * @return byte[] representing the image.
     */
    public byte[] getImageBytes() {
        BufferedImage bi = getBufferedImage();
        if (bi == null) {
            return new byte[0];
        } else {
            Debug.message("formatter",
                    "Formatter: creating formatted image bytes...");
View Full Code Here

TOP

Related Classes of java.awt.image.BufferedImage

Copyright © 2015 www.massapicom. 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.