Package java.awt.image

Examples of java.awt.image.ColorModel.createCompatibleWritableRaster()


            final PixelGrabber grabber =
                new PixelGrabber(image, 0, 0, image.getWidth(null), image.getHeight(null), true);
            if (grabber.grabPixels()) {
                final int w = grabber.getWidth();
                final int h = grabber.getHeight();
                final WritableRaster raster = dstModel.createCompatibleWritableRaster(w, h);
                final int[] pixels = (int[]) grabber.getPixels();
                Object dataElems = null;
                for (int y = 0; y < h; y++) {
                    final int ofsY = y * w;
                    for (int x = 0; x < w; x++) {
View Full Code Here


        //todo optimize
        final ColorModel dst_model = surface.getColorModel();
        final int[] samples = new int[4];
        final int w = raster.getWidth();
        final int h = raster.getHeight();
        final WritableRaster dst_raster = dst_model.createCompatibleWritableRaster(w, h);

        if (dst_model instanceof DirectColorModel)
            if (model instanceof DirectColorModel) {
                for (int y = 0; y < h; y++)
                    for (int x = 0; x < w; x++)
View Full Code Here

        //todo optimize
        final ColorModel dst_model = surface.getColorModel();
        final int[] samples = new int[4];
        final int w = raster.getWidth();
        final int h = raster.getHeight();
        final WritableRaster dst_raster = dst_model.createCompatibleWritableRaster(w, h);

        if (dst_model instanceof DirectColorModel)
            if (model instanceof ComponentColorModel) {
                for (int y = 0; y < h; y++)
                    for (int x = 0; x < w; x++)
View Full Code Here

   *         of <code>image</code>
   */
  public static BufferedImage createColorModelCompatibleImage(final BufferedImage image) {
    final ColorModel cm = image.getColorModel();
    //noinspection UndesirableClassUsage
    return new BufferedImage(cm, cm.createCompatibleWritableRaster(image.getWidth(), image.getHeight()), cm.isAlphaPremultiplied(), null);
  }


  /**
   * <p>Returns a new compatible image with the same width, height and
View Full Code Here

        if (cmt == null) {
            // awt.18=Transparency is not supported.
            throw new IllegalArgumentException(Messages.getString("awt.18")); //$NON-NLS-1$
        }

        return new BufferedImage(cmt, cmt.createCompatibleWritableRaster(width, height), false, null);
    }

    @Override
    public ColorModel getColorModel() {
        return cm;
View Full Code Here

            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            ColorModel cm = gc.getColorModel(Transparency.OPAQUE);
            WritableRaster wr = cm.createCompatibleWritableRaster(width, height);
            Image image = new BufferedImage(cm, wr, cm.isAlphaPremultiplied(), null);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
View Full Code Here

            int w = argbWR.getWidth();
            int h = argbWR.getHeight();
            int minX = argbWR.getMinX();
            int minY = argbWR.getMinY();
            WritableRaster srcWR =
                imgCM.createCompatibleWritableRaster(w, h);
            srcWR = srcWR.createWritableTranslatedChild(minX, minY);
            img.copyData(srcWR);

            /**
             * If the source data is not a ComponentColorModel using a
View Full Code Here

            int w = argbWR.getWidth();
            int h = argbWR.getHeight();
            int minX = argbWR.getMinX();
            int minY = argbWR.getMinY();
            WritableRaster srcWR =
                imgCM.createCompatibleWritableRaster(w, h);
            srcWR = srcWR.createWritableTranslatedChild(minX, minY);
            img.copyData(srcWR);

            /**
             * If the source data is not a ComponentColorModel using a
View Full Code Here

    else
    {
      final ColorModel cm = img.getColorModel();
      final int width = img.getWidth();
      final int height = img.getHeight();
      final WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
      final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
      final Hashtable properties = new Hashtable();
      final String[] keys = img.getPropertyNames();
      if (keys != null)
      {
View Full Code Here

    else
    {
      final ColorModel cm = img.getColorModel();
      final int width = img.getWidth();
      final int height = img.getHeight();
      final WritableRaster raster = cm.createCompatibleWritableRaster(width, height);
      final boolean isAlphaPremultiplied = cm.isAlphaPremultiplied();
      final Hashtable properties = new Hashtable();
      final String[] keys = img.getPropertyNames();
      if (keys != null)
      {
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.