Package ae.java.awt.image

Examples of ae.java.awt.image.BufferedImage


    }

    protected RenderedImage getIndexedImage() {
        IndexColorModel icm = getIndexColorModel();

        BufferedImage dst =
            new BufferedImage(src.getWidth(), src.getHeight(),
                              BufferedImage.TYPE_BYTE_INDEXED, icm);

        WritableRaster wr = dst.getRaster();
        for (int y =0; y < dst.getHeight(); y++) {
            for (int x = 0; x < dst.getWidth(); x++) {
                Color aColor = getSrcColor(x,y);
                wr.setSample(x, y, 0, findColorIndex(root, aColor));
            }
        }
View Full Code Here


            // If the image has BITMASK transparency, we need to make sure
            // it gets converted to 32-bit ARGB, because the JPEG encoder
            // relies upon the full 8-bit alpha channel.
            boolean forceARGB =
                (indexCM.getTransparency() != Transparency.OPAQUE);
            BufferedImage temp = indexCM.convertToIntDiscrete(sourceLine,
                                                              forceARGB);
            sourceLine = temp.getRaster();
        } else {
            sourceLine = srcRas.createChild(sourceXOffset,
                                            sourceYOffset+y,
                                            sourceWidth, 1,
                                            0, 0,
View Full Code Here

    BufferedImage getThumbnail(ImageInputStream iis,
                               int index,
                               JPEGImageReader reader) throws IOException {
        reader.thumbnailStarted(index);
        BufferedImage ret = null;
        if ((thumb != null) && (index == 0)) {
                ret = thumb.getThumbnail(iis, reader);
        } else {
            if (thumb != null) {
                index--;
View Full Code Here

            if ((jfxx == null)
                || (jfxx.code == THUMB_PALETTE)) {
                writeJFXXSegment(index, thumb, ios, writer); // default
            } else {
                // Expand to RGB
                BufferedImage thumbRGB =
                    ((IndexColorModel) cm).convertToIntDiscrete
                    (thumb.getRaster(), false);
                jfxx.setThumbnail(thumbRGB);
                writer.thumbnailStarted(index);
                jfxx.write(ios, writer)// Handles clipping if needed
                writer.thumbnailComplete();
            }
        } else if (cs.getType() == ColorSpace.TYPE_RGB) {
            if (jfxx == null) {
                if (onlyOne) {
                    write(ios, thumb, writer); // As part of the header
                } else {
                    writeJFXXSegment(index, thumb, ios, writer); // default
                }
            } else {
                // If this is the only one, write the header first
                if (onlyOne) {
                    write(ios, writer);
                }
                if (jfxx.code == THUMB_PALETTE) {
                    writeJFXXSegment(index, thumb, ios, writer); // default
                    writer.warningOccurred
                        (JPEGImageWriter.WARNING_NO_RGB_THUMB_AS_INDEXED);
                } else {
                    jfxx.setThumbnail(thumb);
                    writer.thumbnailStarted(index);
                    jfxx.write(ios, writer)// Handles clipping if needed
                    writer.thumbnailComplete();
                }
            }
        } else if (cs.getType() == ColorSpace.TYPE_GRAY) {
            if (jfxx == null) {
                if (onlyOne) {
                    BufferedImage thumbRGB = expandGrayThumb(thumb);
                    write(ios, thumbRGB, writer); // As part of the header
                } else {
                    writeJFXXSegment(index, thumb, ios, writer); // default
                }
            } else {
                // If this is the only one, write the header first
                if (onlyOne) {
                    write(ios, writer);
                }
                if (jfxx.code == THUMB_RGB) {
                    BufferedImage thumbRGB = expandGrayThumb(thumb);
                    writeJFXXSegment(index, thumbRGB, ios, writer);
                } else if (jfxx.code == THUMB_JPEG) {
                    jfxx.setThumbnail(thumb);
                    writer.thumbnailStarted(index);
                    jfxx.write(ios, writer)// Handles clipping if needed
View Full Code Here

    /**
     * Return an RGB image that is the expansion of the given grayscale
     * image.
     */
    private static BufferedImage expandGrayThumb(BufferedImage thumb) {
        BufferedImage ret = new BufferedImage(thumb.getWidth(),
                                              thumb.getHeight(),
                                              BufferedImage.TYPE_INT_RGB);
        Graphics g = ret.getGraphics();
        g.drawImage(thumb, 0, 0, null);
        return ret;
    }
View Full Code Here

            ColorModel cm = new ComponentColorModel(JPEG.sRGB,
                                                    false,
                                                    false,
                                                    ColorModel.OPAQUE,
                                                    DataBuffer.TYPE_BYTE);
            return new BufferedImage(cm,
                                     raster,
                                     false,
                                     null);
        }
View Full Code Here

                                                     false);
            SampleModel sm = cm.createCompatibleSampleModel(thumbWidth,
                                                            thumbHeight);
            WritableRaster raster =
                Raster.createWritableRaster(sm, buffer, null);
            return new BufferedImage(cm,
                                     raster,
                                     false,
                                     null);
        }
View Full Code Here

            iis.seek(streamPos);
            JPEGImageReader thumbReader = new JPEGImageReader(null);
            thumbReader.setInput(iis);
            thumbReader.addIIOReadProgressListener
                (new ThumbnailReadListener(reader));
            BufferedImage ret = thumbReader.read(0, null);
            thumbReader.dispose();
            iis.reset();
            return ret;
        }
View Full Code Here

TOP

Related Classes of ae.java.awt.image.BufferedImage

Copyright © 2018 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.