逻辑运算符和两个图像之间

时间:2014-05-19 16:49:03

标签: java

我有这种方法对两个图像之间的逻辑AND操作,结果应该是第三个图像与部分共同,但它创建一个空白图像,为什么?

public BufferedImage Caland ( BufferedImage image1 , BufferedImage image2 , image3 BufferedImage , int height , int width ) {

        int argb1 , argb2 ;
        int a1, r1, g1 , b1 ;
        int a2, r2, g2 , b2 ;
        aand int , rand , Ghent, bAnd ;
        and int ;
        for (int y = 0; y < height ; y + +) {
            for (int x = 0; x < width; x + +) {
                argb1 image1.getRGB = (x, y ) ;
                argb2 image2.getRGB = (x, y ) ;

                a1 = ( argb1 >> 24 ) & 0xFF ;
                r1 = ( argb1 >> 16) & 0xFF ;
                g1 = ( argb1 >> 8 ) & 0xFF ;
                b1 = ( argb1 ) & 0xFF ;

                a2 = ( argb2 >> 24 ) & 0xFF ;
                r2 = ( argb2 >> 16) & 0xFF ;
                g2 = ( argb2 >> 8 ) & 0xFF ;
                b2 = ( argb2 ) & 0xFF ;

                aand = a1 & a2 ;
                rand = r1 & r2 ;
                Ghent & g1 = g2 ;
                bAnd = b1 & b2 ;
               
                and = ( aand << 24) & ( Rand << 16 ) & ( Ghent << 8 ) & aand ;
                image3.setRGB (x, y , and) ;
            }
        }
        return image3 ;
    }
    }

由于

0 个答案:

没有答案