Java Code Examples for java.awt.image.ImageConsumer#setPixels()
The following examples show how to use
java.awt.image.ImageConsumer#setPixels() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryImageSource.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 2
Source File: MemoryImageSource.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 3
Source File: MemoryImageSource.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 4
Source File: MemoryImageSource.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 5
Source File: ARGBImageProducer.java From pumpernickel with MIT License | 5 votes |
public void startProduction(ImageConsumer c) { addConsumer(c); int w = i.getWidth(); int[] data = new int[w]; c.setDimensions(w, i.getHeight()); int y = 0; while (i.isDone() == false) { i.next(data); c.setPixels(0, y, w, 1, cm, data, 0, 1); y++; } c.imageComplete(ImageConsumer.STATICIMAGEDONE); }
Example 6
Source File: MemoryImageSource.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 7
Source File: MemoryImageSource.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 8
Source File: MemoryImageSource.java From hottub with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 9
Source File: MemoryImageSource.java From Java8CN with Apache License 2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 10
Source File: MemoryImageSource.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 11
Source File: MemoryImageSource.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 12
Source File: MemoryImageSource.java From Bytecoder with Apache License 2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 13
Source File: MemoryImageSource.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 14
Source File: MemoryImageSource.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 15
Source File: MemoryImageSource.java From JDKSourceCode1.8 with MIT License | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 16
Source File: MemoryImageSource.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 17
Source File: MemoryImageSource.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 18
Source File: MemoryImageSource.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void sendPixels(ImageConsumer ic, int x, int y, int w, int h) { int off = pixeloffset + pixelscan * y + x; if (isConsumer(ic)) { if (pixels instanceof byte[]) { ic.setPixels(x, y, w, h, model, ((byte[]) pixels), off, pixelscan); } else { ic.setPixels(x, y, w, h, model, ((int[]) pixels), off, pixelscan); } } }
Example 19
Source File: RenderableImageProducer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * The runnable method for this class. This will produce an image using * the current RenderableImage and RenderContext and send it to all the * ImageConsumer currently registered with this class. */ public void run() { // First get the rendered image RenderedImage rdrdImage; if (rc != null) { rdrdImage = rdblImage.createRendering(rc); } else { rdrdImage = rdblImage.createDefaultRendering(); } // And its ColorModel ColorModel colorModel = rdrdImage.getColorModel(); Raster raster = rdrdImage.getData(); SampleModel sampleModel = raster.getSampleModel(); DataBuffer dataBuffer = raster.getDataBuffer(); if (colorModel == null) { colorModel = ColorModel.getRGBdefault(); } int minX = raster.getMinX(); int minY = raster.getMinY(); int width = raster.getWidth(); int height = raster.getHeight(); Enumeration<ImageConsumer> icList; ImageConsumer ic; // Set up the ImageConsumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setDimensions(width,height); ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES | ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME); } // Get RGB pixels from the raster scanline by scanline and // send to consumers. int pix[] = new int[width]; int i,j; int numBands = sampleModel.getNumBands(); int tmpPixel[] = new int[numBands]; for (j = 0; j < height; j++) { for(i = 0; i < width; i++) { sampleModel.getPixel(i, j, tmpPixel, dataBuffer); pix[i] = colorModel.getDataElement(tmpPixel, 0); } // Now send the scanline to the Consumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setPixels(0, j, width, 1, colorModel, pix, 0, width); } } // Now tell the consumers we're done. icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } }
Example 20
Source File: RenderableImageProducer.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * The runnable method for this class. This will produce an image using * the current RenderableImage and RenderContext and send it to all the * ImageConsumer currently registered with this class. */ public void run() { // First get the rendered image RenderedImage rdrdImage; if (rc != null) { rdrdImage = rdblImage.createRendering(rc); } else { rdrdImage = rdblImage.createDefaultRendering(); } // And its ColorModel ColorModel colorModel = rdrdImage.getColorModel(); Raster raster = rdrdImage.getData(); SampleModel sampleModel = raster.getSampleModel(); DataBuffer dataBuffer = raster.getDataBuffer(); if (colorModel == null) { colorModel = ColorModel.getRGBdefault(); } int minX = raster.getMinX(); int minY = raster.getMinY(); int width = raster.getWidth(); int height = raster.getHeight(); Enumeration<ImageConsumer> icList; ImageConsumer ic; // Set up the ImageConsumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setDimensions(width,height); ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT | ImageConsumer.COMPLETESCANLINES | ImageConsumer.SINGLEPASS | ImageConsumer.SINGLEFRAME); } // Get RGB pixels from the raster scanline by scanline and // send to consumers. int[] pix = new int[width]; int i,j; int numBands = sampleModel.getNumBands(); int[] tmpPixel = new int[numBands]; for (j = 0; j < height; j++) { for(i = 0; i < width; i++) { sampleModel.getPixel(i, j, tmpPixel, dataBuffer); pix[i] = colorModel.getDataElement(tmpPixel, 0); } // Now send the scanline to the Consumers icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.setPixels(0, j, width, 1, colorModel, pix, 0, width); } } // Now tell the consumers we're done. icList = ics.elements(); while (icList.hasMoreElements()) { ic = icList.nextElement(); ic.imageComplete(ImageConsumer.STATICIMAGEDONE); } }