AffineTransform.getScaleInstance(scaleFactor, scaleFactor) .createTransformedShape(markShape); ParallelLinesFiller filler = ParallelLinesFiller.fromStipple(rescaledStipple); if (filler != null) { Graphics2D clippedGraphics = (Graphics2D) graphics.create(); lineStyle.setContourComposite(ms2d.getContourComposite()); lineStyle.setGraphicStroke(ms2d.getGraphicStroke()); filler.fillRectangle(shape.getBounds2D(), this, clippedGraphics, lineStyle); return;
double bx1 = bounds.getMinX(); double bx2 = bounds.getMaxX(); if (equals(by1, by2)) { double w = bx2 - bx1; by1 -= w / 2; by2 += w / 2; } else if (equals(bx1, bx2)) { double h = by2 - by1; bx1 -= h / 2; if (equals(x1, x2)) { if (equals(y1, by1) && equals(y2, by2)) { lines.add(new Line(LineType.VERTICAL, x1 - bx1)); } else { if (equals(y1, y2)) { if (equals(x1, bx1) && equals(x2, bx2)) { lines.add(new Line(LineType.HORIZONTAL, y1 - by1)); } else { } else if ((equals(x1, bx1) && equals(y1, by1) && equals(x2, bx2) && equals(y2, by2)) || (equals(x1, bx2) && equals(y1, by2)) && equals(x2, bx1) && equals(y2, by1)) { lines.add(new Line(LineType.SLASH, 0)); } else if ((equals(x1, bx1)
y += yStep) { stippleCoord1.y = stippleCoord2.y = y; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine); x += xStep) { stippleCoord1.x = stippleCoord2.x = x; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine); stippleCoord2.x = stippleCoord1.x + steps * xStep; stippleCoord2.y = stippleCoord1.y + steps * yStep; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine); stippleCoord2.x = stippleCoord1.x + steps * xStep; stippleCoord2.y = stippleCoord1.y + steps * yStep; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine); stippleCoord2.x = stippleCoord1.x - steps * xStep; stippleCoord2.y = stippleCoord1.y + steps * yStep; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine); stippleCoord2.x = stippleCoord1.x - steps * xStep; stippleCoord2.y = stippleCoord1.y + steps * yStep; paintLine(painter, graphics, ls2d, identityTransf, nullDecimator, stippleLine);
@Test public void testCircle() throws Exception { ParallelLinesFiller filler = ParallelLinesFiller.fromStipple( new WellKnownMarkFactory().getShape(null, ff.literal("circle"), null)); assertNull(filler); } }
@Test public void testOArrow() throws Exception { ParallelLinesFiller filler = ParallelLinesFiller.fromStipple( new ShapeMarkFactory().getShape(null, ff.literal("shape://oarrow"), null)); assertNull(filler); }
@Test public void testSlash() throws Exception { ParallelLinesFiller filler = ParallelLinesFiller.fromStipple( new ShapeMarkFactory().getShape(null, ff.literal("shape://slash"), null)); assertNotNull(filler); assertEquals(1, filler.lines.size()); assertEquals(1, filler.xStep, 0d); assertEquals(1, filler.yStep, 0d); }
@Test public void testTimes() throws Exception { ParallelLinesFiller filler = ParallelLinesFiller.fromStipple( new ShapeMarkFactory().getShape(null, ff.literal("shape://times"), null)); assertNotNull(filler); assertEquals(2, filler.lines.size()); assertEquals(1, filler.xStep, 0d); assertEquals(1, filler.yStep, 0d); }
@Test public void testPlus() throws Exception { ParallelLinesFiller filler = ParallelLinesFiller.fromStipple( new ShapeMarkFactory().getShape(null, ff.literal("shape://plus"), null)); assertNotNull(filler); assertEquals(2, filler.lines.size()); assertEquals(1, filler.xStep, 0d); assertEquals(1, filler.yStep, 0d); }
private boolean isMarkNonHatchFill(Style2D graphicFill) { if (!(graphicFill instanceof MarkStyle2D)) { return false; } if (OPTIMIZE_VECTOR_HATCH_FILLS) { MarkStyle2D ms = (MarkStyle2D) graphicFill; ParallelLinesFiller filler = ParallelLinesFiller.fromStipple(ms.getShape()); if (filler != null) { return false; } } return true; }