8 public static float divideByZeroValue;
11 private int width, height;
12 private float[] pixels;
15 divideByZeroValue = (float)
Prefs.
getDouble(
Prefs.DIV_BY_ZERO_VALUE, Float.POSITIVE_INFINITY);
16 if (divideByZeroValue==Float.MAX_VALUE)
17 divideByZeroValue = Float.POSITIVE_INFINITY;
34 int srcIndex, dstIndex;
35 int xSrcBase, ySrcBase;
42 r1 =
new Rectangle(srcWidth, srcHeight);
43 r1.setLocation(xloc, yloc);
44 r2 =
new Rectangle(width, height);
45 if (!r1.intersects(r2))
48 r1 = r1.intersection(r2);
49 xSrcBase = (xloc<0)?-xloc:0;
50 ySrcBase = (yloc<0)?-yloc:0;
51 boolean useDBZValue = !Float.isInfinite(divideByZeroValue);
53 for (
int y=r1.y; y<(r1.y+r1.height); y++) {
54 srcIndex = (y-yloc)*srcWidth + (r1.x-xloc);
55 dstIndex = y * width + r1.x;
58 for (
int i=r1.width; --i>=0;)
59 pixels[dstIndex++] = srcPixels[srcIndex++];
62 for (
int i=r1.width; --i>=0; srcIndex++, dstIndex++)
63 pixels[dstIndex] = srcPixels[srcIndex]+pixels[dstIndex];
66 for (
int i=r1.width; --i>=0;) {
67 dst =(srcPixels[srcIndex++]+pixels[dstIndex])/2;
68 pixels[dstIndex++] = dst;
72 for (
int i=r1.width; --i>=0; srcIndex++, dstIndex++) {
73 dst = pixels[dstIndex]-srcPixels[srcIndex];
74 pixels[dstIndex] = dst<0?-dst:dst;
78 for (
int i=r1.width; --i>=0; srcIndex++, dstIndex++)
79 pixels[dstIndex] = pixels[dstIndex]-srcPixels[srcIndex];
82 for (
int i=r1.width; --i>=0; srcIndex++, dstIndex++)
83 pixels[dstIndex] = srcPixels[srcIndex]*pixels[dstIndex];
86 for (
int i=r1.width; --i>=0; srcIndex++, dstIndex++) {
87 src = srcPixels[srcIndex];
88 if (useDBZValue && src==0.0)
89 pixels[dstIndex] = divideByZeroValue;
91 pixels[dstIndex] = pixels[dstIndex]/src;
97 for (
int i=r1.width; --i>=0;) {
98 src = srcPixels[srcIndex++];
99 dst = pixels[dstIndex];
100 if (src<dst) dst = src;
101 pixels[dstIndex++] = dst;
105 for (
int i=r1.width; --i>=0;) {
106 src = srcPixels[srcIndex++];
107 dst = pixels[dstIndex];
108 if (src>dst) dst = src;
109 pixels[dstIndex++] = dst;
114 ip.showProgress((
double)(y-r1.y)/r1.height);