Package java.awt.image

Examples of java.awt.image.VolatileImage


     * @since 1.5
     */
    public VolatileImage createCompatibleVolatileImage(int width, int height,
        ImageCapabilities caps, int transparency) throws AWTException
    {
        VolatileImage vi =
            new SunVolatileImage(this, width, height, transparency, caps);
        if (caps != null && caps.isAccelerated() &&
            !vi.getCapabilities().isAccelerated())
        {
            throw new AWTException("Supplied image capabilities could not " +
                                   "be met by this graphics configuration.");
        }
        return vi;
View Full Code Here


        Dimension maxSize = getDoubleBufferMaximumSize();
        int width = proposedWidth < 1 ? 1 :
            (proposedWidth > maxSize.width? maxSize.width : proposedWidth);
        int height = proposedHeight < 1 ? 1 :
            (proposedHeight > maxSize.height? maxSize.height : proposedHeight);
        VolatileImage image = volatileMap.get(config);
        if (image == null || image.getWidth() < width ||
                             image.getHeight() < height) {
            if (image != null) {
                image.flush();
            }
            image = config.createCompatibleVolatileImage(width, height);
            volatileMap.put(config, image);
        }
        return image;
View Full Code Here

        }
        // Clear out the VolatileImages
        Iterator gcs = volatileMap.keySet().iterator();
        while (gcs.hasNext()) {
            GraphicsConfiguration gc = (GraphicsConfiguration)gcs.next();
            VolatileImage image = volatileMap.get(gc);
            if (image.getWidth() > width || image.getHeight() > height) {
                image.flush();
                gcs.remove();
            }
        }
    }
View Full Code Here

            boolean paintCompleted = false;
            Image offscreen;
            if (repaintManager.useVolatileDoubleBuffer() &&
                (offscreen = getValidImage(repaintManager.
                getVolatileOffscreenBuffer(bufferComponent, w, h))) != null) {
                VolatileImage vImage = (java.awt.image.VolatileImage)offscreen;
                GraphicsConfiguration gc = bufferComponent.
                                            getGraphicsConfiguration();
                for (int i = 0; !paintCompleted &&
                         i < RepaintManager.VOLATILE_LOOP_MAX; i++) {
                    if (vImage.validate(gc) ==
                                   VolatileImage.IMAGE_INCOMPATIBLE) {
                        repaintManager.resetVolatileDoubleBuffer(gc);
                        offscreen = repaintManager.getVolatileOffscreenBuffer(
                            bufferComponent,w, h);
                        vImage = (java.awt.image.VolatileImage)offscreen;
                    }
                    paintDoubleBuffered(paintingComponent, vImage, g, x, y,
                                        w, h);
                    paintCompleted = !vImage.contentsLost();
                }
            }
            // VolatileImage painting loop failed, fallback to regular
            // offscreen buffer
            if (!paintCompleted && (offscreen = getValidImage(
View Full Code Here

            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height, caps);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here

            }
            GraphicsConfiguration gc = getGraphicsConfiguration();
            if (gc == null) {
                return null;
            }
            VolatileImage image = gc.createCompatibleVolatileImage(width, height);
            fillImageBackground(image, width, height);
            return image;
        } finally {
            toolkit.unlockAWT();
        }
View Full Code Here

                return _convertToVolatile(data, pobs, flush);
        }

        private VolatileImage _convertToVolatile(Object data, Component pobs, boolean flush) {
                renderableImpl.io.obs = pobs;
                VolatileImage vdata = null;
                if (data == null) {
                        if (isDebugEnabled()) {
                                System.err.println("no data to convert " + toString());
                        }
                        return null;
View Full Code Here

         * @return VolatileImage created
         * @see java.awt.image.VolatileImage
         * @see #_getTransparency(int)
         */
        public static VolatileImage createVolatileImage(Dimension size, int type) {
                VolatileImage vdata = null;
                GraphicsConfiguration gc = JXAenvUtils._defaultGC;
                Dimension d = new Dimension(Math.max(1, Math.abs(size.width)), Math.max(1, Math.abs(size.height)));
                do {
                        Image i = ImagePool.getInstance().findVacantImage(VOLATILE, type, d);
                        vdata = i == null ? gc.createCompatibleVolatileImage(d.width, d.height, type) : (VolatileImage) i;
                        Graphics2D g = vdata.createGraphics();
                        Color c = g.getColor();
                        g.setColor(Color.WHITE);
                        g.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_IN, 0f));
                        g.fillRect(0, 0, d.width, d.height);
                        g.setComposite(AlphaComposite.SrcOver);
View Full Code Here

            GraphicsConfiguration cfg =
                GraphicsEnvironment
                .getLocalGraphicsEnvironment()
                .getDefaultScreenDevice()
                .getDefaultConfiguration();
            VolatileImage vimg = cfg.createCompatibleVolatileImage(8, 1);
            vimg.validate(cfg);
            Graphics2D g2d = vimg.createGraphics();
            for (int i = 0; i < 100; i++) {
                g2d.drawImage(ctx.bimg, 0, 0, null);
            }
            g2d.dispose();
            vimg.flush();
        }
        result.setUnits(1);
        result.setUnitName(getUnitName());
        return ctx;
    }
View Full Code Here

    ***************************************************************************/


    public VolatileImage createCompatibleVolatileImage(int width, int height,
            ImageCapabilities caps) throws AWTException {
        VolatileImage res = createCompatibleVolatileImage(width, height);
        if (!res.getCapabilities().equals(caps)) {
            // awt.14A=Can not create VolatileImage with specified capabilities
            throw new AWTException(Messages.getString("awt.14A")); //$NON-NLS-1$
        }
        return res;
    }
View Full Code Here

TOP

Related Classes of java.awt.image.VolatileImage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.