@Test public void clipWithNullArgClearsClipRegion() throws Exception { graphics.clip(midRect); graphics.clip(null); assertNull(graphics.getClip()); // check that it is safe to call getClipBounds assertNull(graphics.getClipBounds()); }
@Test public void getClipBoundsWithArg() throws Exception { Rectangle r = new Rectangle(); graphics.clip(midRect); graphics.getClipBounds(r); assertEquals(midRect, r); // clear clip region graphics.clip(null); graphics.getClipBounds(r); // r should be unchanged assertEquals(midRect, r); }
/** Returns a new graphics instance with the correct color and font for text rendering. */ protected final Graphics2D createTextGraphics( double x, double y, double w, double h, double rotation, boolean clip, String align, String valign) { Graphics2D g2 = state.g; updateFont(); if (rotation != 0) { g2 = (Graphics2D) state.g.create(); double rad = rotation * (Math.PI / 180); g2.rotate(rad, x, y); } if (clip && w > 0 && h > 0) { if (g2 == state.g) { g2 = (Graphics2D) state.g.create(); } Point2D margin = getMargin(align, valign); x += margin.getX() * w; y += margin.getY() * h; g2.clip(new Rectangle2D.Double(x, y, w, h)); } return g2; }
public void drawPage(Graphics2D g2) { FontRenderContext context = g2.getFontRenderContext(); Font f = new Font("Serif", Font.PLAIN, 72); GeneralPath clipShape = new GeneralPath(); TextLayout layout = new TextLayout("2426打印指南", f, context); AffineTransform transform = AffineTransform.getTranslateInstance(0, 72); Shape outline = layout.getOutline(transform); clipShape.append(outline, false); layout = new TextLayout("thank you", f, context); transform = AffineTransform.getTranslateInstance(0, 144); outline = layout.getOutline(transform); clipShape.append(outline, false); g2.draw(clipShape); g2.clip(clipShape); final int NLINES = 50; Point2D p = new Point2D.Double(0, 0); for (int i = 0; i < NLINES; i++) { double x = (2 * getWidth() * i) / NLINES; double y = (2 * getHeight() * (NLINES - 1 - i)) / NLINES; Point2D q = new Point2D.Double(x, y); g2.draw(new Line2D.Double(p, q)); } }
@Test public void drawWithClipAndTransform() throws Exception { graphics.setPaint(Color.BLACK); graphics.fill(imageBounds); AffineTransform tr = AffineTransform.getRotateInstance( Math.PI / 4, image.getMinX() + image.getWidth() / 2, image.getMinY() + image.getHeight() / 2); graphics.transform(tr); graphics.clip(midRect); graphics.setPaint(Color.RED); graphics.fill(imageBounds); showImage("drawWithClipAndTransform"); // Outside transformed clip region Rectangle outer = new Rectangle(midRect); outer.grow(5, 5); Point2D[] corners = getCorners(outer); Point2D[] trPoints = new Point2D[corners.length]; tr.transform(corners, 0, trPoints, 0, corners.length); assertColor(Color.BLACK, trPoints); // Inside transformed clip region Rectangle inner = new Rectangle(midRect); inner.grow(-5, -5); corners = getCorners(inner); tr.transform(corners, 0, trPoints, 0, corners.length); assertColor(Color.RED, trPoints); }
public void exportReportToGraphics2D() throws JRException { grx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // grx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); grx.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); grx.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); AffineTransform atrans = new AffineTransform(); atrans.translate(globalOffsetX, globalOffsetY); atrans.scale(zoom, zoom); grx.transform(atrans); java.util.List pages = jasperPrint.getPages(); if (pages != null) { Shape oldClipShape = grx.getClip(); grx.clip(new Rectangle(0, 0, jasperPrint.getPageWidth(), jasperPrint.getPageHeight())); try { JRPrintPage page = (JRPrintPage) pages.get(startPageIndex); exportPage(page); } finally { grx.setClip(oldClipShape); } } }
/** * Draw some graphics into an Graphics2D object. * * @param image the image to draw into * @throws NoninvertibleTransformException in transform errors. */ private void draw(Graphics2D gr) throws NoninvertibleTransformException { gr.setPaint(Color.WHITE); gr.fill(new Rectangle(0, 0, tileWidth, tileHeight)); // AffineTransform[[0.318755336305853, 0.0, 420.03106689453125], // [0.0, 0.318755336305853, 245.5029296875]] AffineTransform transform = new AffineTransform( 0.318755336305853, 0.0, 0.0, 0.318755336305853, 420.03106689453125, 245.5029296875); gr.setTransform(transform); Shape s = new Rectangle(0, 0, 96, 83); // create an enbedded graphics Graphics2D grr = (Graphics2D) gr.create(); // AffineTransform[[1.0, 0.0, -343.9285583496093], // [0.0, 1.0, -502.5158386230469]] grr.clip(s.getBounds()); transform = new AffineTransform(1.0, 0.0, 0.0, 1.0, -343.9285583496093, -502.5158386230469); grr.transform(transform); AffineTransform t = transform.createInverse(); s = t.createTransformedShape(s); assertTrue(s.getBounds().intersects(grr.getClip().getBounds2D())); grr.setPaint(Color.BLUE); grr.draw(s); grr.dispose(); gr.dispose(); }
/** * Draws the background to the specified graphics device. If the dial frame specifies a window, * the clipping region will already have been set to this window before this method is called. * * @param g2 the graphics device (<code>null</code> not permitted). * @param plot the plot (ignored here). * @param frame the dial frame (ignored here). * @param view the view rectangle (<code>null</code> not permitted). */ @Override public void draw(Graphics2D g2, DialPlot plot, Rectangle2D frame, Rectangle2D view) { // work out the anchor point Rectangle2D f = DialPlot.rectangleByRadius(frame, this.radius, this.radius); Arc2D arc = new Arc2D.Double(f, this.angle, 0.0, Arc2D.OPEN); Point2D pt = arc.getStartPoint(); // the indicator bounds is calculated from the templateValue (which // determines the minimum size), the maxTemplateValue (which, if // specified, provides a maximum size) and the actual value FontMetrics fm = g2.getFontMetrics(this.font); double value = plot.getValue(this.datasetIndex); String valueStr = this.formatter.format(value); Rectangle2D valueBounds = TextUtilities.getTextBounds(valueStr, g2, fm); // calculate the bounds of the template value String s = this.formatter.format(this.templateValue); Rectangle2D tb = TextUtilities.getTextBounds(s, g2, fm); double minW = tb.getWidth(); double minH = tb.getHeight(); double maxW = Double.MAX_VALUE; double maxH = Double.MAX_VALUE; if (this.maxTemplateValue != null) { s = this.formatter.format(this.maxTemplateValue); tb = TextUtilities.getTextBounds(s, g2, fm); maxW = Math.max(tb.getWidth(), minW); maxH = Math.max(tb.getHeight(), minH); } double w = fixToRange(valueBounds.getWidth(), minW, maxW); double h = fixToRange(valueBounds.getHeight(), minH, maxH); // align this rectangle to the frameAnchor Rectangle2D bounds = RectangleAnchor.createRectangle(new Size2D(w, h), pt.getX(), pt.getY(), this.frameAnchor); // add the insets Rectangle2D fb = this.insets.createOutsetRectangle(bounds); // draw the background g2.setPaint(this.backgroundPaint); g2.fill(fb); // draw the border g2.setStroke(this.outlineStroke); g2.setPaint(this.outlinePaint); g2.draw(fb); // now find the text anchor point Shape savedClip = g2.getClip(); g2.clip(fb); Point2D pt2 = RectangleAnchor.coordinates(bounds, this.valueAnchor); g2.setPaint(this.paint); g2.setFont(this.font); TextUtilities.drawAlignedString( valueStr, g2, (float) pt2.getX(), (float) pt2.getY(), this.textAnchor); g2.setClip(savedClip); }
public static BufferedImage cleanImageEdges(BufferedImage i) { BufferedImage i2 = new BufferedImage(i.getWidth(), i.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g = i2.createGraphics(); g.setColor(Color.WHITE); g.fillRect(0, 0, i2.getWidth(), i2.getHeight()); g.clip(new java.awt.geom.Ellipse2D.Double(-1, -1, i2.getWidth() + 2, i2.getHeight() + 2)); g.drawImage(i, 0, 0, null); return i2; }
@Test public void clipWithExistingTransform() throws Exception { AffineTransform tr = AffineTransform.getRotateInstance(Math.PI / 4); graphics.transform(tr); graphics.clip(midRect); /* * getClip should return the untransformed region - however we * allow for some slope because DiskMemImageGraphics is actually * returning the inverse-transformed version of its internal user * clip (transformed) shape. */ assertBounds(midRect, graphics.getClipBounds(), 2); }
/** * Draw one occupant object. First verify that the object is actually visible before any drawing, * set up the clip appropriately and use the DisplayMap to determine which object to call upon to * render this particular Locatable. Note that we save and restore the graphics transform to * restore back to normalcy no matter what the renderer did to to the coordinate system. * * @param g2 the Graphics2D object to use to render * @param xleft the leftmost pixel of the rectangle * @param ytop the topmost pixel of the rectangle * @param obj the Locatable object to draw */ private void drawOccupant(Graphics2D g2, int xleft, int ytop, Object obj) { Rectangle cellToDraw = new Rectangle(xleft, ytop, cellSize, cellSize); // Only draw if the object is visible within the current clipping // region. if (cellToDraw.intersects(g2.getClip().getBounds())) { Graphics2D g2copy = (Graphics2D) g2.create(); g2copy.clip(cellToDraw); // Get the drawing object to display this occupant. Display displayObj = displayMap.findDisplayFor(obj.getClass()); displayObj.draw(obj, this, g2copy, cellToDraw); g2copy.dispose(); } }
public void paintComponent(Graphics g) { super.paintComponent(g); if (w.n == Player) { sendInfo(); } if (valid()) { if (ok) { changePlayer(); ok = false; if (bile[0].bila == null) bile[0] = new Bila(x, y, this); if (w.n > 0) sendInfo(); } } g.drawImage(masa, 0, 0, null); Graphics2D g2 = (Graphics2D) g; g2.setColor(new Color(0xC0C0C0)); g2.fillRect(103, 15, 70, 23); g2.setColor(Color.BLACK); g2.setFont(new Font("Algerian", Font.ITALIC, 20)); g2.drawString("Player" + Player, 100, 32); g2.setColor(Color.WHITE); g2.setFont(new Font("Algerian", Font.BOLD, 40)); g2.drawString("Russian Billiard", 230, 50); g2.setColor(Color.GRAY); g2.fillRect(12, 443, 286, 25); g2.fillRect(341, 443, 286, 25); for (int i = 1; i < bile.length; i++) g2.drawImage(bBall, (int) bile[i].xp - dim, (int) bile[i].yp - dim, DIM, DIM, null); g2.setColor(Color.DARK_GRAY); g2.setStroke(new BasicStroke(6)); g2.drawRoundRect(12, 443, 286, 25, 3, 3); g2.drawRoundRect(341, 443, 286, 25, 3, 3); g2.clip(new Ellipse2D.Double(17, 15, 77, 77)); for (int i = 0; i < Putere; i++) { g2.setColor(new Color(6 * i, 200, 255 - 6 * i)); g2.fill3DRect(17, 91 - i * d, 77, d, true); } g2.setClip(null); g2.setStroke(new BasicStroke()); if (bile[0].bila != null) g2.drawImage(rBall, (int) bile[0].xp - dim, (int) bile[0].yp - dim, DIM, DIM, null); if (Tinta != null) { g2.rotate(Math.atan2(Tinta.y - bile[0].yp, Tinta.x - bile[0].xp), bile[0].xp, bile[0].yp); g2.drawImage(cue, (int) bile[0].xp + dim + Putere, (int) bile[0].yp - dim / 3, 200, 10, null); } if (player[0] == 6 || player[1] == 6 || (player[0] == 5 && player[1] == 5)) { for (int i = 0; i < bile.length; i++) bile[i].stop(); reset(); } }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (!(g instanceof Graphics2D)) { return; } Graphics2D g2 = (Graphics2D) g.create(); int[] widths = getWidths(); // Position and size of the border interior. int intX = x + widths[LEFT]; int intY = y + widths[TOP]; int intWidth = width - (widths[RIGHT] + widths[LEFT]); int intHeight = height - (widths[TOP] + widths[BOTTOM]); // Coordinates of the interior corners, from NW clockwise. int[][] intCorners = { {intX, intY}, {intX + intWidth, intY}, {intX + intWidth, intY + intHeight}, { intX, intY + intHeight, }, }; // Draw the borders for all sides. for (int i = 0; i < 4; i++) { Value style = getBorderStyle(i); Polygon shape = getBorderShape(i); if ((style != Value.NONE) && (shape != null)) { int sideLength = (i % 2 == 0 ? intWidth : intHeight); // "stretch" the border shape by the interior area dimension shape.xpoints[2] += sideLength; shape.xpoints[3] += sideLength; Color color = getBorderColor(i); BorderPainter painter = getBorderPainter(i); double angle = i * Math.PI / 2; g2.setClip(g.getClip()); // Restore initial clip g2.translate(intCorners[i][0], intCorners[i][1]); g2.rotate(angle); g2.clip(shape); painter.paint(shape, g2, color, i); g2.rotate(-angle); g2.translate(-intCorners[i][0], -intCorners[i][1]); } } g2.dispose(); }
public void drawPage(Graphics2D g2, PageFormat pf, int page) { if (message.equals("")) return; page--; // account for cover page drawCropMarks(g2, pf); g2.clip(new Rectangle2D.Double(0, 0, pf.getImageableWidth(), pf.getImageableHeight())); g2.translate(-page * pf.getImageableWidth(), 0); g2.scale(scale, scale); FontRenderContext context = g2.getFontRenderContext(); Font f = new Font("Serif", Font.PLAIN, 72); TextLayout layout = new TextLayout(message, f, context); AffineTransform transform = AffineTransform.getTranslateInstance(0, layout.getAscent()); Shape outline = layout.getOutline(transform); g2.draw(outline); }
@Test public void drawWithClip() throws Exception { graphics.setPaint(Color.BLACK); graphics.fill(imageBounds); graphics.clip(midRect); graphics.setPaint(Color.RED); graphics.fill(imageBounds); showImage("drawWithClip"); // Outside clip region Rectangle outer = new Rectangle(midRect); outer.grow(5, 5); assertColor(Color.BLACK, getCorners(outer)); // Inside clip region Rectangle inner = new Rectangle(midRect); inner.grow(-5, -5); assertColor(Color.RED, getCorners(inner)); }
protected void paintChildren(Graphics g) { if (clipChildren) { Shape shape = getShape(); if (shape != null) { Graphics2D g2 = (Graphics2D) g; Shape clip = g2.getClip(); g2.clip(shape); super.paintChildren(g); g2.setClip(clip); /* ShapedBorder sb = getShapedBorder(); if (sb != null) sb.paintBorder(this, g, shapedInsets.left, shapedInsets.top, getWidth() - shapedInsets.left -shapedInsets.right, getHeight() - shapedInsets.top - shapedInsets.bottom); */ return; } } super.paintChildren(g); }
protected void paintComponent(Graphics g) { super.paintComponent(g); if (painter != null) { Shape shape = getShape(); if (shape != null) { Shape clip = g.getClip(); g.clipRect( shapedInsets.left, shapedInsets.top, getWidth() - shapedInsets.left - shapedInsets.right, getHeight() - shapedInsets.top - shapedInsets.bottom); ((Graphics2D) g).clip(shape); painter.paint( this, g, 0, 0, getWidth(), getHeight(), direction, horizontalFlip, verticalFlip); g.setClip(clip); } else painter.paint( this, g, 0, 0, getWidth(), getHeight(), direction, horizontalFlip, verticalFlip); } }
/** * Paint the glyphs for the given view. This is implemented to only render if the Graphics is of * type Graphics2D which is required by TextLayout (and this should be the case if running on the * JDK). */ public void paint(GlyphView v, Graphics g, Shape a, int p0, int p1) { if (g instanceof Graphics2D) { Rectangle2D alloc = a.getBounds2D(); Graphics2D g2d = (Graphics2D) g; float y = (float) alloc.getY() + layout.getAscent() + layout.getLeading(); float x = (float) alloc.getX(); if (p0 > v.getStartOffset() || p1 < v.getEndOffset()) { try { // TextLayout can't render only part of it's range, so if a // partial range is required, add a clip region. Shape s = v.modelToView(p0, Position.Bias.Forward, p1, Position.Bias.Backward, a); Shape savedClip = g.getClip(); g2d.clip(s); layout.draw(g2d, x, y); g.setClip(savedClip); } catch (BadLocationException e) { } } else { layout.draw(g2d, x, y); } } }
/** * @param g * @param s get the boundaryvalues for the shape */ public static void paintTexture(Graphics2D g, Shape s, DrawingPad pad) { Rectangle r = s.getBounds(); if (r.height <= 0 || r.width <= 0) return; /** * when the height and width of the symbol is greater than 0 then GraphicsConfiguration is set * to DeviceConnfiguration */ GraphicsConfiguration config = g.getDeviceConfiguration(); BufferedImage strip = (BufferedImage) pad.getImage(); /** creates an object gstrip for drawing horizontal and vertical strip */ Graphics2D gStrip = strip.createGraphics(); horStrip(gStrip, strip, 0, r.width, 0); gStrip.dispose(); Shape prevClip = g.getClip(); if (!r.equals(s)) { g.clip(s); } vertStrip(g, strip, r.y, r.height, r.x); g.setClip(prevClip); }
@Test public void setAndGetClip() { graphics.clip(midRect); assertEquals(midRect, graphics.getClipBounds()); }
protected void paintWidgetImplementation() { super.paintWidget(); Graphics2D gr = getScene().getGraphics(); // Java2DUtils.setClip(gr,getClientArea()); // Move the gfx 10 pixel ahead... Rectangle r = getPreferredBounds(); long t = new Date().getTime(); // if (getElement() instanceof JRDesignImage) return; AffineTransform af = gr.getTransform(); AffineTransform new_af = (AffineTransform) af.clone(); AffineTransform translate = AffineTransform.getTranslateInstance( getBorder().getInsets().left + r.x, getBorder().getInsets().top + r.y); new_af.concatenate(translate); gr.setTransform(new_af); JasperDesign jd = ((AbstractReportObjectScene) this.getScene()).getJasperDesign(); JRDesignElement e = this.getElement(); DrawVisitor dv = ((AbstractReportObjectScene) this.getScene()).getDrawVisitor(); if (dv == null) return; if (e instanceof JRDesignCrosstab) { Composite oldComposite = gr.getComposite(); gr.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); try { e.visit(dv); } catch (Exception ex) { } gr.setComposite(oldComposite); Shape oldClip = gr.getClip(); Shape rect = new Rectangle2D.Float(0, 0, element.getWidth(), element.getHeight()); gr.clip(rect); gr.drawImage(crosstabImage.getImage(), 4, 4, null); gr.setClip(oldClip); } // if (e instanceof JRDesignFrame) // { // Composite oldComposite = gr.getComposite(); // gr.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); // //try { // // e.visit( dv ); // //} catch (Exception ex){} // gr.setComposite(oldComposite); // Shape oldClip = gr.getClip(); // Shape rect = new Rectangle2D.Float(0,0,element.getWidth(), element.getHeight()); // // } else if (e instanceof JRDesignSubreport) { Composite oldComposite = gr.getComposite(); gr.fillRect(0, 0, element.getWidth(), element.getHeight()); gr.setComposite(oldComposite); Shape oldClip = gr.getClip(); Shape rect = new Rectangle2D.Float(0, 0, element.getWidth(), element.getHeight()); gr.clip(rect); gr.drawImage(subreportImage.getImage(), 4, 4, null); gr.setClip(oldClip); } else if (e instanceof JRDesignGenericElement) { // Composite oldComposite = gr.getComposite(); Paint oldPaint = gr.getPaint(); gr.setPaint(new Color(196, 200, 162, 64)); gr.fillRect(0, 0, element.getWidth(), element.getHeight()); gr.setPaint(oldPaint); // gr.setComposite(oldComposite); Shape oldClip = gr.getClip(); Shape rect = new Rectangle2D.Float(0, 0, element.getWidth(), element.getHeight()); gr.clip(rect); gr.drawImage(genericElementImage.getImage(), 4, 4, null); gr.setClip(oldClip); } else if (e instanceof JRDesignChart) { if (((JRDesignChart) e).getChartType() == JRDesignChart.CHART_TYPE_MULTI_AXIS) { Composite oldComposite = gr.getComposite(); gr.fillRect(0, 0, element.getWidth(), element.getHeight()); gr.setComposite(oldComposite); Shape oldClip = gr.getClip(); Shape rect = new Rectangle2D.Float(0, 0, element.getWidth(), element.getHeight()); gr.clip(rect); gr.drawImage(multiaxisImage.getImage(), 4, 4, null); gr.setClip(oldClip); } else { ClassLoader oldCL = null; dv.setGraphics2D(gr); oldCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(IReportManager.getJRExtensionsClassLoader()); try { e.visit(dv); } catch (Exception ex) { System.err.println( "iReport - Element rendering exception " + getElement() + " " + ex.getMessage()); // ex.printStackTrace(); } if (oldCL != null) { Thread.currentThread().setContextClassLoader(oldCL); } } } else { dv.setGraphics2D(gr); try { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(IReportManager.getJRExtensionsClassLoader()); e.visit(dv); Thread.currentThread().setContextClassLoader(cl); } catch (Exception ex) { System.err.println( "iReport - Element rendering exception " + getElement() + " " + ex.getMessage()); // ex.printStackTrace(); } } // show the element and parent coordinates... /* Point p = getParentElementModelLocation(); gr.setColor(Color.darkGray); gr.setFont(new Font("SansSerif",0,6)); gr.drawString( getElement().getX() + "," + getElement().getY() + " - " + p.x + "," + p.y, 2, 12); */ // gr.setTransform(af); // Java2DUtils.resetClip(gr); // System.out.println("Painted : " + (t - new Date().getTime()) + " " + getElement()); }
/** * Draws the plot on a Java 2D graphics device (such as the screen or a printer). * * @param g2 the graphics device. * @param area the area within which the plot should be drawn. * @param anchor the anchor point (<code>null</code> permitted). * @param parentState the state from the parent plot, if there is one. * @param info collects info about the drawing. */ public void draw( Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { if (info != null) { info.setPlotArea(area); } // adjust for insets... RectangleInsets insets = getInsets(); insets.trim(area); area.setRect(area.getX() + 4, area.getY() + 4, area.getWidth() - 8, area.getHeight() - 8); // draw the background if (this.drawBorder) { drawBackground(g2, area); } // adjust the plot area by the interior spacing value double gapHorizontal = (2 * DEFAULT_BORDER_SIZE); double gapVertical = (2 * DEFAULT_BORDER_SIZE); double meterX = area.getX() + gapHorizontal / 2; double meterY = area.getY() + gapVertical / 2; double meterW = area.getWidth() - gapHorizontal; double meterH = area.getHeight() - gapVertical + ((this.meterAngle <= 180) && (this.shape != DialShape.CIRCLE) ? area.getHeight() / 1.25 : 0); double min = Math.min(meterW, meterH) / 2; meterX = (meterX + meterX + meterW) / 2 - min; meterY = (meterY + meterY + meterH) / 2 - min; meterW = 2 * min; meterH = 2 * min; Rectangle2D meterArea = new Rectangle2D.Double(meterX, meterY, meterW, meterH); Rectangle2D.Double originalArea = new Rectangle2D.Double( meterArea.getX() - 4, meterArea.getY() - 4, meterArea.getWidth() + 8, meterArea.getHeight() + 8); double meterMiddleX = meterArea.getCenterX(); double meterMiddleY = meterArea.getCenterY(); // plot the data (unless the dataset is null)... ValueDataset data = getDataset(); if (data != null) { double dataMin = this.range.getLowerBound(); double dataMax = this.range.getUpperBound(); Shape savedClip = g2.getClip(); g2.clip(originalArea); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (this.dialBackgroundPaint != null) { fillArc(g2, originalArea, dataMin, dataMax, this.dialBackgroundPaint, true); } drawTicks(g2, meterArea, dataMin, dataMax); drawArcForInterval( g2, meterArea, new MeterInterval("", this.range, this.dialOutlinePaint, new BasicStroke(1.0f), null)); Iterator iterator = this.intervals.iterator(); while (iterator.hasNext()) { MeterInterval interval = (MeterInterval) iterator.next(); drawArcForInterval(g2, meterArea, interval); } Number n = data.getValue(); if (n != null) { double value = n.doubleValue(); drawValueLabel(g2, meterArea); if (this.range.contains(value)) { g2.setPaint(this.needlePaint); g2.setStroke(new BasicStroke(2.0f)); double radius = (meterArea.getWidth() / 2) + DEFAULT_BORDER_SIZE + 15; double valueAngle = valueToAngle(value); double valueP1 = meterMiddleX + (radius * Math.cos(Math.PI * (valueAngle / 180))); double valueP2 = meterMiddleY - (radius * Math.sin(Math.PI * (valueAngle / 180))); Polygon arrow = new Polygon(); if ((valueAngle > 135 && valueAngle < 225) || (valueAngle < 45 && valueAngle > -45)) { double valueP3 = (meterMiddleY - DEFAULT_CIRCLE_SIZE / 4); double valueP4 = (meterMiddleY + DEFAULT_CIRCLE_SIZE / 4); arrow.addPoint((int) meterMiddleX, (int) valueP3); arrow.addPoint((int) meterMiddleX, (int) valueP4); } else { arrow.addPoint((int) (meterMiddleX - DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY); arrow.addPoint((int) (meterMiddleX + DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY); } arrow.addPoint((int) valueP1, (int) valueP2); g2.fill(arrow); Ellipse2D circle = new Ellipse2D.Double( meterMiddleX - DEFAULT_CIRCLE_SIZE / 2, meterMiddleY - DEFAULT_CIRCLE_SIZE / 2, DEFAULT_CIRCLE_SIZE, DEFAULT_CIRCLE_SIZE); g2.fill(circle); } } g2.setClip(savedClip); g2.setComposite(originalComposite); } if (this.drawBorder) { drawOutline(g2, area); } }
protected boolean drawImage( final RenderableReplacedContentBox content, final Image image, final com.lowagie.text.Image itextImage) { final StyleSheet layoutContext = content.getStyleSheet(); final boolean shouldScale = layoutContext.getBooleanStyleProperty(ElementStyleKeys.SCALE); final int x = (int) StrictGeomUtility.toExternalValue(content.getX()); final int y = (int) StrictGeomUtility.toExternalValue(content.getY()); final int width = (int) StrictGeomUtility.toExternalValue(content.getWidth()); final int height = (int) StrictGeomUtility.toExternalValue(content.getHeight()); if (width == 0 || height == 0) { PdfLogicalPageDrawable.logger.debug("Error: Image area is empty: " + content); return false; } final WaitingImageObserver obs = new WaitingImageObserver(image); obs.waitImageLoaded(); final int imageWidth = image.getWidth(obs); final int imageHeight = image.getHeight(obs); if (imageWidth < 1 || imageHeight < 1) { return false; } final Rectangle2D.Double drawAreaBounds = new Rectangle2D.Double(x, y, width, height); final AffineTransform scaleTransform; final Graphics2D g2; if (shouldScale == false) { double deviceScaleFactor = 1; final double devResolution = getMetaData().getNumericFeatureValue(OutputProcessorFeature.DEVICE_RESOLUTION); if (getMetaData().isFeatureSupported(OutputProcessorFeature.IMAGE_RESOLUTION_MAPPING)) { if (devResolution != 72.0 && devResolution > 0) { // Need to scale the device to its native resolution before attempting to draw the image.. deviceScaleFactor = (72.0 / devResolution); } } final int clipWidth = Math.min(width, (int) Math.ceil(deviceScaleFactor * imageWidth)); final int clipHeight = Math.min(height, (int) Math.ceil(deviceScaleFactor * imageHeight)); final ElementAlignment horizontalAlignment = (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.ALIGNMENT); final ElementAlignment verticalAlignment = (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.VALIGNMENT); final int alignmentX = (int) RenderUtility.computeHorizontalAlignment(horizontalAlignment, width, clipWidth); final int alignmentY = (int) RenderUtility.computeVerticalAlignment(verticalAlignment, height, clipHeight); g2 = (Graphics2D) getGraphics().create(); g2.clip(drawAreaBounds); g2.translate(x, y); g2.translate(alignmentX, alignmentY); g2.clip(new Rectangle2D.Float(0, 0, clipWidth, clipHeight)); g2.scale(deviceScaleFactor, deviceScaleFactor); scaleTransform = null; } else { g2 = (Graphics2D) getGraphics().create(); g2.clip(drawAreaBounds); g2.translate(x, y); g2.clip(new Rectangle2D.Float(0, 0, width, height)); final double scaleX; final double scaleY; final boolean keepAspectRatio = layoutContext.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO); if (keepAspectRatio) { final double scaleFactor = Math.min(width / (double) imageWidth, height / (double) imageHeight); scaleX = scaleFactor; scaleY = scaleFactor; } else { scaleX = width / (double) imageWidth; scaleY = height / (double) imageHeight; } final int clipWidth = (int) (scaleX * imageWidth); final int clipHeight = (int) (scaleY * imageHeight); final ElementAlignment horizontalAlignment = (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.ALIGNMENT); final ElementAlignment verticalAlignment = (ElementAlignment) layoutContext.getStyleProperty(ElementStyleKeys.VALIGNMENT); final int alignmentX = (int) RenderUtility.computeHorizontalAlignment(horizontalAlignment, width, clipWidth); final int alignmentY = (int) RenderUtility.computeVerticalAlignment(verticalAlignment, height, clipHeight); g2.translate(alignmentX, alignmentY); scaleTransform = AffineTransform.getScaleInstance(scaleX, scaleY); } final PdfGraphics2D pdfGraphics2D = (PdfGraphics2D) g2; pdfGraphics2D.drawPdfImage(itextImage, image, scaleTransform, null); g2.dispose(); return true; }
public void clip(Shape clip) { hostGraphics.clip(clip); }
public void clip(Shape s) { g2d.clip(s); }
/** * Paints a graphic fill for a given shape. * * @param graphics Graphics2D on which to paint. * @param shape Shape whose fill is to be painted. * @param graphicFill a Style2D that specified the graphic fill. * @param scale the scale of the current render. * @throws TransformException * @throws FactoryException */ private void paintGraphicFill( Graphics2D graphics, Shape shape, Style2D graphicFill, double scale) { // retrieves the bounds of the provided shape Rectangle2D boundsShape = shape.getBounds2D(); // retrieves the size of the stipple to be painted based on the provided graphic fill Rectangle2D stippleSize = null; if (graphicFill instanceof MarkStyle2D) { Rectangle2D boundsFill = ((MarkStyle2D) graphicFill).getShape().getBounds2D(); double size = ((MarkStyle2D) graphicFill).getSize(); double aspect = (boundsFill.getHeight() > 0 && boundsFill.getWidth() > 0) ? boundsFill.getWidth() / boundsFill.getHeight() : 1.0; stippleSize = new Rectangle2D.Double(0, 0, size * aspect, size); } else if (graphicFill instanceof IconStyle2D) { Icon icon = ((IconStyle2D) graphicFill).getIcon(); stippleSize = new Rectangle2D.Double(0, 0, icon.getIconWidth(), icon.getIconHeight()); } else { // if graphic fill does not provide bounds information, it is considered // to be unsupported for stipple painting return; } // computes the number of times the graphic will be painted as a stipple int toX = (int) Math.ceil(boundsShape.getWidth() / stippleSize.getWidth()); int toY = (int) Math.ceil(boundsShape.getHeight() / stippleSize.getHeight()); // creates a copy of the Graphics so that we can change it freely Graphics2D g = (Graphics2D) graphics.create(); // adds the provided shape to the Graphics current clip region g.clip(shape); // retrieves the full clip region Shape clipShape = g.getClip(); Rectangle2D boundsClip = clipShape.getBounds2D(); // adjust the iteration indexes to avoid iterating a lot over areas that we won't be rendering int fromX = 0; if (boundsClip.getMinX() > boundsShape.getMinX()) { fromX = (int) Math.floor((boundsClip.getMinX() - boundsShape.getMinX()) / stippleSize.getWidth()); } if (boundsClip.getMaxX() < boundsShape.getMaxX()) { toX -= (int) Math.floor((boundsShape.getMaxX() - boundsClip.getMaxX()) / stippleSize.getWidth()); } // adjust the iteration indexes to avoid iterating a lot over areas that we won't be rendering int fromY = 0; if (boundsClip.getMinY() > boundsShape.getMinY()) { fromY = (int) Math.floor((boundsClip.getMinY() - boundsShape.getMinY()) / stippleSize.getHeight()); } if (boundsClip.getMaxY() < boundsShape.getMaxY()) { toY -= (int) Math.floor((boundsShape.getMaxY() - boundsClip.getMaxY()) / stippleSize.getHeight()); } // paints graphic fill as a stipple for (int i = fromX; i < toX; i++) { for (int j = fromY; j < toY; j++) { // computes this stipple's shift in the X and Y directions double translateX = boundsShape.getMinX() + i * stippleSize.getWidth(); double translateY = boundsShape.getMinY() + j * stippleSize.getHeight(); // only does anything if current stipple intersects the clip region if (!clipShape.intersects( translateX, translateY, stippleSize.getWidth(), stippleSize.getHeight())) continue; // creates a LiteShape2 for the stipple and paints it LiteShape2 stippleShape = createStippleShape(stippleSize, translateX, translateY); paint(g, stippleShape, graphicFill, scale); } } }
/* * (non-Javadoc) * * @see org.jvnet.flamingo.ribbon.ui.BasicRibbonUI#paintTaskArea(java.awt. * Graphics , int, int, int, int) */ @Override protected void paintTaskArea(Graphics g, int x, int y, int width, int height) { if (this.ribbon.getTaskCount() == 0) return; Graphics2D g2d = (Graphics2D) g.create(); RibbonTask selectedTask = this.ribbon.getSelectedTask(); JRibbonTaskToggleButton selectedTaskButton = this.taskToggleButtons.get(selectedTask); Rectangle selectedTaskButtonBounds = selectedTaskButton.getBounds(); Point converted = SwingUtilities.convertPoint( selectedTaskButton.getParent(), selectedTaskButtonBounds.getLocation(), this.ribbon); float radius = SubstanceSizeUtils.getClassicButtonCornerRadius( SubstanceSizeUtils.getComponentFontSize(this.ribbon)); float borderDelta = SubstanceSizeUtils.getBorderStrokeWidth() / 2.0f; SubstanceBorderPainter borderPainter = SubstanceCoreUtilities.getBorderPainter(this.ribbon); float borderThickness = SubstanceSizeUtils.getBorderStrokeWidth(); AbstractRibbonBand band = (selectedTask.getBandCount() == 0) ? null : selectedTask.getBand(0); SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities.getColorScheme( band, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED); Rectangle taskToggleButtonsViewportBounds = taskToggleButtonsScrollablePanel.getView().getParent().getBounds(); taskToggleButtonsViewportBounds.setLocation( SwingUtilities.convertPoint( taskToggleButtonsScrollablePanel, taskToggleButtonsViewportBounds.getLocation(), this.ribbon)); int startSelectedX = Math.max(converted.x + 1, (int) taskToggleButtonsViewportBounds.getMinX()); startSelectedX = Math.min(startSelectedX, (int) taskToggleButtonsViewportBounds.getMaxX()); int endSelectedX = Math.min( converted.x + selectedTaskButtonBounds.width - 1, (int) taskToggleButtonsViewportBounds.getMaxX()); endSelectedX = Math.max(endSelectedX, (int) taskToggleButtonsViewportBounds.getMinX()); Shape outerContour = RibbonBorderShaper.getRibbonBorderOutline( this.ribbon, x + borderDelta, x + width - borderDelta, startSelectedX - borderThickness, endSelectedX + borderThickness, converted.y + borderDelta, y + borderDelta, y + height - borderDelta, radius); Shape innerContour = RibbonBorderShaper.getRibbonBorderOutline( this.ribbon, x + borderDelta + borderThickness, x + width - borderThickness - borderDelta, startSelectedX - borderThickness, endSelectedX + borderThickness, converted.y + borderDelta + borderThickness, y + borderDelta + borderThickness, y + height - borderThickness - borderDelta, radius); g2d.setColor( SubstanceColorSchemeUtilities.getColorScheme(band, ComponentState.ENABLED) .getBackgroundFillColor()); g2d.clipRect(x, y, width, height + 2); g2d.fill(outerContour); // g2d.setColor(Color.red); // g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_ON); // g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, // RenderingHints.VALUE_STROKE_PURE); // g2d.setStroke(new BasicStroke(0.5f)); // g2d.draw(outerContour); // g2d.setColor(Color.blue); // g2d.draw(innerContour); borderPainter.paintBorder( g2d, this.ribbon, width, height + selectedTaskButtonBounds.height + 1, outerContour, innerContour, borderScheme); // check whether the currently selected task is a contextual task RibbonTask selected = selectedTask; RibbonContextualTaskGroup contextualGroup = selected.getContextualGroup(); if (contextualGroup != null) { // paint a small gradient directly below the task area Insets ins = this.ribbon.getInsets(); int topY = ins.top + getTaskbarHeight(); int bottomY = topY + 5; Color hueColor = contextualGroup.getHueColor(); Paint paint = new GradientPaint( 0, topY, FlamingoUtilities.getAlphaColor( hueColor, (int) (255 * RibbonContextualTaskGroup.HUE_ALPHA)), 0, bottomY, FlamingoUtilities.getAlphaColor(hueColor, 0)); g2d.setPaint(paint); g2d.clip(outerContour); g2d.fillRect(0, topY, width, bottomY - topY + 1); } // paint outlines of the contextual task groups // paintContextualTaskGroupsOutlines(g); g2d.dispose(); }
public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp, Cancellable cancel) { switch (markerFillProperties.getFillStyle()) { case SINGLE_CENTERED_SYMBOL: // case a single marker is used into a polygon shapetype Geometry geom = FConverter.java2d_to_jts(shp); com.vividsolutions.jts.geom.Point centroid = geom.getCentroid(); /* * Hay ocasiones en que jts no puede calcular un centroide y * devuelve NaN (por ejemplo con geometrías poligonales cuyos puntos * tienen todos la misma abscisa y distinta ordenada con tan solo * una diferencia de 1 ó 2 unidades) entonces, en lugar de utilizar * este centroide tomamos el centro del bounds del shp (la geometría * es tan pequeña que consideramos que deben coincidir). */ if (!(Double.isNaN(centroid.getX()) || Double.isNaN(centroid.getY()))) { double centroidX = centroid.getX() + markerFillProperties.getXOffset(); double centroidY = centroid.getY() + markerFillProperties.getYOffset(); FPoint2D p = new FPoint2D(new Point2D.Double(centroidX, centroidY)); markerSymbol.draw(g, affineTransform, p, null); } else { double centroidX = shp.getBounds().getCenterX(); double centroidY = shp.getBounds().getCenterY(); FPoint2D p = new FPoint2D(new Point2D.Double(centroidX, centroidY)); markerSymbol.draw(g, affineTransform, p, null); } break; case GRID_FILL: // case a grid fill is used { Rectangle rClip = null; if (g.getClipBounds() != null) { rClip = (Rectangle) g.getClipBounds().clone(); g.setClip(rClip.x, rClip.y, rClip.width, rClip.height); } g.clip(shp); int size = (int) markerSymbol.getSize(); Rectangle rProv = new Rectangle(); rProv.setFrame(0, 0, size, size); Paint resulPatternFill = null; double xSeparation = markerFillProperties.getXSeparation(); // TODO // apply // CartographicSupport double ySeparation = markerFillProperties.getYSeparation(); // TODO // apply // CartographicSupport double xOffset = markerFillProperties.getXOffset(); double yOffset = markerFillProperties.getYOffset(); BufferedImage sample = null; sample = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); Graphics2D gAux = sample.createGraphics(); try { markerSymbol.drawInsideRectangle(gAux, gAux.getTransform(), rProv, null); } catch (SymbolDrawingException e) { if (e.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { try { SymbologyFactory.getWarningSymbol( SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, "", SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) .drawInsideRectangle(gAux, gAux.getTransform(), rProv, null); } catch (SymbolDrawingException e1) { // IMPOSSIBLE TO REACH THIS } } else { // should be unreachable code throw new Error(Messages.getString("symbol_shapetype_mismatch")); } } rProv.setRect(0, 0, rProv.getWidth() + xSeparation, rProv.getHeight() + ySeparation); BufferedImage bi = new BufferedImage(rProv.width, rProv.height, BufferedImage.TYPE_INT_ARGB); gAux = bi.createGraphics(); gAux.drawImage(sample, null, (int) (xSeparation * 0.5), (int) (ySeparation * 0.5)); resulPatternFill = new TexturePaint(bi, rProv); sample = null; gAux.dispose(); g.setColor(null); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.translate(xOffset, -yOffset); g.setPaint(resulPatternFill); g.fill(shp); g.translate(-xOffset, +yOffset); g.setClip(rClip); bi = null; } break; case RANDOM_FILL: { double s = markerSymbol.getSize(); Rectangle r = shp.getBounds(); int drawCount = (int) (Math.min(r.getWidth(), r.getHeight()) / s); Random random = new Random(); int minx = r.x; int miny = r.y; int width = r.width; int height = r.height; r = new Rectangle(); g.setClip(shp); for (int i = 0; (cancel == null || !cancel.isCanceled()) && i < drawCount; i++) { int x = (int) Math.abs(random.nextDouble() * width); int y = (int) Math.abs(random.nextDouble() * height); x = x + minx; y = y + miny; markerSymbol.draw(g, new AffineTransform(), new FPoint2D(x, y), cancel); } g.setClip(null); } break; } if (getOutline() != null) { getOutline().draw(g, affineTransform, shp, cancel); } }
/** * A given string is painted inside of a "Torn". The string is aligned with whatever part of the * tape is NOT torn. If both ends are torn, the string is aligned in the center. If neither end is * torn, the string is left aligned. * * @param g the graphics context to paint in * @param string the string to paint inside of a torn * @param x the x coordinate of the torn * @param y the y coordinate of the torn * @param align the alignment of the torn, as specified by either <CODE>Torn.TOP</CODE> (i.e. * <CODE>(x,y)</CODE> is the upper left), <CODE>Torn.MIDDLE</CODE>, or <CODE>Torn.BOTTOM * </CODE>. * @param width the width of the torn * @param left is the left end torn? * @param right is the right end torn? * @param select the character to draw as centered and selected, or -1 if no character should be * drawn as selected * @return the height of the resulting drawn "torn" */ public static float paintString( Graphics2D g, String string, float x, float y, int align, float width, boolean left, boolean right, int select) { // Convert the y coordinate into the alignment into the upper // left corner. FontMetrics metrics = g.getFontMetrics(); float toBaseline = PADDING + metrics.getAscent(); float height = toBaseline + PADDING + metrics.getDescent(); if (align == MIDDLE) y -= height * 0.5f; if (align == BOTTOM) y -= height; if (select > string.length()) select = string.length(); // Create the torn object. GeneralPath torn = getTorn(x, y, width, height, left, right); g.setColor(Color.white); g.fill(torn); // Prepare some measurements for putting the text in the right // place. float horizontalPadding = metrics.charWidth(' '); Graphics2D g2 = (Graphics2D) g.create(); g2.clip(torn); float dx = 0.0f; if (left) dx = (float) metrics.getStringBounds(string, g2).getWidth() - width + 2.0f * horizontalPadding; if (right) dx *= 0.5f; // Easy. if (select >= 0 && !left && right) { // Do that greying out and crap. String before = string.substring(0, select), after = string.substring(select); double bLength = metrics.getStringBounds(before, g2).getWidth(); double aLength = metrics.getStringBounds(after, g2).getWidth(); float aStart = bLength > width / 2.0f ? width / 2.0f : horizontalPadding + (float) bLength; float bStart = aStart - (float) bLength; g2.setColor(Color.gray); g2.drawString(before, x + bStart, y + toBaseline); g2.setColor(Color.black); g2.drawString(after, x + aStart, y + toBaseline); } else { if (select >= 0) { double l = metrics.getStringBounds(string.substring(0, select), g2).getWidth(); double c = metrics.getStringBounds(string.substring(select, select + 1), g2).getWidth(); g2.setColor(HIGHLIGHT_COLOR); g2.fillRect((int) (x + 0.5f * (width - c)), (int) y, (int) c, 100); dx = (float) (l + 0.5 * (c - width) + horizontalPadding); } g2.setColor(Color.black); // We finally get to draw the string. g2.drawString(string, x + horizontalPadding - dx, y + toBaseline); } g2.dispose(); // Finish by drawing the outline of the torn. g.setColor(Color.black); g.draw(torn); return height; }
/** * Draws the plot. This method is usually called by the {@link JFreeChart} instance that manages * the plot. * * @param g2 the graphics target. * @param area the area in which the plot should be drawn. * @param anchor the anchor point (typically the last point that the mouse clicked on, <code>null * </code> is permitted). * @param parentState the state for the parent plot (if any). * @param info used to collect plot rendering info (<code>null</code> permitted). */ @Override public void draw( Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { Shape origClip = g2.getClip(); g2.setClip(area); // first, expand the viewing area into a drawing frame Rectangle2D frame = viewToFrame(area); // draw the background if there is one... if (this.background != null && this.background.isVisible()) { if (this.background.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); this.background.draw(g2, this, frame, area); g2.setClip(savedClip); } else { this.background.draw(g2, this, frame, area); } } Iterator iterator = this.layers.iterator(); while (iterator.hasNext()) { DialLayer current = (DialLayer) iterator.next(); if (current.isVisible()) { if (current.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); current.draw(g2, this, frame, area); g2.setClip(savedClip); } else { current.draw(g2, this, frame, area); } } } // draw the pointers iterator = this.pointers.iterator(); while (iterator.hasNext()) { DialPointer current = (DialPointer) iterator.next(); if (current.isVisible()) { if (current.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); current.draw(g2, this, frame, area); g2.setClip(savedClip); } else { current.draw(g2, this, frame, area); } } } // draw the cap if there is one... if (this.cap != null && this.cap.isVisible()) { if (this.cap.isClippedToWindow()) { Shape savedClip = g2.getClip(); g2.clip(this.dialFrame.getWindow(frame)); this.cap.draw(g2, this, frame, area); g2.setClip(savedClip); } else { this.cap.draw(g2, this, frame, area); } } if (this.dialFrame.isVisible()) { this.dialFrame.draw(g2, this, frame, area); } g2.setClip(origClip); }