8 private int width, height;
9 private short[] pixels;
25 int srcIndex, dstIndex;
26 int xSrcBase, ySrcBase;
31 r1 =
new Rectangle(srcWidth, srcHeight);
32 r1.setLocation(xloc, yloc);
33 r2 =
new Rectangle(width, height);
34 if (!r1.intersects(r2))
38 r1 = r1.intersection(r2);
39 xSrcBase = (xloc<0)?-xloc:0;
40 ySrcBase = (yloc<0)?-yloc:0;
42 for (
int y=r1.y; y<(r1.y+r1.height); y++) {
43 srcIndex = (y-yloc)*srcWidth + (r1.x-xloc);
44 dstIndex = y * width + r1.x;
47 for (
int i=r1.width; --i>=0;)
48 pixels[dstIndex++] = srcPixels[srcIndex++];
51 for (
int i=r1.width; --i>=0;) {
52 dst = (srcPixels[srcIndex++]&0xffff)+(pixels[dstIndex]&0xffff);
54 if (dst>65535) dst = 65535;
55 pixels[dstIndex++] = (short)dst;
59 for (
int i=r1.width; --i>=0;) {
60 dst = ((srcPixels[srcIndex++]&0xffff)+(pixels[dstIndex]&0xffff))/2;
61 pixels[dstIndex++] = (short)dst;
65 for (
int i=r1.width; --i>=0;) {
66 dst = (pixels[dstIndex]&0xffff)-(srcPixels[srcIndex++]&0xffff);
67 if (dst<0) dst = -dst;
68 if (dst>65535) dst = 65535;
69 pixels[dstIndex++] = (short)dst;
73 for (
int i=r1.width; --i>=0;) {
74 dst = (pixels[dstIndex]&0xffff)-(srcPixels[srcIndex++]&0xffff);
76 if (dst>65535) dst = 65535;
77 pixels[dstIndex++] = (short)dst;
81 for (
int i=r1.width; --i>=0;) {
82 dst = (srcPixels[srcIndex++]&0xffff)*(pixels[dstIndex]&0xffff);
84 if (dst>65535) dst = 65535;
85 pixels[dstIndex++] = (short)dst;
89 for (
int i=r1.width; --i>=0;) {
90 src = srcPixels[srcIndex++]&0xffff;
94 dst = pixels[dstIndex]/src;
95 pixels[dstIndex++] = (short)dst;
99 for (
int i=r1.width; --i>=0;) {
100 dst = srcPixels[srcIndex++]&pixels[dstIndex]&0xffff;
101 pixels[dstIndex++] = (short)dst;
105 for (
int i=r1.width; --i>=0;) {
106 dst = srcPixels[srcIndex++]|pixels[dstIndex];
107 pixels[dstIndex++] = (short)dst;
111 for (
int i=r1.width; --i>=0;) {
112 dst = srcPixels[srcIndex++]^pixels[dstIndex];
113 pixels[dstIndex++] = (short)dst;
117 for (
int i=r1.width; --i>=0;) {
118 src = srcPixels[srcIndex++]&0xffff;
119 dst = pixels[dstIndex]&0xffff;
120 if (src<dst) dst = src;
121 pixels[dstIndex++] = (short)dst;
125 for (
int i=r1.width; --i>=0;) {
126 src = srcPixels[srcIndex++]&0xffff;
127 dst = pixels[dstIndex]&0xffff;
128 if (src>dst) dst = src;
129 pixels[dstIndex++] = (short)dst;
134 ip.showProgress((
double)(y-r1.y)/r1.height);