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

The following examples show how to use java.awt.image.ImageConsumer#setHints() . 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 openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 2
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 3
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 4
Source File: MemoryImageSource.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers {@code true} if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration<ImageConsumer> enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 5
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 6
Source File: MemoryImageSource.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 7
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 8
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 9
Source File: MemoryImageSource.java    From openjdk-jdk8u 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 jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 11
Source File: MemoryImageSource.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 12
Source File: MemoryImageSource.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 13
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 14
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 15
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 16
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 17
Source File: MemoryImageSource.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 18
Source File: MemoryImageSource.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Specifies whether this animated memory image should always be
 * updated by sending the complete buffer of pixels whenever
 * there is a change.
 * This flag is ignored if the animation flag is not turned on
 * through the setAnimated() method.
 * <p>This method should be called immediately after the
 * MemoryImageSource is constructed and before an image is
 * created with it to ensure that all ImageConsumers will
 * receive the correct pixel delivery hints.
 * @param fullbuffers <code>true</code> if the complete pixel
 *             buffer should always
 * be sent
 * @see #setAnimated
 */
public synchronized void setFullBufferUpdates(boolean fullbuffers) {
    if (this.fullbuffers == fullbuffers) {
        return;
    }
    this.fullbuffers = fullbuffers;
    if (animating) {
        Enumeration enum_ = theConsumers.elements();
        while (enum_.hasMoreElements()) {
            ImageConsumer ic = (ImageConsumer) enum_.nextElement();
            ic.setHints(fullbuffers
                        ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                           ImageConsumer.COMPLETESCANLINES)
                        : ImageConsumer.RANDOMPIXELORDER);
        }
    }
}
 
Example 19
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 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);
    }
}