< prev index next >

src/java.desktop/share/classes/sun/awt/image/OffScreenImageSource.java

Print this page




 170             ColorModel newcm = ColorModel.getRGBdefault();
 171             theConsumer.setColorModel(newcm);
 172 
 173             for (int y=0; y < height; y++) {
 174                 for (int x=0; x < width; x++) {
 175                     scanline[x] = image.getRGB(x, y);
 176                 }
 177                 theConsumer.setPixels(0, y, width, 1, newcm, scanline, 0,
 178                                       width);
 179             }
 180         }
 181     }
 182 
 183     private void produce() {
 184         try {
 185             theConsumer.setDimensions(image.getWidth(), image.getHeight());
 186             theConsumer.setProperties(properties);
 187             sendPixels();
 188             theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
 189 


 190             try {
 191                 theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
 192             } catch (RuntimeException e) {
 193                 // We did not previously call this method here and
 194                 // some image consumer filters were not prepared for it to be
 195                 // called at this time. We allow them to have runtime issues
 196                 // for this one call only without triggering the IMAGEERROR
 197                 // condition below.
 198                 e.printStackTrace();
 199             }
 200 
 201         } catch (NullPointerException e) {
 202             e.printStackTrace();
 203 
 204             if (theConsumer != null) {
 205                 theConsumer.imageComplete(ImageConsumer.IMAGEERROR);
 206             }
 207         }
 208     }
 209 }


 170             ColorModel newcm = ColorModel.getRGBdefault();
 171             theConsumer.setColorModel(newcm);
 172 
 173             for (int y=0; y < height; y++) {
 174                 for (int x=0; x < width; x++) {
 175                     scanline[x] = image.getRGB(x, y);
 176                 }
 177                 theConsumer.setPixels(0, y, width, 1, newcm, scanline, 0,
 178                                       width);
 179             }
 180         }
 181     }
 182 
 183     private void produce() {
 184         try {
 185             theConsumer.setDimensions(image.getWidth(), image.getHeight());
 186             theConsumer.setProperties(properties);
 187             sendPixels();
 188             theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
 189 
 190             // If 'theconsumer' has not unregistered itself after previous call
 191             if (theConsumer != null) {
 192                 try {
 193                     theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
 194                 } catch (RuntimeException e) {
 195                     // We did not previously call this method here and
 196                     // some image consumer filters were not prepared for it to be
 197                     // called at this time. We allow them to have runtime issues
 198                     // for this one call only without triggering the IMAGEERROR
 199                     // condition below.
 200                     e.printStackTrace();
 201                 }
 202             }
 203         } catch (NullPointerException e) {
 204             e.printStackTrace();
 205 
 206             if (theConsumer != null) {
 207                 theConsumer.imageComplete(ImageConsumer.IMAGEERROR);
 208             }
 209         }
 210     }
 211 }
< prev index next >