8 private int width, height;
10 private int transparent = 255;
28 int srcIndex, dstIndex;
29 int xSrcBase, ySrcBase;
34 r1 =
new Rectangle(srcWidth, srcHeight);
35 r1.setLocation(xloc, yloc);
36 r2 =
new Rectangle(width, height);
37 if (!r1.intersects(r2))
42 srcPixels =
new byte[size];
44 for (
int i=0; i<size; i++)
45 srcPixels[i] = (byte)(255-pixels32[i]&255);
47 for (
int i=0; i<size; i++)
48 srcPixels[i] = (byte)(pixels32[i]&255);
51 r1 = r1.intersection(r2);
52 xSrcBase = (xloc<0)?-xloc:0;
53 ySrcBase = (yloc<0)?-yloc:0;
55 for (
int y=r1.y; y<(r1.y+r1.height); y++) {
56 srcIndex = (y-yloc)*srcWidth + (r1.x-xloc);
57 dstIndex = y * width + r1.x;
60 for (
int i=r1.width; --i>=0;)
61 pixels[dstIndex++] = srcPixels[srcIndex++];
64 for (
int i=r1.width; --i>=0;)
65 pixels[dstIndex++] = (byte)(255-srcPixels[srcIndex++]&255);
68 for (
int i=r1.width; --i>=0;) {
69 src = srcPixels[srcIndex++]&255;
71 dst = pixels[dstIndex];
74 pixels[dstIndex++] = (byte)dst;
78 for (
int i=r1.width; --i>=0;) {
79 dst = (srcPixels[srcIndex++]&255)+(pixels[dstIndex]&255);
80 if (dst>255) dst = 255;
81 pixels[dstIndex++] = (byte)dst;
85 for (
int i=r1.width; --i>=0;) {
86 dst = ((srcPixels[srcIndex++]&255)+(pixels[dstIndex]&255))/2;
87 pixels[dstIndex++] = (byte)dst;
91 for (
int i=r1.width; --i>=0;) {
92 dst = (pixels[dstIndex]&255)-(srcPixels[srcIndex++]&255);
94 pixels[dstIndex++] = (byte)dst;
98 for (
int i=r1.width; --i>=0;) {
99 dst = (pixels[dstIndex]&255)-(srcPixels[srcIndex++]&255);
100 if (dst<0) dst = -dst;
101 pixels[dstIndex++] = (byte)dst;
105 for (
int i=r1.width; --i>=0;) {
106 dst = (srcPixels[srcIndex++]&255)*(pixels[dstIndex]&255);
107 if (dst>255) dst = 255;
108 pixels[dstIndex++] = (byte)dst;
112 for (
int i=r1.width; --i>=0;) {
113 src = srcPixels[srcIndex++]&255;
117 dst = (pixels[dstIndex]&255)/src;
118 pixels[dstIndex++] = (byte)dst;
122 for (
int i=r1.width; --i>=0;) {
123 dst = srcPixels[srcIndex++]&pixels[dstIndex];
124 pixels[dstIndex++] = (byte)dst;
128 for (
int i=r1.width; --i>=0;) {
129 dst = srcPixels[srcIndex++]|pixels[dstIndex];
130 pixels[dstIndex++] = (byte)dst;
134 for (
int i=r1.width; --i>=0;) {
135 dst = srcPixels[srcIndex++]^pixels[dstIndex];
136 pixels[dstIndex++] = (byte)dst;
140 for (
int i=r1.width; --i>=0;) {
141 src = srcPixels[srcIndex++]&255;
142 dst = pixels[dstIndex]&255;
143 if (src<dst) dst = src;
144 pixels[dstIndex++] = (byte)dst;
148 for (
int i=r1.width; --i>=0;) {
149 src = srcPixels[srcIndex++]&255;
150 dst = pixels[dstIndex]&255;
151 if (src>dst) dst = src;
152 pixels[dstIndex++] = (byte)dst;
157 ip.showProgress((
double)(y-r1.y)/r1.height);