java.awt.geom.Path2D Java Examples
The following examples show how to use
java.awt.geom.Path2D.
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: LocalAreaUtil.java From mars-sim with GNU General Public License v3.0 | 6 votes |
/** * Create a thin (1 mm wide) rectangle path representing a line. * * @param line the line. * @return rectangle path for the line. */ private static Path2D createLinePath(Line2D line) { // Make rectangle width 1mm. double width = .001D; double length = line.getP1().distance(line.getP2()); double centerX = (line.getX1() + line.getX2()) / 2D; double centerY = (line.getY1() + line.getY2()) / 2D; double x1 = centerX - (width / 2D); double y1 = centerY - (length / 2D); Rectangle2D lineRect = new Rectangle2D.Double(x1, y1, width, length); double facing = getDirection(line.getP1(), line.getP2()); Path2D rectPath = getPathFromRectangleRotation(lineRect, facing); return rectPath; }
Example #2
Source File: AccuracyTest.java From pumpernickel with MIT License | 6 votes |
private GeneralPath getShape(int index) { Random r = new Random(index * 100000); GeneralPath path = new GeneralPath( r.nextBoolean() ? Path2D.WIND_EVEN_ODD : Path2D.WIND_NON_ZERO); path.moveTo(r.nextFloat() * 100, r.nextFloat() * 100); for (int a = 0; a < 3; a++) { int k; if (type.getSelectedIndex() == 0) { k = r.nextInt(3); } else { k = type.getSelectedIndex() - 1; } if (k == 0) { path.lineTo(r.nextFloat() * 100, r.nextFloat() * 100); } else if (k == 1) { path.quadTo(r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100); } else { path.curveTo(r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100, r.nextFloat() * 100); } } return path; }
Example #3
Source File: NamedProgressBarRegionPainter.java From bither-desktop-java with Apache License 2.0 | 6 votes |
private Path2D decodePath3() { path.reset(); path.moveTo(decodeX(0.0f), decodeY(1.3333334f)); path.curveTo(decodeAnchorX(0.0f, 2.678571428571433f), decodeAnchorY(1.3333333730697632f, 8.881784197001252E-16f), decodeAnchorX(1.3678570985794067f, -6.214285714285715f), decodeAnchorY(0.20714285969734192f, -0.03571428571428292f), decodeX(1.3678571f), decodeY(0.20714286f)); path.lineTo(decodeX(1.5642858f), decodeY(0.20714286f)); path.curveTo(decodeAnchorX(1.5642857551574707f, 8.329670329670357f), decodeAnchorY(0.20714285969734192f, 0.002747252747249629f), decodeAnchorX(2.5999999046325684f, -5.2857142857142705f), decodeAnchorY(1.3333333730697632f, 0.03571428571428559f), decodeX(2.6f), decodeY(1.3333334f)); path.lineTo(decodeX(3.0f), decodeY(1.3333334f)); path.lineTo(decodeX(3.0f), decodeY(1.6666667f)); path.lineTo(decodeX(2.6f), decodeY(1.6666667f)); path.curveTo(decodeAnchorX(2.5999999046325684f, -5.321428571428569f), decodeAnchorY(1.6666667461395264f, 0.0357142857142847f), decodeAnchorX(1.5642857551574707f, 8.983516483516496f), decodeAnchorY(2.799999952316284f, 0.03846153846153122f), decodeX(1.5642858f), decodeY(2.8f)); path.lineTo(decodeX(1.3892857f), decodeY(2.8f)); path.curveTo(decodeAnchorX(1.389285683631897f, -6.714285714285704f), decodeAnchorY(2.799999952316284f, 0.0f), decodeAnchorX(0.0f, 2.6071428571428568f), decodeAnchorY(1.6666667461395264f, 0.03571428571428559f), decodeX(0.0f), decodeY(1.6666667f)); path.lineTo(decodeX(0.0f), decodeY(1.3333334f)); path.closePath(); return path; }
Example #4
Source File: Path2DCopyConstructor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static void testAddCubic(Path2D pathA, boolean isEmpty) { try { addCubics(pathA); } catch (IllegalPathStateException ipse) { if (isEmpty) { log("testAddCubic: passed " + "(expected IllegalPathStateException catched)."); return; } else { throw ipse; } } if (isEmpty) { throw new IllegalStateException("IllegalPathStateException not thrown !"); } log("testAddCubic: passed."); }
Example #5
Source File: TemporalGraph2DRenderer.java From diirt with MIT License | 6 votes |
private static Path2D.Double nearestNeighbour(double[] scaledX, double[] scaledY) { Path2D.Double line = new Path2D.Double(); line.moveTo(scaledX[0], scaledY[0]); for (int i = 1; i < scaledY.length; i++) { double halfX = scaledX[i - 1] + (scaledX[i] - scaledX[i - 1]) / 2; if (!java.lang.Double.isNaN(scaledY[i-1])) { line.lineTo(halfX, scaledY[i - 1]); if (!java.lang.Double.isNaN(scaledY[i])) line.lineTo(halfX, scaledY[i]); } else { line.moveTo(halfX, scaledY[i]); } } line.lineTo(scaledX[scaledX.length - 1], scaledY[scaledY.length - 1]); return line; }
Example #6
Source File: Path2DCopyConstructor.java From hottub with GNU General Public License v2.0 | 6 votes |
static void testAddCubic(Path2D pathA, boolean isEmpty) { try { addCubics(pathA); } catch (IllegalPathStateException ipse) { if (isEmpty) { log("testAddCubic: passed " + "(expected IllegalPathStateException catched)."); return; } else { throw ipse; } } if (isEmpty) { throw new IllegalStateException("IllegalPathStateException not thrown !"); } log("testAddCubic: passed."); }
Example #7
Source File: GDIRenderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
void doShape(SunGraphics2D sg2d, Shape s, boolean isfill) { Path2D.Float p2df; int transX; int transY; if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transX = sg2d.transX; transY = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transX = 0; transY = 0; } try { doShape((GDIWindowSurfaceData)sg2d.surfaceData, sg2d.getCompClip(), sg2d.composite, sg2d.eargb, transX, transY, p2df, isfill); } catch (ClassCastException e) { throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData); } }
Example #8
Source File: DG_KGrid_KPolygonWithLabelledKGridInsideIt.java From Geom_Kisrhombille with GNU General Public License v3.0 | 6 votes |
private void renderNorthArrow(double[] pt0,double[] pt1){ // double da=GD.getDirection_PointPoint(pt0[0],pt0[1],pt1[0],pt1[1]), dright=GD.normalizeDirection(da+GD.HALFPI), dleft=GD.normalizeDirection(da-GD.HALFPI); double[] p0=GD.getPoint_PointDirectionInterval(pt0[0],pt0[1],da,ARROWOFFSET0), p1=GD.getPoint_PointDirectionInterval(p0[0],p0[1],da,ARROWSHAFTLENGTH), p2=GD.getPoint_PointDirectionInterval(p1[0],p1[1],da,ARROWHEADLENGTH), pleft=GD.getPoint_PointDirectionInterval(p1[0],p1[1],dleft,ARROWHEADWIDTH), pright=GD.getPoint_PointDirectionInterval(p1[0],p1[1],dright,ARROWHEADWIDTH); Path2D path=new Path2D.Double(); path.moveTo(p0[0],p0[1]); path.lineTo(p1[0],p1[1]); graphics.setStroke(createStroke(STROKETHICKNESS2*imagescale)); graphics.draw(path); path=new Path2D.Double(); path.moveTo(p2[0],p2[1]); path.lineTo(pleft[0],pleft[1]); path.lineTo(pright[0],pright[1]); path.closePath(); graphics.fill(path);}
Example #9
Source File: GridIndex.java From data-polygamy with BSD 3-Clause "New" or "Revised" License | 6 votes |
public int getRegion(double x, double y) { int stx = getXIndex(x); int sty = getYIndex(y); if(stx >= xs) { stx = xs - 1; } if(sty >= ys) { sty = ys - 1; } if(stx < 0) { stx = 0; } if(sty < 0) { sty = 0; } for(int p: grid[stx][sty].polys) { Path2D.Double poly = polygons.get(p); if(poly.contains(x, y)) { return p; } } return -1; }
Example #10
Source File: Path2DCopyConstructor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static void testAddQuad(Path2D pathA, boolean isEmpty) { try { addQuads(pathA); } catch (IllegalPathStateException ipse) { if (isEmpty) { log("testAddQuad: passed " + "(expected IllegalPathStateException catched)."); return; } else { throw ipse; } } if (isEmpty) { throw new IllegalStateException("IllegalPathStateException not thrown !"); } log("testAddQuad: passed."); }
Example #11
Source File: GridOverlayPainter.java From Forsythia with GNU General Public License v3.0 | 6 votes |
private void renderArrowHead(Graphics2D graphics,GlyphSystemModel glyphsystemmodel,Color color){ graphics.setPaint(color); DPoint p0=glyphsystemmodel.glyphpath.get(glyphsystemmodel.glyphpath.size()-2), p1=glyphsystemmodel.glyphpath.get(glyphsystemmodel.glyphpath.size()-1); double forward=p0.getDirection(p1); DPoint forewardpoint=p1.getPoint( forward, UI.EDITJIG_EDITSECTIONS_GLYPHARROWLENGTH*UI.EDITJIG_EDITSECTIONS_GLYPHINSET), leftpoint=p1.getPoint( GD.normalizeDirection(forward-GD.HALFPI), UI.EDITJIG_EDITSECTIONS_GLYPHARROWWIDTH*UI.EDITJIG_EDITSECTIONS_GLYPHINSET/2), rightpoint=p1.getPoint( GD.normalizeDirection(forward+GD.HALFPI), UI.EDITJIG_EDITSECTIONS_GLYPHARROWWIDTH*UI.EDITJIG_EDITSECTIONS_GLYPHINSET/2); Path2D triangle=new Path2D.Double(); triangle.moveTo(leftpoint.x,leftpoint.y); triangle.lineTo(forewardpoint.x,forewardpoint.y); triangle.lineTo(rightpoint.x,rightpoint.y); triangle.closePath(); graphics.fill(triangle);}
Example #12
Source File: VisualBundle.java From workcraft with MIT License | 6 votes |
@Override public void draw(DrawRequest r) { Graphics2D g = r.getGraphics(); Decoration d = r.getDecoration(); Path2D shape = new Path2D.Double(); float w = (float) strokeWidth / 4.0f; if (spanningTree == null) { HashSet<Point2D> points = new HashSet<>(); Collection<VisualBundledTransition> transitions = ((VisualPolicy) r.getModel()).getTransitionsOfBundle(this); for (VisualBundledTransition t: transitions) { Point2D point = TransformHelper.getTransformToRoot(t).transform(t.getCenter(), null); points.add(point); } spanningTree = buildSpanningTree(points); } for (Line2D l: spanningTree) { shape.moveTo(l.getX1(), l.getY1()); shape.lineTo(l.getX2(), l.getY2()); } g.setColor(ColorUtils.colorise(color, d.getColorisation())); g.setStroke(new BasicStroke(w, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 1.0f, new float[]{10 * w, 10 * w}, 0.0f)); g.draw(shape); }
Example #13
Source File: Path2DCopyConstructor.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static void testGetBounds(Path2D pathA, Path2D pathB) { final Rectangle rA = pathA.getBounds(); final Rectangle rB = pathB.getBounds(); if (!rA.equals(rB)) { throw new IllegalStateException("Bounds are not equals [" + rA + "|" + rB + "] !"); } final Rectangle2D r2dA = pathA.getBounds2D(); final Rectangle2D r2dB = pathB.getBounds2D(); if (!equalsRectangle2D(r2dA, r2dB)) { throw new IllegalStateException("Bounds2D are not equals [" + r2dA + "|" + r2dB + "] !"); } log("testGetBounds: passed."); }
Example #14
Source File: Path2DCopyConstructor.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
static void testAddQuad(Path2D pathA, boolean isEmpty) { try { addQuads(pathA); } catch (IllegalPathStateException ipse) { if (isEmpty) { log("testAddQuad: passed " + "(expected IllegalPathStateException catched)."); return; } else { throw ipse; } } if (isEmpty) { throw new IllegalStateException("IllegalPathStateException not thrown !"); } log("testAddQuad: passed."); }
Example #15
Source File: CurveToCommand.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void execute(Path2D.Double path, Context ctx){ double x1 = ctx.getValue(arg1); double y1 = ctx.getValue(arg2); double x2 = ctx.getValue(arg3); double y2 = ctx.getValue(arg4); double x3 = ctx.getValue(arg5); double y3 = ctx.getValue(arg6); path.curveTo(x1, y1, x2, y2, x3, y3); }
Example #16
Source File: NoteHeadsBuilder.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
@Override public Area getArea (double above, double below) { Path2D path = new Path2D.Double(); path.moveTo(left.getX(), left.getY() + above); path.lineTo(right.getX(), right.getY() + above); path.lineTo(right.getX(), right.getY() + below + 1); path.lineTo(left.getX(), left.getY() + below + 1); path.closePath(); return new Area(path); }
Example #17
Source File: X11Renderer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void XDoPath(SunGraphics2D sg2d, long pXSData, long xgc, int transX, int transY, Path2D.Float p2df, boolean isFill) { GraphicsPrimitive.tracePrimitive(isFill ? "X11FillPath" : "X11DrawPath"); super.XDoPath(sg2d, pXSData, xgc, transX, transY, p2df, isFill); }
Example #18
Source File: RouteCalculator.java From triplea with GNU General Public License v3.0 | 5 votes |
/** * A List of Lines which represent all possible lines on multiple screens size may vary. * * @param xcoords an array of xCoordinates * @param ycoords an array of yCoordinates * @return a List of corresponding Lines on every possible screen */ public List<Path2D> getAllNormalizedLines(final double[] xcoords, final double[] ycoords) { final Path2D path = getNormalizedLines(xcoords, ycoords); return MapScrollUtil.getPossibleTranslations(isInfiniteX, isInfiniteY, mapWidth, mapHeight) .stream() .map(t -> new Path2D.Double(path, t)) .collect(Collectors.toList()); }
Example #19
Source File: AwtRenderingBackend.java From htmlunit with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ public void clip(final RenderingBackend.WindingRule windingRule, final com.gargoylesoftware.htmlunit.javascript.host.canvas.Path2D path) { if (LOG.isDebugEnabled()) { LOG.debug("[" + id_ + "] clip(" + windingRule + ", " + path + ")"); } if (path == null && subPaths_.isEmpty()) { graphics2D_.setClip(null); return; } final Path2D currentPath; if (path == null) { currentPath = subPaths_.get(subPaths_.size() - 1); } else { // currentPath = path.getPath2D(); currentPath = null; } currentPath.closePath(); switch (windingRule) { case NON_ZERO: currentPath.setWindingRule(Path2D.WIND_NON_ZERO); break; default: currentPath.setWindingRule(Path2D.WIND_EVEN_ODD); break; } graphics2D_.clip(currentPath); }
Example #20
Source File: ShapeBoundsDemo.java From pumpernickel with MIT License | 5 votes |
private Path2D.Double createPath() { Random r = new Random(0); int numberOfSegments = 20; Path2D.Double p = new Path2D.Double(); p.moveTo(1000 * r.nextFloat(), 1000 * r.nextFloat()); for (int b = 0; b < numberOfSegments; b++) { p.curveTo(1000 * r.nextFloat(), 1000 * r.nextFloat(), 1000 * r.nextFloat(), 1000 * r.nextFloat(), 1000 * r.nextFloat(), 1000 * r.nextFloat()); } p.closePath(); return p; }
Example #21
Source File: VisualSyncComponent.java From workcraft with MIT License | 5 votes |
@Override public Shape getShape() { Path2D shape = new Path2D.Double(); shape.moveTo(-0.5 * SIZE, -0.4 * SIZE); shape.lineTo(-0.5 * SIZE, +0.4 * SIZE + (xOffset * 0.5)); shape.lineTo(+0.5 * SIZE, +0.4 * SIZE + (xOffset * 0.5)); shape.lineTo(+0.5 * SIZE, -0.4 * SIZE); shape.closePath(); return shape; }
Example #22
Source File: GeneralRenderer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transx, int transy, Path2D.Float p2df) { PixelWriter pw = GeneralRenderer.createXorPixelWriter(sg2d, sData); ProcessPath.fillPath( new PixelWriterDrawHandler(sData, pw, sg2d.getCompClip(), sg2d.strokeHint), p2df, transx, transy); }
Example #23
Source File: EditSelectionOperation.java From WorldPainter with GNU General Public License v3.0 | 5 votes |
@Override protected void tick(int centreX, int centreY, boolean inverse, boolean first, float dynamicLevel) { // Create a geometric shape corresponding to the brush size, shape and // rotation Shape shape; final Brush brush = getBrush(); final int brushRadius = brush.getRadius(); switch (brush.getBrushShape()) { case BITMAP: case SQUARE: shape = new Rectangle(centreX - brushRadius, centreY - brushRadius, brushRadius * 2 + 1, brushRadius * 2 + 1); if (brush instanceof RotatedBrush) { int rotation = ((RotatedBrush) brush).getDegrees(); if (rotation != 0) { shape = new Path2D.Float(shape, AffineTransform.getRotateInstance(rotation / DEGREES_TO_RADIANS, centreX, centreY)); } } break; case CIRCLE: shape = new Arc2D.Float(centreX - brushRadius, centreY - brushRadius, brushRadius * 2 + 1, brushRadius * 2 + 1, 0.0f, 360.0f, Arc2D.CHORD); break; default: throw new InternalError(); } final Dimension dimension = getDimension(); dimension.setEventsInhibited(true); try { SelectionHelper selectionHelper = new SelectionHelper(dimension); if (inverse) { selectionHelper.removeFromSelection(shape); } else { selectionHelper.addToSelection(shape); // TODO: make this work correctly with undo/redo, and make "inside selection" ineffective when there is no selection, to avoid confusion // selectionState.setValue(true); } } finally { dimension.setEventsInhibited(false); } }
Example #24
Source File: RadialQuarterN.java From mars-sim with GNU General Public License v3.0 | 5 votes |
@Override protected BufferedImage create_DISABLED_Image(final int WIDTH) { if (WIDTH <= 0) { return null; } final BufferedImage IMAGE = UTIL.createImage(WIDTH, WIDTH, Transparency.TRANSLUCENT); final Graphics2D G2 = IMAGE.createGraphics(); G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int IMAGE_WIDTH = IMAGE.getWidth(); final int IMAGE_HEIGHT = IMAGE.getHeight(); transformGraphics(IMAGE_WIDTH, IMAGE_HEIGHT, G2); final GeneralPath BACKGROUND = new GeneralPath(); BACKGROUND.setWindingRule(Path2D.WIND_EVEN_ODD); BACKGROUND.moveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.08411214953271028); BACKGROUND.curveTo(IMAGE_WIDTH * 0.6401869158878505, IMAGE_HEIGHT * 0.08411214953271028, IMAGE_WIDTH * 0.46261682242990654, IMAGE_HEIGHT * 0.1588785046728972, IMAGE_WIDTH * 0.29439252336448596, IMAGE_HEIGHT * 0.32242990654205606); BACKGROUND.curveTo(IMAGE_WIDTH * 0.17289719626168223, IMAGE_HEIGHT * 0.4439252336448598, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.6635514018691588, IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.curveTo(IMAGE_WIDTH * 0.08411214953271028, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897, IMAGE_WIDTH * 0.9158878504672897, IMAGE_HEIGHT * 0.9158878504672897); BACKGROUND.closePath(); G2.setColor(new Color(102, 102, 102, 178)); G2.fill(BACKGROUND); G2.dispose(); return IMAGE; }
Example #25
Source File: NamedComboBoxArrowButtonPainter.java From bither-desktop-java with Apache License 2.0 | 5 votes |
private Path2D decodePath6() { path.reset(); path.moveTo(decodeX(1.00625f), decodeY(1.3526785f)); path.lineTo(decodeX(2.0f), decodeY(0.8333333f)); path.lineTo(decodeX(2.0f), decodeY(1.8571429f)); path.lineTo(decodeX(1.00625f), decodeY(1.3526785f)); path.closePath(); return path; }
Example #26
Source File: NamedTabbedPaneTabPainter.java From bither-desktop-java with Apache License 2.0 | 5 votes |
private Path2D decodePath7() { path.reset(); path.moveTo(decodeX(0.0f), decodeY(0.71428573f)); path.curveTo(decodeAnchorX(0.0f, 0.0f), decodeAnchorY(0.7142857313156128f, -3.0f), decodeAnchorX(0.7142857313156128f, -3.0f), decodeAnchorY(0.0f, 0.0f), decodeX(0.71428573f), decodeY(0.0f)); path.curveTo(decodeAnchorX(0.7142857313156128f, 3.0f), decodeAnchorY(0.0f, 0.0f), decodeAnchorX(2.2857143878936768f, -3.0f), decodeAnchorY(0.0f, 0.0f), decodeX(2.2857144f), decodeY(0.0f)); path.curveTo(decodeAnchorX(2.2857143878936768f, 3.0f), decodeAnchorY(0.0f, 0.0f), decodeAnchorX(3.0f, 0.0f), decodeAnchorY(0.7142857313156128f, -3.0f), decodeX(3.0f), decodeY(0.71428573f)); path.curveTo(decodeAnchorX(3.0f, 0.0f), decodeAnchorY(0.7142857313156128f, 3.0f), decodeAnchorX(3.0f, 0.0f), decodeAnchorY(2.0f, 0.0f), decodeX(3.0f), decodeY(2.0f)); path.lineTo(decodeX(0.0f), decodeY(2.0f)); path.curveTo(decodeAnchorX(0.0f, 0.0f), decodeAnchorY(2.0f, 0.0f), decodeAnchorX(0.0f, 0.0f), decodeAnchorY(0.7142857313156128f, 3.0f), decodeX(0.0f), decodeY(0.71428573f)); path.closePath(); return path; }
Example #27
Source File: DrawPath.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void DrawPath(SunGraphics2D sg2d, SurfaceData sData, int transX, int transY, Path2D.Float p2df) { tracePrimitive(target); target.DrawPath(sg2d, sData, transX, transY, p2df); }
Example #28
Source File: LoopPipe.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void fill(SunGraphics2D sg2d, Shape s) { if (sg2d.strokeState == SunGraphics2D.STROKE_THIN) { Path2D.Float p2df; int transX; int transY; if (sg2d.transformState <= SunGraphics2D.TRANSFORM_INT_TRANSLATE) { if (s instanceof Path2D.Float) { p2df = (Path2D.Float)s; } else { p2df = new Path2D.Float(s); } transX = sg2d.transX; transY = sg2d.transY; } else { p2df = new Path2D.Float(s, sg2d.transform); transX = 0; transY = 0; } sg2d.loops.fillPathLoop.FillPath(sg2d, sg2d.getSurfaceData(), transX, transY, p2df); return; } ShapeSpanIterator sr = getFillSSI(sg2d); try { sr.setOutputArea(sg2d.getCompClip()); AffineTransform at = ((sg2d.transformState == SunGraphics2D.TRANSFORM_ISIDENT) ? null : sg2d.transform); sr.appendPath(s.getPathIterator(at)); fillSpans(sg2d, sr); } finally { sr.dispose(); } }
Example #29
Source File: ProcessPath.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static boolean drawPath(DrawHandler dhnd, EndSubPathHandler endSubPath, Path2D.Float p2df, int transX, int transY) { return doProcessPath(new DrawProcessHandler(dhnd, endSubPath), p2df, transX, transY); }
Example #30
Source File: FillPath.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void FillPath(SunGraphics2D sg2d, SurfaceData sData, int transX, int transY, Path2D.Float p2df) { tracePrimitive(target); target.FillPath(sg2d, sData, transX, transY, p2df); }