131 |
public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, |
public PixelGrabber(ImageProducer ip, int x, int y, int w, int h, |
132 |
int pix[], int off, int scansize) |
int pix[], int off, int scansize) |
133 |
{ |
{ |
134 |
|
if (ip == null) |
135 |
|
throw new NullPointerException("The ImageProducer must not be null."); |
136 |
|
|
137 |
this.ip = ip; |
this.ip = ip; |
138 |
this.x = x; |
this.x = x; |
139 |
this.y = y; |
this.y = y; |
182 |
boolean forceRGB) |
boolean forceRGB) |
183 |
{ |
{ |
184 |
this.ip = img.getSource(); |
this.ip = img.getSource(); |
185 |
|
|
186 |
|
if (this.ip == null) |
187 |
|
throw new NullPointerException("The ImageProducer must not be null."); |
188 |
|
|
189 |
this.x = x; |
this.x = x; |
190 |
this.y = y; |
this.y = y; |
191 |
width = w; |
width = w; |
216 |
{ |
{ |
217 |
public void run () |
public void run () |
218 |
{ |
{ |
219 |
ip.startProduction (PixelGrabber.this); |
try |
220 |
|
{ |
221 |
|
ip.startProduction (PixelGrabber.this); |
222 |
|
} |
223 |
|
catch (Exception ex) |
224 |
|
{ |
225 |
|
ex.printStackTrace(); |
226 |
|
imageComplete(ImageConsumer.IMAGEABORTED); |
227 |
|
} |
228 |
} |
} |
229 |
}; |
}; |
230 |
grabberThread.start (); |
grabberThread.start (); |
616 |
consumerStatus = status; |
consumerStatus = status; |
617 |
setObserverStatus (); |
setObserverStatus (); |
618 |
grabbing = false; |
grabbing = false; |
619 |
ip.removeConsumer (this); |
if (ip != null) |
620 |
|
ip.removeConsumer (this); |
621 |
|
|
622 |
notifyAll (); |
notifyAll (); |
623 |
} |
} |