Package java.awt.image

Examples of java.awt.image.ColorConvertOp


    }
   
    private void grayscale() {
        img = picture.getImage();
        BufferedImage src = Utilities.toBufferedImage(new DcImageIcon(img));
        BufferedImageOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
        update(op, src);
    }
View Full Code Here


  // directly calling the ColorConvert operation fails for unknown reasons ?!
  public PlanarImage toDirectColorModel(RenderedImage img) {
    BufferedImage dest = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
    BufferedImage source = new BufferedImage(img.getColorModel(), (WritableRaster) img.getData(), img
        .getColorModel().isAlphaPremultiplied(), null);
    ColorConvertOp op = new ColorConvertOp(null);
    op.filter(source, dest);
    return PlanarImage.wrapRenderedImage(dest);
  }
View Full Code Here

  // directly calling the ColorConvert operation fails for unknown reasons ?!
  public PlanarImage toDirectColorModel(RenderedImage img) {
    BufferedImage dest = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
    BufferedImage source = new BufferedImage(img.getColorModel(), (WritableRaster) img.getData(), img
        .getColorModel().isAlphaPremultiplied(), null);
    ColorConvertOp op = new ColorConvertOp(null);
    op.filter(source, dest);
    return PlanarImage.wrapRenderedImage(dest);
  }
View Full Code Here

        hints.put(RenderingHints.KEY_COLOR_RENDERING,
                RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        hints.put(RenderingHints.KEY_DITHERING,
                RenderingHints.VALUE_DITHER_ENABLE);

        ColorConvertOp op = new ColorConvertOp(from, to, hints);

        BufferedImage result = op.filter(bi, null);

        result = relabelColorSpace(result, to);

        return result;
    }
View Full Code Here

        // dumpColorSpace("\tcs_sRGB", cs_sRGB);
        // dumpColorSpace("\tColorModel.getRGBdefaultc",
        // ColorModel.getRGBdefault().getColorSpace());

        bi = relabelColorSpace(bi, from);
        ColorConvertOp op = new ColorConvertOp(from, to, hints);
        bi = op.filter(bi, null);

        bi = relabelColorSpace(bi, from);

        bi = op.filter(bi, null);

        bi = relabelColorSpace(bi, to);

        return bi;
View Full Code Here

        hints.put(RenderingHints.KEY_COLOR_RENDERING,
                RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        hints.put(RenderingHints.KEY_DITHERING,
                RenderingHints.VALUE_DITHER_ENABLE);

        ColorConvertOp op = new ColorConvertOp(from, to, hints);

        bi = relabelColorSpace(bi, from);

        BufferedImage result = op.filter(bi, null);

        result = relabelColorSpace(result, to);

        return result;
    }
View Full Code Here

        // the following code is by David Ekholm from the GrayscaleFilter
        final Graphics2D g = bi.createGraphics();
        final RenderingHints rhs = g.getRenderingHints();

        final ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        final ColorConvertOp theOp = new ColorConvertOp(cs, rhs);

        final BufferedImage dstImg = new BufferedImage(bi.getWidth(), bi.getHeight(), bi.getType());
        theOp.filter(bi, dstImg);

        return dstImg;
    }
View Full Code Here

        return dstImg;
    }

    private BufferedImage convertType(BufferedImage src, int type) {
        ColorConvertOp cco = new ColorConvertOp(null);
        BufferedImage dest = new BufferedImage(src.getWidth(), src.getHeight(), type);
        cco.filter(src, dest);
        return dest;
    }
View Full Code Here

  }

  ArrayList hashcode = new ArrayList(2);
  hashcode.add(0, src);
  hashcode.add(1, dst);
  ColorConvertOp op = (ColorConvertOp)colorConvertOpBuf.get(hashcode);

  if (op == null) {
      op = new ColorConvertOp(src, dst, null);
      colorConvertOpBuf.put(hashcode, op);
  }

  return op;
    }
View Full Code Here

                     DataBuffer.TYPE_BYTE);

                dstBI = new BufferedImage(cmna, dstWr, false, null);
            }

            ColorConvertOp op = new ColorConvertOp(null);
            op.filter(srcBI, dstBI);

            // I never have to 'fix' alpha premult since I take
            // it's value from my source....
            if (dstCM.hasAlpha())
                copyBand(srcWr, sm.getNumBands()-1,
View Full Code Here

TOP

Related Classes of java.awt.image.ColorConvertOp

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.