Package com.jgraph.gaeawt.java.awt.image

Examples of com.jgraph.gaeawt.java.awt.image.BufferedImage


        bos.write4Bytes(AlphaMask);
        bos.write(RestOfFile);
        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;
        }

        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;
        if (allAlphasZero)
        {
            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;
                    }
                    resultImage.setRGB(x, y, (alpha << 24) | (0xffffff & bmpImage.getRGB(x, y)));
                }
            }
        }
        else
            resultImage = bmpImage;
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

                        srcRowOffset += hSize;
                        dstRowOffset += sofnSegment.width;
                    }
                }
            }
            image = new BufferedImage(colorModel, raster, new Properties());
            //byte[] remainder = super.getStreamBytes(is);
            //for (int i = 0; i < remainder.length; i++)
            //{
            //    System.out.println("" + i + " = " + Integer.toHexString(remainder[i]));
            //}
View Full Code Here

        // byte imageData[] = ic.imageData;

        int width = bhi.width;
        int height = bhi.height;

        BufferedImage result = getBufferedImageFactory(params)
                .getColorBufferedImage(width, height, true);

        if (verbose)
        {
            System.out.println("width: " + width);
View Full Code Here

            int width = info.width;
            int height = info.height;

            boolean hasAlpha = false;
            BufferedImage result = getBufferedImageFactory(params)
                    .getColorBufferedImage(width, height, hasAlpha);

            info.readImage(result, is);

            return result;
View Full Code Here

{
  public void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws IOException
  {
    int type = BufferedImage.TYPE_INT_ARGB;
    BufferedImage result = new BufferedImage(500, 500, type);
    resp.setContentType("text/plain");
    resp.getWriter().println("Hello, world");
  }
View Full Code Here

    {
      ColorModel model = getColorModel();
      WritableRaster wr = getRaster();
      if (model != null && wr != null)
      {
        image = new BufferedImage(model, wr, null);
      }
    }
    return image;
  }
View Full Code Here

        // BufferedImage
        // with its actual (presumably correct) Colorspace.
        // use this when the image is mislabeled, presumably having been
        // wrongly assumed to be sRGB

        BufferedImage result = new BufferedImage(cm, bi.getRaster(), null);

        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

TOP

Related Classes of com.jgraph.gaeawt.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.