67 if (d == null) { 68 throw new NullPointerException("Destination color model cannot be null"); 69 } 70 srcCM = s; 71 dstCM = d; 72 this.composite = xc; 73 this.comptype = CompositeType.Xor; 74 } 75 76 /** 77 * Release resources allocated for context. 78 */ 79 public void dispose() { 80 } 81 82 /** 83 * This method composes the two source tiles 84 * and places the result in the destination tile. Note that 85 * the destination can be the same object as either 86 * the first or second source. 87 * @param src1 The first source tile for the compositing operation. 88 * @param src2 The second source tile for the compositing operation. 89 * @param dst The tile where the result of the operation is stored. 90 */ 91 public void compose(Raster srcArg, Raster dstIn, WritableRaster dstOut) { 92 WritableRaster src; 93 int w; 94 int h; 95 96 if (dstIn != dstOut) { 97 dstOut.setDataElements(0, 0, dstIn); 98 } 99 100 // REMIND: We should be able to create a SurfaceData from just 101 // a non-writable Raster and a ColorModel. Since we need to 102 // create a SurfaceData from a BufferedImage then we need to 103 // make a WritableRaster since it is needed to construct a 104 // BufferedImage. 105 if (srcArg instanceof WritableRaster) { 106 src = (WritableRaster) srcArg; 107 } else { 108 src = srcArg.createCompatibleWritableRaster(); 109 src.setDataElements(0, 0, srcArg); | 67 if (d == null) { 68 throw new NullPointerException("Destination color model cannot be null"); 69 } 70 srcCM = s; 71 dstCM = d; 72 this.composite = xc; 73 this.comptype = CompositeType.Xor; 74 } 75 76 /** 77 * Release resources allocated for context. 78 */ 79 public void dispose() { 80 } 81 82 /** 83 * This method composes the two source tiles 84 * and places the result in the destination tile. Note that 85 * the destination can be the same object as either 86 * the first or second source. 87 * @param srcArg The first source tile for the compositing operation. 88 * @param dstIn The second source tile for the compositing operation. 89 * @param dstOut The tile where the result of the operation is stored. 90 */ 91 public void compose(Raster srcArg, Raster dstIn, WritableRaster dstOut) { 92 WritableRaster src; 93 int w; 94 int h; 95 96 if (dstIn != dstOut) { 97 dstOut.setDataElements(0, 0, dstIn); 98 } 99 100 // REMIND: We should be able to create a SurfaceData from just 101 // a non-writable Raster and a ColorModel. Since we need to 102 // create a SurfaceData from a BufferedImage then we need to 103 // make a WritableRaster since it is needed to construct a 104 // BufferedImage. 105 if (srcArg instanceof WritableRaster) { 106 src = (WritableRaster) srcArg; 107 } else { 108 src = srcArg.createCompatibleWritableRaster(); 109 src.setDataElements(0, 0, srcArg); |