Package java.awt

Examples of java.awt.Graphics2D.clearRect()


                // old vImg doesn't work with new GraphicsConfig; re-create it
                vImage = createVolatileImage(getWidth(), getHeight());
            }
            Graphics2D graphics = vImage.createGraphics();
            if (clearImage)
                graphics.clearRect(0, 0, vImage.getWidth(), vImage.getHeight());
            graphics.drawRenderedImage(getImage(), IDENTITY);
            graphics.dispose();
        } while( vImage.contentsLost() );
    }
View Full Code Here


                        || image.getHeight() < height) {
                    image = new BufferedImage(width, height,
                            BufferedImage.TYPE_3BYTE_BGR);
                    Graphics2D g = image.createGraphics();
                    g.setBackground(Color.WHITE);
                    g.clearRect(0, 0, width, height);
                    g.dispose();
                }

                return image;
            }
View Full Code Here

            public synchronized void clearImage(Rectangle paintArea) {
                if (image == null)
                    return;
                Graphics2D g = image.createGraphics();
                g.setBackground(Color.WHITE);
                g.clearRect(paintArea.x, paintArea.y, paintArea.width,
                        paintArea.height);
                g.dispose();
            }

        };
View Full Code Here

       
        Graphics2D g = screen.createGraphics();

        //clear existing image
        g.setBackground(new Color(0, 0, 0, 0));
        g.clearRect(0,0, getMapDisplay().getWidth(), getMapDisplay().getHeight());
       
        //update screen tile states
        for( Iterator<Object> iterator = tileCache.getKeys().iterator(); iterator.hasNext(); ) {
            ReferencedEnvelope referencedEnvelope = (ReferencedEnvelope) iterator.next();
            Tile t = (Tile)tileCache.get(referencedEnvelope);
View Full Code Here

                                   new Color(75, 75, 75),
                                   true));
   
    Color c = new Color(100, 100, 100);
    g2d.setBackground(c);
    g2d.clearRect(0, 0, 20, 20);
    harness.check(img.isAlphaPremultiplied(), false);
   
    harness.check(g2d.getBackground(), c);
    harness.check(img.getRaster().getSample(10, 10, 0), 100);
    harness.check(img.getRaster().getSample(10, 10, 1), 100);
View Full Code Here

    // Show that the background is applied with a AlphaComposite.SRC rule,
    // that is, the entire contents are directly replaced by the background
    // and no compositing is performed.
    c = new Color(200, 200, 200, 51);
    g2d.setBackground(c);
    g2d.clearRect(0, 0, 20, 20);
    harness.check(img.isAlphaPremultiplied(), false);

    harness.check(g2d.getBackground(), c);
    harness.check(img.getRaster().getSample(10, 10, 0), 200);
    harness.check(img.getRaster().getSample(10, 10, 1), 200);
View Full Code Here

        WritableRaster rgbRaster = rgbImage.getRaster();

        // white background
        Graphics2D g = rgbImage.createGraphics();
        g.setBackground(Color.WHITE);
        g.clearRect(0, 0, width, height);
        g.dispose();

        // look up each colorant
        for (int c = 0; c < numColorants; c++)
        {
View Full Code Here

                // draw rasterized bitmap (optional)
                if (printerGraphics != null)
                {
                    printerGraphics.setBackground(Color.WHITE);
                    printerGraphics.clearRect(0, 0, image.getWidth(), image.getHeight());
                    printerGraphics.drawImage(image, 0, 0, null);
                    graphics2D.dispose();
                }

                return PAGE_EXISTS;
View Full Code Here

        {
            BufferedImage image = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
            Graphics2D g = (Graphics2D) image.getGraphics();
            g.setColor(Color.BLACK);
            g.setBackground(Color.WHITE);
            g.clearRect(0, 0, image.getWidth(), image.getHeight());
            g.setFont(new Font("SansSerif", Font.PLAIN, 48));
            g.drawString(label, 50, 50);
            g.dispose();
           
            Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("jpg");
View Full Code Here

        GfrUtilGraphics2D.s_setRenderingAntiAlias(g2d, _objAntiAlias_);

        g2d.setRenderingHint(KEY_RENDERING, _objRendering_);

        if (clearSurface || clearOnce) {
            g2d.clearRect(0, 0, width, height);
            clearOnce = false;
        }

        if (texture != null) {
            // set composite to opaque for texture fills
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.