Package com.google.code.appengine.awt.image

Examples of com.google.code.appengine.awt.image.BufferedImage


                                 1,
                                 DataBuffer.TYPE_BYTE);
        }
       
        case BufferedImage.TYPE_BYTE_INDEXED: {
            BufferedImage bufferedImage = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_INDEXED);
            IndexColorModel colorModel = (IndexColorModel) bufferedImage.getColorModel();
            byte[] redLUT = new byte[256];
            byte[] greenLUT = new byte[256];
            byte[] blueLUT = new byte[256];
            byte[] alphaLUT = new byte[256];
           
View Full Code Here


        }
        return new ImageTypeSpecifier(image);
    }

    public int getBufferedImageType() {
        BufferedImage bufferedImage = createBufferedImage(1, 1);
        return bufferedImage.getType();
    }
View Full Code Here

        }
       
        SampleModel sm = sampleModel.createCompatibleSampleModel(width, height);
        WritableRaster writableRaster = Raster.createWritableRaster(sm, new Point(0, 0));
       
        return new BufferedImage(colorModel, writableRaster, colorModel.isAlphaPremultiplied(), new Hashtable());
    }
View Full Code Here

    IcnsContents contents = readImage(byteSource);
    ArrayList images = IcnsDecoder.decodeAllImages(contents.icnsElements);
    if (images.isEmpty())
      throw new ImageReadException("No icons in ICNS file");
    BufferedImage image0 = (BufferedImage) images.get(0);
    return new ImageInfo("Icns", 32, new ArrayList(), ImageFormat.IMAGE_FORMAT_ICNS,
        "ICNS Apple Icon Image", image0.getHeight(), "image/x-icns", images.size(),
        0, 0, 0, 0, image0.getWidth(), false, true, false, ImageInfo.COLOR_TYPE_RGB,
        ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN);
  }
View Full Code Here

    IcnsContents contents = readImage(byteSource);
    ArrayList images = IcnsDecoder.decodeAllImages(contents.icnsElements);
    if (images.isEmpty())
      throw new ImageReadException("No icons in ICNS file");
    BufferedImage image0 = (BufferedImage) images.get(0);
    return new Dimension(image0.getWidth(), image0.getHeight());
  }
View Full Code Here

        bos.write4Bytes(ColorsImportant);
        bos.write(iconData, 40, iconData.length - 40);
        bos.flush();

        ByteArrayInputStream bmpInputStream = new ByteArrayInputStream(baos.toByteArray());
        BufferedImage bmpImage = new BmpImageParser().getBufferedImage(bmpInputStream, null);

        // Transparency map is optional with 32 BPP icons, because they already have
        // an alpha channel, and Windows only uses the transparency map when it has to
        // display the icon on a < 32 BPP screen. But it's still used instead of alpha
        // if the image would be completely transparent with alpha...
        int t_scanline_size = (Width + 7) / 8;
        if ((t_scanline_size % 4) != 0)
            t_scanline_size += 4 - (t_scanline_size % 4); // pad scanline to 4 byte size.
        int tcolor_map_size_bytes = t_scanline_size * (Height/2);
        byte[] transparency_map = null;
        try
        {
            transparency_map = this.readByteArray("transparency_map",
                    tcolor_map_size_bytes, bmpInputStream, "Not a Valid ICO File");
        }
        catch (IOException ioEx)
        {
            if (BitCount != 32)
            throw ioEx;
        }

        // FIXME: get BmpImageParser to support alpha, then uncomment below
//        boolean allAlphasZero = true;
//        if (BitCount == 32)
//        {
//            for (int y = 0; allAlphasZero && y < bmpImage.getHeight(); y++)
//            {
//                for (int x = 0; x < bmpImage.getWidth(); x++)
//                {
//                    if ((bmpImage.getRGB(x, y) & 0xff000000) != 0)
//                    {
//                        allAlphasZero = false;
//                        break;
//                    }
//                }
//            }
//        }
        BufferedImage resultImage = new BufferedImage(bmpImage.getWidth(), bmpImage.getHeight(),
                BufferedImage.TYPE_INT_ARGB);
        for (int y = 0; y < resultImage.getHeight(); y++)
        {
            for (int x = 0; x < resultImage.getWidth(); x++)
            {
                int alpha = 0xff;
                if (transparency_map != null)
                {
                    int alpha_byte = 0xff & transparency_map[t_scanline_size
                            * (bmpImage.getHeight() - y - 1) + (x / 8)];
                    alpha = 0x01 & (alpha_byte >> (7 - (x % 8)));
                    alpha = (alpha == 0) ? 0xff : 0x00;
                }
                // FIXME: get the BMP decoder to support alpha, then uncomment below
                //if (BitCount < 32 || allAlphasZero)
                    resultImage.setRGB(x, y, (alpha << 24) | (0xffffff & bmpImage.getRGB(x, y)));
            }
        }
        return new BitmapIconData(fIconInfo, header, resultImage);
    }
View Full Code Here

            throws ImageReadException, IOException
    {
        ImageFormat imageFormat = Sanselan.guessFormat(iconData);
        if (imageFormat.equals(ImageFormat.IMAGE_FORMAT_PNG))
        {
            BufferedImage bufferedImage = Sanselan.getBufferedImage(iconData);
            PNGIconData pngIconData = new PNGIconData(fIconInfo, bufferedImage);
            return pngIconData;
        }
        else
        {
View Full Code Here

        FileHeader fileHeader = contents.fileHeader;
        for (int i = 0; i < fileHeader.iconCount; i++)
        {
            IconData iconData = contents.iconDatas[i];

            BufferedImage image = iconData.readBufferedImage();

            result.add(image);
        }

        return result;
View Full Code Here

{
    public BufferedImage getColorBufferedImage(int width, int height,
            boolean hasAlpha)
    {
        if (hasAlpha)
            return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        return new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    }
View Full Code Here

    }

    public ArrayList getAllBufferedImages(ByteSource byteSource)
            throws ImageReadException, IOException
    {
        BufferedImage bi = getBufferedImage(byteSource, null);

        ArrayList result = new ArrayList();

        result.add(bi);
View Full Code Here

TOP

Related Classes of com.google.code.appengine.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.