Package java.awt

Examples of java.awt.Graphics2D.clip()


    harness.checkPoint("BufferedImage Graphics2D");
    BufferedImage image = new BufferedImage(100, 80,
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    harness.check(g2.getClip(), null);
    g2.clip(new Rectangle(1, 2, 3, 4));
    harness.check(g2.getClip(), new Rectangle(1, 2, 3, 4));
    g2.clip(new Rectangle(0, 1, 3, 2));
    harness.check(g2.getClip(), new Rectangle(1, 2, 2, 1));
   
    g2.setClip(null);
View Full Code Here


            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = image.createGraphics();
    harness.check(g2.getClip(), null);
    g2.clip(new Rectangle(1, 2, 3, 4));
    harness.check(g2.getClip(), new Rectangle(1, 2, 3, 4));
    g2.clip(new Rectangle(0, 1, 3, 2));
    harness.check(g2.getClip(), new Rectangle(1, 2, 2, 1));
   
    g2.setClip(null);
    g2.translate(10, 20);
    g2.clip(new Rectangle(1, 2, 3, 4));
View Full Code Here

    g2.clip(new Rectangle(0, 1, 3, 2));
    harness.check(g2.getClip(), new Rectangle(1, 2, 2, 1));
   
    g2.setClip(null);
    g2.translate(10, 20);
    g2.clip(new Rectangle(1, 2, 3, 4));
    harness.check(g2.getClip(), new Rectangle(1, 2, 3, 4));
   
    // try a null argument - the API specification says that this will clear
    // the clip, but in fact the reference implementation throws a
    // NullPointerException - see the following entry in the bug parade:
View Full Code Here

    // NullPointerException - see the following entry in the bug parade:
    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206189
    boolean pass = false;
    try
      {
        g2.clip(null)
      }
    catch (NullPointerException e)
      {
        pass = true;
      }
View Full Code Here

                    unselectedArea.add(new Area(new Rectangle(0, 0, width, height)));
                    unselectedArea.subtract(new Area(selection));

                    Graphics2D textGraphics = (Graphics2D)graphics.create();
                    textGraphics.setColor(color);
                    textGraphics.clip(unselectedArea);
                    textGraphics.drawGlyphVector(glyphVector, 0, ascent);
                    textGraphics.dispose();

                    // Paint the selection
                    Color selectionColor;
View Full Code Here

                    }

                    Graphics2D selectedTextGraphics = (Graphics2D)graphics.create();
                    selectedTextGraphics.setColor(textArea.isFocused() &&
                        textArea.isEditable() ? selectionColor : inactiveSelectionColor);
                    selectedTextGraphics.clip(selection.getBounds());
                    selectedTextGraphics.drawGlyphVector(glyphVector, 0, ascent);
                    selectedTextGraphics.dispose();
                } else {
                    // Draw the text
                    graphics.setColor(color);
View Full Code Here

                componentY += rowHeights[i] + verticalSpacing;
            }

            if (gridClip != null) {
                gridGraphics.clip(gridClip);
            }

            if (showHorizontalGridLines
                && verticalSpacing > 0
                && rowCount > 1) {
View Full Code Here

                    unselectedArea.add(new Area(new Rectangle(0, 0, width, height)));
                    unselectedArea.subtract(new Area(selection));

                    Graphics2D textGraphics = (Graphics2D)graphics.create();
                    textGraphics.setColor(color);
                    textGraphics.clip(unselectedArea);
                    textGraphics.drawGlyphVector(glyphVector, padding.left - scrollLeft + 1,
                        (height - textHeight) / 2 + ascent);
                    textGraphics.dispose();

                    // Paint the selection
View Full Code Here

                    graphics.setColor(selectionBackgroundColor);
                    graphics.fill(selection);

                    Graphics2D selectedTextGraphics = (Graphics2D)graphics.create();
                    selectedTextGraphics.setColor(selectionColor);
                    selectedTextGraphics.clip(selection.getBounds());
                    selectedTextGraphics.drawGlyphVector(glyphVector, padding.left - scrollLeft + 1,
                        (height - textHeight) / 2 + ascent);
                    selectedTextGraphics.dispose();
                }
            }
View Full Code Here

        Graphics2D g2d = bi.createGraphics();
        if (hints != null)
            g2d.addRenderingHints(hints);
        g2d.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE,
                             new WeakReference(bi));
        g2d.clip(new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
        return g2d;
    }


    public static Graphics2D createGraphics(BufferedImage bi) {
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.