Java Code Examples for java.awt.Graphics2D#clip()
The following examples show how to use
java.awt.Graphics2D#clip() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IncorrectUnmanagedImageRotatedClip.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static void draw(final BufferedImage from,final Image to) { final Graphics2D g2d = (Graphics2D) to.getGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setColor(Color.ORANGE); g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null)); g2d.rotate(Math.toRadians(45)); g2d.clip(new Rectangle(41, 42, 43, 44)); g2d.drawImage(from, 50, 50, Color.blue, null); g2d.dispose(); }
Example 2
Source File: Plot.java From openstock with GNU General Public License v3.0 | 6 votes |
/** * Draws a message to state that there is no data to plot. * * @param g2 the graphics device. * @param area the area within which the plot should be drawn. */ protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) { Shape savedClip = g2.getClip(); g2.clip(area); String message = this.noDataMessage; if (message != null) { g2.setFont(this.noDataMessageFont); g2.setPaint(this.noDataMessagePaint); TextBlock block = TextUtilities.createTextBlock( this.noDataMessage, this.noDataMessageFont, this.noDataMessagePaint, 0.9f * (float) area.getWidth(), new G2TextMeasurer(g2)); block.draw(g2, (float) area.getCenterX(), (float) area.getCenterY(), TextBlockAnchor.CENTER); } g2.setClip(savedClip); }
Example 3
Source File: SymbolAxis.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Draws the grid bands. Alternate bands are colored using * <CODE>gridBandPaint<CODE> (<CODE>DEFAULT_GRID_BAND_PAINT</CODE> by * default). * * @param g2 the graphics device. * @param plotArea the area within which the chart should be drawn. * @param dataArea the area within which the plot should be drawn (a * subset of the drawArea). * @param edge the axis location. * @param ticks the ticks. */ protected void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) { Shape savedClip = g2.getClip(); g2.clip(dataArea); if (RectangleEdge.isTopOrBottom(edge)) { drawGridBandsHorizontal(g2, plotArea, dataArea, true, ticks); } else if (RectangleEdge.isLeftOrRight(edge)) { drawGridBandsVertical(g2, plotArea, dataArea, true, ticks); } g2.setClip(savedClip); }
Example 4
Source File: FocusedBorder.java From PyramidShader with GNU General Public License v3.0 | 6 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Insets insets = getBorderInsets(c); if(c.hasFocus()) { Rectangle rect = new Rectangle(x+insets.left, y+insets.top, width-insets.left-insets.right-1, height-insets.top-insets.bottom-1); Graphics2D g2 = (Graphics2D)g.create(); GeneralPath focusOnly = new GeneralPath(Path2D.WIND_EVEN_ODD); focusOnly.append(new Rectangle(x,y,width,height), false); focusOnly.append(new Rectangle(x+insets.left,y+insets.top, width-insets.left-insets.right, height-insets.top-insets.bottom), false); g2.clip(focusOnly); PlafPaintUtils.paintFocus(g2, rect, 3); } else if(unfocusedBorder!=null) { Insets borderInsets = unfocusedBorder.getBorderInsets(c); unfocusedBorder.paintBorder(c, g, x+insets.left-borderInsets.left, y+insets.top-borderInsets.top, width-insets.left-insets.right+borderInsets.left+borderInsets.right, height-insets.top-insets.bottom+borderInsets.top+borderInsets.bottom); } }
Example 5
Source File: IncorrectUnmanagedImageRotatedClip.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void draw(final BufferedImage from,final Image to) { final Graphics2D g2d = (Graphics2D) to.getGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setColor(Color.ORANGE); g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null)); g2d.rotate(Math.toRadians(45)); g2d.clip(new Rectangle(41, 42, 43, 44)); g2d.drawImage(from, 50, 50, Color.blue, null); g2d.dispose(); }
Example 6
Source File: IncorrectUnmanagedImageRotatedClip.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void draw(final BufferedImage from,final Image to) { final Graphics2D g2d = (Graphics2D) to.getGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setColor(Color.ORANGE); g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null)); g2d.rotate(Math.toRadians(45)); g2d.clip(new Rectangle(41, 42, 43, 44)); g2d.drawImage(from, 50, 50, Color.blue, null); g2d.dispose(); }
Example 7
Source File: IncorrectUnmanagedImageRotatedClip.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void draw(final BufferedImage from,final Image to) { final Graphics2D g2d = (Graphics2D) to.getGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setColor(Color.ORANGE); g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null)); g2d.rotate(Math.toRadians(45)); g2d.clip(new Rectangle(41, 42, 43, 44)); g2d.drawImage(from, 50, 50, Color.blue, null); g2d.dispose(); }
Example 8
Source File: IncorrectUnmanagedImageRotatedClip.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void draw(final BufferedImage from,final Image to) { final Graphics2D g2d = (Graphics2D) to.getGraphics(); g2d.setComposite(AlphaComposite.Src); g2d.setColor(Color.ORANGE); g2d.fillRect(0, 0, to.getWidth(null), to.getHeight(null)); g2d.rotate(Math.toRadians(45)); g2d.clip(new Rectangle(41, 42, 43, 44)); g2d.drawImage(from, 50, 50, Color.blue, null); g2d.dispose(); }
Example 9
Source File: LogicalPageDrawable.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
public void clip( final StrictBounds bounds ) { final Graphics2D g = getGraphics(); graphicsContexts.push( g ); graphics = (Graphics2D) g.create(); graphics.clip( StrictGeomUtility.createAWTRectangle( bounds ) ); }
Example 10
Source File: GraphicsTests.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void initContext(TestEnvironment env, Context ctx) { ctx.graphics = env.getGraphics(); int w = env.getWidth(); int h = env.getHeight(); ctx.size = env.getIntValue(sizeList); ctx.outdim = getOutputSize(ctx.size, ctx.size); ctx.pixscale = 1.0; if (hasGraphics2D) { Graphics2D g2d = (Graphics2D) ctx.graphics; AlphaComposite ac = (AlphaComposite) env.getModifier(compRules); if (env.isEnabled(doExtraAlpha)) { ac = AlphaComposite.getInstance(ac.getRule(), 0.125f); } g2d.setComposite(ac); if (env.isEnabled(doXor)) { g2d.setXORMode(Color.white); } if (env.isEnabled(doClipping)) { Polygon p = new Polygon(); p.addPoint(0, 0); p.addPoint(w, 0); p.addPoint(0, h); p.addPoint(w, h); p.addPoint(0, 0); g2d.clip(p); } Transform tx = (Transform) env.getModifier(transforms); Dimension envdim = new Dimension(w, h); tx.init(g2d, ctx, envdim); w = envdim.width; h = envdim.height; g2d.setRenderingHint(RenderingHints.KEY_RENDERING, env.getModifier(renderHint)); } switch (env.getIntValue(animList)) { case 0: ctx.animate = false; ctx.maxX = 3; ctx.maxY = 1; ctx.orgX = (w - ctx.outdim.width) / 2; ctx.orgY = (h - ctx.outdim.height) / 2; break; case 1: ctx.animate = true; ctx.maxX = Math.max(Math.min(32, w - ctx.outdim.width), 3); ctx.maxY = 1; ctx.orgX = (w - ctx.outdim.width - ctx.maxX) / 2; ctx.orgY = (h - ctx.outdim.height) / 2; break; case 2: ctx.animate = true; ctx.maxX = (w - ctx.outdim.width) + 1; ctx.maxY = (h - ctx.outdim.height) + 1; ctx.maxX = adjustWidth(ctx.maxX, ctx.maxY); ctx.maxX = Math.max(ctx.maxX, 3); ctx.maxY = Math.max(ctx.maxY, 1); // ctx.orgX = ctx.orgY = 0; break; } ctx.initX = ctx.maxX / 2; ctx.initY = ctx.maxY / 2; }
Example 11
Source File: SpiderWebPlot.java From astor with GNU General Public License v2.0 | 4 votes |
/** * 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) { // adjust for insets... RectangleInsets insets = getInsets(); insets.trim(area); if (info != null) { info.setPlotArea(area); info.setDataArea(area); } drawBackground(g2, area); drawOutline(g2, area); Shape savedClip = g2.getClip(); g2.clip(area); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); if (!DatasetUtilities.isEmptyOrNull(this.dataset)) { int seriesCount = 0, catCount = 0; if (this.dataExtractOrder == TableOrder.BY_ROW) { seriesCount = this.dataset.getRowCount(); catCount = this.dataset.getColumnCount(); } else { seriesCount = this.dataset.getColumnCount(); catCount = this.dataset.getRowCount(); } // ensure we have a maximum value to use on the axes if (this.maxValue == DEFAULT_MAX_VALUE) calculateMaxValue(seriesCount, catCount); // Next, setup the plot area // adjust the plot area by the interior spacing value double gapHorizontal = area.getWidth() * getInteriorGap(); double gapVertical = area.getHeight() * getInteriorGap(); double X = area.getX() + gapHorizontal / 2; double Y = area.getY() + gapVertical / 2; double W = area.getWidth() - gapHorizontal; double H = area.getHeight() - gapVertical; double headW = area.getWidth() * this.headPercent; double headH = area.getHeight() * this.headPercent; // make the chart area a square double min = Math.min(W, H) / 2; X = (X + X + W) / 2 - min; Y = (Y + Y + H) / 2 - min; W = 2 * min; H = 2 * min; Point2D centre = new Point2D.Double(X + W / 2, Y + H / 2); Rectangle2D radarArea = new Rectangle2D.Double(X, Y, W, H); // draw the axis and category label for (int cat = 0; cat < catCount; cat++) { double angle = getStartAngle() + (getDirection().getFactor() * cat * 360 / catCount); Point2D endPoint = getWebPoint(radarArea, angle, 1); // 1 = end of axis Line2D line = new Line2D.Double(centre, endPoint); g2.setPaint(this.axisLinePaint); g2.setStroke(this.axisLineStroke); g2.draw(line); drawLabel(g2, radarArea, 0.0, cat, angle, 360.0 / catCount); } // Now actually plot each of the series polygons.. for (int series = 0; series < seriesCount; series++) { drawRadarPoly(g2, radarArea, centre, info, series, catCount, headH, headW); } } else { drawNoDataMessage(g2, area); } g2.setClip(savedClip); g2.setComposite(originalComposite); drawOutline(g2, area); }
Example 12
Source File: DialValueIndicator.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * 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); }
Example 13
Source File: CSSBorder.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
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(); }
Example 14
Source File: ContourPlot.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Draws a representation of the data within the dataArea region, using the * current renderer. * <P> * The <code>info</code> and <code>crosshairState</code> arguments may be * <code>null</code>. * * @param g2 the graphics device. * @param dataArea the region in which the data is to be drawn. * @param info an optional object for collection dimension information. * @param crosshairState an optional object for collecting crosshair info. */ public void render(Graphics2D g2, Rectangle2D dataArea, PlotRenderingInfo info, CrosshairState crosshairState) { // now get the data and plot it (the visual representation will depend // on the renderer that has been set)... ContourDataset data = getDataset(); if (data != null) { ColorBar zAxis = getColorBar(); if (this.clipPath != null) { GeneralPath clipper = getClipPath().draw(g2, dataArea, this.domainAxis, this.rangeAxis); if (this.clipPath.isClip()) { g2.clip(clipper); } } if (this.renderAsPoints) { pointRenderer(g2, dataArea, info, this, this.domainAxis, this.rangeAxis, zAxis, data, crosshairState); } else { contourRenderer(g2, dataArea, info, this, this.domainAxis, this.rangeAxis, zAxis, data, crosshairState); } // draw vertical crosshair if required... setDomainCrosshairValue(crosshairState.getCrosshairX(), false); if (isDomainCrosshairVisible()) { drawVerticalLine(g2, dataArea, getDomainCrosshairValue(), getDomainCrosshairStroke(), getDomainCrosshairPaint()); } // draw horizontal crosshair if required... setRangeCrosshairValue(crosshairState.getCrosshairY(), false); if (isRangeCrosshairVisible()) { drawHorizontalLine(g2, dataArea, getRangeCrosshairValue(), getRangeCrosshairStroke(), getRangeCrosshairPaint()); } } else if (this.clipPath != null) { getClipPath().draw(g2, dataArea, this.domainAxis, this.rangeAxis); } }
Example 15
Source File: FastScatterPlot.java From ccu-historian with GNU General Public License v3.0 | 4 votes |
/** * Draws the fast scatter 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 (including axis labels) * should be drawn. * @param anchor the anchor point (<code>null</code> permitted). * @param parentState the state from the parent plot (ignored). * @param info collects chart drawing information (<code>null</code> * permitted). */ @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { // set up info collection... if (info != null) { info.setPlotArea(area); } // adjust the drawing area for plot insets (if any)... RectangleInsets insets = getInsets(); insets.trim(area); AxisSpace space = new AxisSpace(); space = this.domainAxis.reserveSpace(g2, this, area, RectangleEdge.BOTTOM, space); space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT, space); Rectangle2D dataArea = space.shrink(area, null); if (info != null) { info.setDataArea(dataArea); } // draw the plot background and axes... drawBackground(g2, dataArea); AxisState domainAxisState = this.domainAxis.draw(g2, dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info); AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(), area, dataArea, RectangleEdge.LEFT, info); drawDomainGridlines(g2, dataArea, domainAxisState.getTicks()); drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks()); Shape originalClip = g2.getClip(); Composite originalComposite = g2.getComposite(); g2.clip(dataArea); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); render(g2, dataArea, info, null); g2.setClip(originalClip); g2.setComposite(originalComposite); drawOutline(g2, dataArea); }
Example 16
Source File: PolarPlot.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Draws the plot on a Java 2D graphics device (such as the screen or a * printer). * <P> * This plot relies on a {@link PolarItemRenderer} to draw each * item in the plot. This allows the visual representation of the data to * be changed easily. * <P> * The optional info argument collects information about the rendering of * the plot (dimensions, tooltip information etc). Just pass in * <code>null</code> if you do not need this information. * * @param g2 the graphics device. * @param area the area within which the plot (including axes and * labels) should be drawn. * @param anchor the anchor point (<code>null</code> permitted). * @param parentState ignored. * @param info collects chart drawing information (<code>null</code> * permitted). */ public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { // if the plot area is too small, just return... boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW); boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW); if (b1 || b2) { return; } // record the plot area... if (info != null) { info.setPlotArea(area); } // adjust the drawing area for the plot insets (if any)... RectangleInsets insets = getInsets(); insets.trim(area); Rectangle2D dataArea = area; if (info != null) { info.setDataArea(dataArea); } // draw the plot background and axes... drawBackground(g2, dataArea); double h = Math.min(dataArea.getWidth() / 2.0, dataArea.getHeight() / 2.0) - MARGIN; Rectangle2D quadrant = new Rectangle2D.Double(dataArea.getCenterX(), dataArea.getCenterY(), h, h); AxisState state = drawAxis(g2, area, quadrant); if (this.renderer != null) { Shape originalClip = g2.getClip(); Composite originalComposite = g2.getComposite(); g2.clip(dataArea); g2.setComposite(AlphaComposite.getInstance( AlphaComposite.SRC_OVER, getForegroundAlpha())); this.angleTicks = refreshAngleTicks(); drawGridlines(g2, dataArea, this.angleTicks, state.getTicks()); // draw... render(g2, dataArea, info); g2.setClip(originalClip); g2.setComposite(originalComposite); } drawOutline(g2, dataArea); drawCornerTextItems(g2, dataArea); }
Example 17
Source File: FastScatterPlot.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Draws the fast scatter 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 (including axis labels) * should be drawn. * @param anchor the anchor point (<code>null</code> permitted). * @param parentState the state from the parent plot (ignored). * @param info collects chart drawing information (<code>null</code> * permitted). */ @Override public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) { // set up info collection... if (info != null) { info.setPlotArea(area); } // adjust the drawing area for plot insets (if any)... RectangleInsets insets = getInsets(); insets.trim(area); AxisSpace space = new AxisSpace(); space = this.domainAxis.reserveSpace(g2, this, area, RectangleEdge.BOTTOM, space); space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT, space); Rectangle2D dataArea = space.shrink(area, null); if (info != null) { info.setDataArea(dataArea); } // draw the plot background and axes... drawBackground(g2, dataArea); AxisState domainAxisState = this.domainAxis.draw(g2, dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info); AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(), area, dataArea, RectangleEdge.LEFT, info); drawDomainGridlines(g2, dataArea, domainAxisState.getTicks()); drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks()); Shape originalClip = g2.getClip(); Composite originalComposite = g2.getComposite(); g2.clip(dataArea); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())); render(g2, dataArea, info, null); g2.setClip(originalClip); g2.setComposite(originalComposite); drawOutline(g2, dataArea); }
Example 18
Source File: SymbolAxis.java From ECG-Viewer with GNU General Public License v2.0 | 3 votes |
/** * Draws the grid bands. Alternate bands are colored using * <CODE>gridBandPaint</CODE> (<CODE>DEFAULT_GRID_BAND_PAINT</CODE> by * default). * * @param g2 the graphics target (<code>null</code> not permitted). * @param plotArea the area within which the plot is drawn * (<code>null</code> not permitted). * @param dataArea the data area to which the axes are aligned * (<code>null</code> not permitted). * @param edge the edge to which the axis is aligned (<code>null</code> not * permitted). * @param ticks the ticks (<code>null</code> not permitted). */ protected void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) { Shape savedClip = g2.getClip(); g2.clip(dataArea); if (RectangleEdge.isTopOrBottom(edge)) { drawGridBandsHorizontal(g2, plotArea, dataArea, true, ticks); } else if (RectangleEdge.isLeftOrRight(edge)) { drawGridBandsVertical(g2, plotArea, dataArea, true, ticks); } g2.setClip(savedClip); }
Example 19
Source File: SymbolAxis.java From buffer_bci with GNU General Public License v3.0 | 3 votes |
/** * Draws the grid bands. Alternate bands are colored using * <CODE>gridBandPaint</CODE> (<CODE>DEFAULT_GRID_BAND_PAINT</CODE> by * default). * * @param g2 the graphics target (<code>null</code> not permitted). * @param plotArea the area within which the plot is drawn * (<code>null</code> not permitted). * @param dataArea the data area to which the axes are aligned * (<code>null</code> not permitted). * @param edge the edge to which the axis is aligned (<code>null</code> not * permitted). * @param ticks the ticks (<code>null</code> not permitted). */ protected void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) { Shape savedClip = g2.getClip(); g2.clip(dataArea); if (RectangleEdge.isTopOrBottom(edge)) { drawGridBandsHorizontal(g2, plotArea, dataArea, true, ticks); } else if (RectangleEdge.isLeftOrRight(edge)) { drawGridBandsVertical(g2, plotArea, dataArea, true, ticks); } g2.setClip(savedClip); }
Example 20
Source File: SymbolAxis.java From ccu-historian with GNU General Public License v3.0 | 3 votes |
/** * Draws the grid bands. Alternate bands are colored using * <CODE>gridBandPaint</CODE> (<CODE>DEFAULT_GRID_BAND_PAINT</CODE> by * default). * * @param g2 the graphics target (<code>null</code> not permitted). * @param plotArea the area within which the plot is drawn * (<code>null</code> not permitted). * @param dataArea the data area to which the axes are aligned * (<code>null</code> not permitted). * @param edge the edge to which the axis is aligned (<code>null</code> not * permitted). * @param ticks the ticks (<code>null</code> not permitted). */ protected void drawGridBands(Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, List ticks) { Shape savedClip = g2.getClip(); g2.clip(dataArea); if (RectangleEdge.isTopOrBottom(edge)) { drawGridBandsHorizontal(g2, plotArea, dataArea, true, ticks); } else if (RectangleEdge.isLeftOrRight(edge)) { drawGridBandsVertical(g2, plotArea, dataArea, true, ticks); } g2.setClip(savedClip); }