19 static final int OUTLINE=0;
21 void process(
int type,
int count) {
22 int p1, p2, p3, p4, p5, p6, p7, p8, p9;
23 int inc = roiHeight/25;
31 int rowOffset = width;
32 for (
int y=yMin; y<=yMax; y++) {
33 offset = xMin + y * width;
34 p2 = pixels2[offset-rowOffset-1]&0xff;
35 p3 = pixels2[offset-rowOffset]&0xff;
36 p5 = pixels2[offset-1]&0xff;
37 p6 = pixels2[offset]&0xff;
38 p8 = pixels2[offset+rowOffset-1]&0xff;
39 p9 = pixels2[offset+rowOffset]&0xff;
41 for (
int x=xMin; x<=xMax; x++) {
43 p3 = pixels2[offset-rowOffset+1]&0xff;
45 p6 = pixels2[offset+1]&0xff;
47 p9 = pixels2[offset+rowOffset+1]&0xff;
53 if (!(p1==bgColor || p2==bgColor || p3==bgColor || p4==bgColor
54 || p6==bgColor || p7==bgColor || p8==bgColor || p9==bgColor))
60 pixels[offset++] = (byte)v;
63 parent.showProgress((
double)(y-roiY)/roiHeight);
65 parent.hideProgress();
81 {0,0,0,1,0,0,1,3,0,0,3,1,1,0,1,3,0,0,0,0,0,0,0,0,2,0,2,0,3,0,3,3,
82 0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,3,0,2,2,
83 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
84 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,3,0,2,0,
85 0,0,3,1,0,0,1,3,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
86 3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
87 2,3,1,3,0,0,1,3,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
88 2,3,0,1,0,0,0,1,0,0,0,0,0,0,0,0,3,3,0,1,0,0,0,0,2,2,0,0,2,0,0,0};
98 if (roiWidth==width) {
moveTo(width-1,0);
lineTo(width-1,height-1);}
99 if (roiHeight==height) {
moveTo(0,height-1);
lineTo(width,height-1);}
102 pixelsRemoved = thin(pass++, table);
105 pixelsRemoved = thin(pass++, table);
107 }
while (pixelsRemoved>0);
111 int thin(
int pass,
int[] table) {
112 int p1, p2, p3, p4, p5, p6, p7, p8, p9;
113 int inc = roiHeight/25;
121 int offset, rowOffset = width;
122 int pixelsRemoved = 0;
124 for (
int y=yMin; y<=yMax; y++) {
125 offset = xMin + y * width;
126 for (
int x=xMin; x<=xMax; x++) {
127 p5 = pixels2[offset]&0xff;
130 p1 = pixels2[offset-rowOffset-1]&0xff;
131 p2 = pixels2[offset-rowOffset]&0xff;
132 p3 = pixels2[offset-rowOffset+1]&0xff;
133 p4 = pixels2[offset-1]&0xff;
134 p6 = pixels2[offset+1]&0xff;
135 p7 = pixels2[offset+rowOffset-1]&0xff;
136 p8 = pixels2[offset+rowOffset]&0xff;
137 p9 = pixels2[offset+rowOffset+1]&0xff;
139 if (p1!=bgColor) index |= 1;
140 if (p2!=bgColor) index |= 2;
141 if (p3!=bgColor) index |= 4;
142 if (p6!=bgColor) index |= 8;
143 if (p9!=bgColor) index |= 16;
144 if (p8!=bgColor) index |= 32;
145 if (p7!=bgColor) index |= 64;
146 if (p4!=bgColor) index |= 128;
149 if (code==2 || code==3) {
154 if (code==1 || code==3) {
160 pixels[offset++] = (byte)v;
163 showProgress((
double)(y-roiY)/roiHeight);
166 return pixelsRemoved;
169 public void outline() {