Package java.awt.image

Examples of java.awt.image.BandCombineOp.filter()


                matrix[3][3] = 1; // Alpha
                break;
            }
            Raster srcRas = src.getData(wr.getBounds());
            BandCombineOp op = new BandCombineOp(matrix, null);
            op.filter(srcRas, wr);
        } else {
            ColorModel dstCM = getColorModel();
            if (srcCM.getColorSpace() == dstCM.getColorSpace()) {
                // No transform needed, just reformat data...
                // System.out.println("Bypassing");
View Full Code Here


            // System.out.println("src: " + srcBI.getWidth() + "x" +
            //                    srcBI.getHeight());

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

            // System.out.println("After filter:");
           
            WritableRaster wr00 = wr.createWritableTranslatedChild(0,0);
            for (int i=0; i<dstCM.getColorSpace().getNumComponents(); i++)
View Full Code Here

                matrix[0][0] = 1;
            }

            Raster srcRas = src.getData(wr.getBounds());
            BandCombineOp op = new BandCombineOp(matrix, null);
            op.filter(srcRas, wr);
        } else {
            Raster         srcRas = src.getData(wr.getBounds());
            WritableRaster srcWr  = (WritableRaster)srcRas;

            // Divide out alpha if we have it.  We need to do this since
View Full Code Here

                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

                    BufferedImage mask;
                    mask = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_ARGB);
                    float[][] matrix = new float[][]{{0, 0, 0, 0}, {0, 0, 0, 0},
                        {0, 0, 0, 0}, {0.299f, 0.587f, 0.114f, 0}};
                    BandCombineOp bandOp = new BandCombineOp(matrix, null);
                    bandOp.filter(src.getRaster(), mask.getRaster());
                    src = mask;
                }
            }
            Composite composite = findComposite(op);
            graphics.setComposite(composite);
View Full Code Here

            // Mostly just a hack. Ignores numberColors and more.
            // TODO What should the alpha be? And even for this, why does 255 work? Shouldn't it be 1?
            float[][] matrix = new float[][]{{0.299f, 0.587f, 0.114f, 0},
                {0.299f, 0.587f, 0.114f, 0}, {0.299f, 0.587f, 0.114f, 0}, {0, 0, 0, 255}};
            BandCombineOp bandOp = new BandCombineOp(matrix, null);
            bandOp.filter(getImage().getRaster(), result.getImage().getRaster());
        } else {
            // Um, obviously wrong here.
            result.composite(this, 0, 0, CompositeOperator.OVER);
        }
        result.setFormat(this.getFormat());
View Full Code Here

        BufferedImage srcBI = new BufferedImage(cm,
                                                srcWR,
                                                cm.isAlphaPremultiplied(),
                                                null);*/

        WritableRaster dstWR = op.filter(srcWR, srcWR);

        BufferedImage dstBI = new BufferedImage(cm,
                                                dstWR,
                                                cm.isAlphaPremultiplied(),
                                                null);
View Full Code Here

                matrix[0][0] = 1;
            }

            Raster srcRas = src.getData(wr.getBounds());
            BandCombineOp op = new BandCombineOp(matrix, null);
            op.filter(srcRas, wr);
        } else {
            // REVIEW: Alpha handling may not be correct through here.
            // Since the colorconversion may not be a linear op it
            // is probably required to divide out the alpha before
            // doing the color conversion.
View Full Code Here

                 new int [] {8}, false, false,
                 Transparency.OPAQUE,
                 DataBuffer.TYPE_BYTE);

            dstBI = new BufferedImage(cmna, dstWr, false, null);
            op.filter(srcBI, dstBI);

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

                matrix[3][3] = 1; // Alpha
                break;
            }
            Raster srcRas = src.getData(wr.getBounds());
            BandCombineOp op = new BandCombineOp(matrix, null);
            op.filter(srcRas, wr);
            return wr;
        }

        if (srcCM.getColorSpace() ==
            ColorSpace.getInstance(ColorSpace.CS_GRAY)) {
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.