Package java.awt.image

Examples of java.awt.image.ColorConvertOp


             *                    srcBI.getHeight());
             * System.out.println("dst: " + dstBI.getWidth() + "x" +
             *                    dstBI.getHeight());
             */

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

            if (dstCM.hasAlpha())
                copyBand(srcWr, srcSM.getNumBands()-1,
                         wr,    getSampleModel().getNumBands()-1);
        }
View Full Code Here


                            if (cs == JPEG.JCS.getYCC()) {
                                if (!alpha) {
                                    if (jfif != null) {
                                        convertTosRGB = true;
                                        convertOp =
                                        new ColorConvertOp(cs,
                                                           JPEG.JCS.sRGB,
                                                           null);
                                        outCsType = JPEG.JCS_YCbCr;
                                    } else if (adobe != null) {
                                        if (adobe.transform
View Full Code Here

                            if (cs == JPEG.JCS.getYCC()) {
                                if (!alpha) {
                                    if (jfif != null) {
                                        convertTosRGB = true;
                                        convertOp =
                                        new ColorConvertOp(cs,
                                                           JPEG.JCS.sRGB,
                                                           null);
                                        outCsType = JPEG.JCS_YCbCr;
                                    } else if (adobe != null) {
                                        if (adobe.transform
View Full Code Here

            } else if ((iccCS != null) &&
                       (cm.getNumComponents() == numComponents) &&
                       (cs != iccCS)) { 
                // We have an ICC profile but it isn't used in the dest
                // image.  So convert from the profile cs to the target cs
                convert = new ColorConvertOp(iccCS, cs, null);
                // Leave IJG conversion in place; we still need it
            } else if ((iccCS == null) &&
                       (!cs.isCS_sRGB()) &&
                       (cm.getNumComponents() == numComponents)) {
                // Target isn't sRGB, so convert from sRGB to the target
                convert = new ColorConvertOp(JPEG.JCS.sRGB, cs, null);
            } else if (csType != ColorSpace.TYPE_RGB) {
                throw new IIOException("Incompatible color conversion");
            }
            break;
        case JPEG.JCS_RGBA:
            // No conversions available; image must be RGBA
            if ((csType != ColorSpace.TYPE_RGB) ||
                (cm.getNumComponents() != numComponents)) {
                throw new IIOException("Incompatible color conversion");
            }
            break;
        case JPEG.JCS_YCC:
            {
                ColorSpace YCC = JPEG.JCS.getYCC();
                if (YCC == null) { // We can't do YCC at all
                    throw new IIOException("Incompatible color conversion");
                }
                if ((cs != YCC) &&
                    (cm.getNumComponents() == numComponents)) {
                    convert = new ColorConvertOp(YCC, cs, null);
                }
            }
            break;
        case JPEG.JCS_YCCA:
            {
View Full Code Here

            srcG.setColor(colors[colors.length-1-i%colors.length]);
            srcG.fillRect(i*rw, 0, rw, rh);
        }

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

        BufferedImage dstImg =
                new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
        theOp.filter(srcImg, dstImg);

        g2.drawImage(srcImg,     10, 20, w/2-20, h-30, null);
        g2.drawImage(dstImg, w/2+10, 20, w/2-20, h-30, null);
    }
View Full Code Here

            colorFilter = null;
        }

        String grayscalePar = par.getParameter("grayscale", GRAYSCALE_DEFAULT);
        if (BooleanUtils.toBoolean(grayscalePar)){           
            grayscaleFilter = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
        } else {
            grayscaleFilter = null;
        }  
        String enlargePar = par.getParameter("allow-enlarging", ENLARGE_DEFAULT);
        enlarge = BooleanUtils.toBoolean(enlargePar);
View Full Code Here

     * A utility method to produce a gray scale {@link java.awt.image.BufferedImage}
     * @param buff
     * @return gray scale {@link java.awt.image.BufferedImage}
     */
    public static BufferedImage grayScale(BufferedImage buff){
      ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
      BufferedImage grayImage = op.filter(buff, null);
      return grayImage;
    }
View Full Code Here

     * A utility method to produce a gray scale {@link java.awt.image.BufferedImage}
     * @param buff
     * @return gray scale {@link java.awt.image.BufferedImage}
     */
    public static BufferedImage grayScale(BufferedImage buff){
      ColorConvertOp op = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
      BufferedImage grayImage = op.filter(buff, null);
      return grayImage;
    }
View Full Code Here

    if (!enabled) {
      if (!this.htImage.contains(this.getName(name, enabled))) {
        BufferedImage img = this.htImage.get(name);
       
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        ColorConvertOp op = new ColorConvertOp(cs, null);
       
        BufferedImage result = op.filter(img , null);
       
        this.htImage.put(this.getName(name , enabled) , result);
      }
      name = this.getName(name , enabled);
    }
View Full Code Here

    if (!enabled) {
      if (!this.htImage.contains(this.getName(name, enabled))) {
        BufferedImage img = this.htImage.get(name);
       
        ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
        ColorConvertOp op = new ColorConvertOp(cs, null);
       
        BufferedImage result = op.filter(img , null);
       
        this.htImage.put(this.getName(name , enabled) , result);
      }
      name = this.getName(name , enabled);
    }
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.