Java Code Examples for java.awt.image.ImageConsumer#setDimensions()

The following examples show how to use java.awt.image.ImageConsumer#setDimensions() . 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 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 2
Source File: MemoryImageSource.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 3
Source File: MemoryImageSource.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 4
Source File: MemoryImageSource.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 5
Source File: MemoryImageSource.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 6
Source File: MemoryImageSource.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 7
Source File: MemoryImageSource.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 8
Source File: MemoryImageSource.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 9
Source File: MemoryImageSource.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 10
Source File: MemoryImageSource.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 11
Source File: MemoryImageSource.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 12
Source File: MemoryImageSource.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 13
Source File: MemoryImageSource.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 14
Source File: Spectrum.java    From wandora with GNU General Public License v3.0 6 votes vote down vote up
public synchronized void addConsumer(ImageConsumer ic) {
    try {
        update_buf = new byte[8 * W * scale * scale];
        ic.setDimensions(width, height);
        consumers.addElement(ic); // XXX it may have been just removed
        ic.setHints(ic.RANDOMPIXELORDER | ic.SINGLEPASS);
        if (isConsumer(ic)) {
            ic.setColorModel(cm);
        }
        force_refresh();
    } catch (Exception e) {
        if (isConsumer(ic)) {
            ic.imageComplete(ImageConsumer.IMAGEERROR);
        }
    }
}
 
Example 15
Source File: MemoryImageSource.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 16
Source File: MemoryImageSource.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 17
Source File: MemoryImageSource.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private void initConsumer(ImageConsumer ic) {
    if (isConsumer(ic)) {
        ic.setDimensions(width, height);
    }
    if (isConsumer(ic)) {
        ic.setProperties(properties);
    }
    if (isConsumer(ic)) {
        ic.setColorModel(model);
    }
    if (isConsumer(ic)) {
        ic.setHints(animating
                    ? (fullbuffers
                       ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                          ImageConsumer.COMPLETESCANLINES)
                       : ImageConsumer.RANDOMPIXELORDER)
                    : (ImageConsumer.TOPDOWNLEFTRIGHT |
                       ImageConsumer.COMPLETESCANLINES |
                       ImageConsumer.SINGLEPASS |
                       ImageConsumer.SINGLEFRAME));
    }
}
 
Example 18
Source File: ARGBImageProducer.java    From pumpernickel with MIT License 5 votes vote down vote up
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 19
Source File: RenderableImageProducer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 vote down vote up
/**
 * 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);
    }
}