Package java.awt

Examples of java.awt.Graphics2D.clearRect()


        int sw = (int) tlt.getBounds().getWidth();
        int sh = (int) (tlt.getAscent() + tlt.getDescent());
        BufferedImage bi = new BufferedImage(sw, sh, BufferedImage.TYPE_INT_RGB);
        Graphics2D tG2 = bi.createGraphics();
        tG2.setBackground(GfrColor.WHITE_2);
        tG2.clearRect(0, 0, sw, sh);
        tG2.setColor(GfrColor.GRAY_8);
        tlt.draw(tG2, 0, tlt.getAscent());
        Rectangle r = new Rectangle(0, 0, sw, sh);
        return new TexturePaint(bi, r);
    }
View Full Code Here


        {
            retval = new BufferedImage( widthPx, heightPx, imageType );
        }
        Graphics2D graphics = (Graphics2D)retval.getGraphics();
        graphics.setBackground( TRANSPARENT_WHITE );
        graphics.clearRect( 0, 0, retval.getWidth(), retval.getHeight() );
        if (rotationAngle != 0)
        {
            int translateX = 0;
            int translateY = 0;
            switch(rotationAngle)
View Full Code Here

            setRenderingHintsForBufferedImage(g2d);
           
            g2d.setBackground(Color.white);
            g2d.setColor(Color.black);
            if (!withAlpha) {
                g2d.clearRect(0, 0, bmw, bmh);
            }
            /* debug code
            int off = 2;
            g2d.drawLine(off, 0, off, bmh);
            g2d.drawLine(bmw - off, 0, bmw - off, bmh);
View Full Code Here

    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
        Dimension d = getSize();
        g2.setBackground(lowerRightColor);
        g2.clearRect(0, 0, d.width, d.height);
        paintGradientComponent(d.width, d.height, g2);
    }

    public Color getLowerRightColor() {
        return lowerRightColor;
View Full Code Here

        int height = letterHeight;
       
        BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = img.createGraphics();
        g.setBackground(Color.white);
        g.clearRect(0, 0, img.getWidth(), img.getHeight());
        g.setColor(Color.black);
       
        g.drawString(
                value,
                5,
View Full Code Here

            Random r = new Random(0); // use seed 0 to get reproducable output
            BufferedImage img = new BufferedImage(320, 160, BufferedImage.TYPE_INT_RGB);
            g = img.createGraphics();
            g.setBackground(Color.WHITE);
            g.clearRect(0, 0, img.getWidth(), img.getHeight());

            for (int i = 0; i < 100; i++) {
                g.setColor(new Color(r.nextInt()));
                g.fillRect(r.nextInt(img.getWidth() - 30), r.nextInt(img.getHeight() - 30), 30, 30);
                out.writeFrame(img);
View Full Code Here

            // Clear the clip region to the background color
            g2d.setBackground(getBackground());

            if (_workaroundClearRectBug) {
                g2d.clearRect(0, 0, clip.width, clip.height);
            } else {
                g2d.clearRect(clip.x, clip.y, clip.width, clip.height);
            }

            // Draw directly onto the graphics pane
View Full Code Here

            g2d.setBackground(getBackground());

            if (_workaroundClearRectBug) {
                g2d.clearRect(0, 0, clip.width, clip.height);
            } else {
                g2d.clearRect(clip.x, clip.y, clip.width, clip.height);
            }

            // Draw directly onto the graphics pane
            if (paintAll) {
                _canvasPane.paint(g2d);
View Full Code Here

            // Clear the clip region to the background color
            g2d.setBackground(getBackground());

            if (_workaroundClearRectBug) {
                g2d.clearRect(0, 0, clip.width, clip.height);
            } else {
                g2d.clearRect(clip.x, clip.y, clip.width, clip.height);
            }

            // Paint on it
View Full Code Here

            g2d.setBackground(getBackground());

            if (_workaroundClearRectBug) {
                g2d.clearRect(0, 0, clip.width, clip.height);
            } else {
                g2d.clearRect(clip.x, clip.y, clip.width, clip.height);
            }

            // Paint on it
            if (paintAll) {
                _canvasPane.paint(g2d);
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.