Java Code Examples for android.graphics.Path#FillType
The following examples show how to use
android.graphics.Path#FillType .
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: ShapeFill.java From atlas with Apache License 2.0 | 6 votes |
static ShapeFill newInstance(JSONObject json, LottieComposition composition) { AnimatableColorValue color = null; boolean fillEnabled; AnimatableIntegerValue opacity = null; JSONObject jsonColor = json.optJSONObject("c"); if (jsonColor != null) { color = AnimatableColorValue.Factory.newInstance(jsonColor, composition); } JSONObject jsonOpacity = json.optJSONObject("o"); if (jsonOpacity != null) { opacity = AnimatableIntegerValue.Factory.newInstance(jsonOpacity, composition); } fillEnabled = json.optBoolean("fillEnabled"); int fillTypeInt = json.optInt("r", 1); Path.FillType fillType = fillTypeInt == 1 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD; return new ShapeFill(fillEnabled, fillType, color, opacity); }
Example 2
Source File: PDPageContentStream.java From PdfBox-Android with Apache License 2.0 | 6 votes |
/** * Fill the path. * * @param windingRule the winding rule to be used for filling * @throws IOException If the content stream could not be written * @throws IllegalArgumentException If the parameter is not a valid winding rule. * @deprecated Use {@link #fill()} or {@link #fillEvenOdd} instead. */ @Deprecated public void fill(Path.FillType windingRule) throws IOException { if (windingRule == Path.FillType.WINDING) { fill(); } else if (windingRule == Path.FillType.EVEN_ODD) { fillEvenOdd(); } else { throw new IllegalArgumentException("Error: unknown value for winding rule"); } }
Example 3
Source File: PDPageContentStream.java From PdfBox-Android with Apache License 2.0 | 6 votes |
/** * Clip path. * * @param windingRule the winding rule to be used for clipping * * @throws IOException If there is an error while clipping the path. * @throws IllegalStateException If the method was called within a text block. * @deprecated Use {@link #clip()} or {@link #clipEvenOdd} instead. */ @Deprecated public void clipPath(Path.FillType windingRule) throws IOException { if (inTextMode) { throw new IllegalStateException("Error: clipPath is not allowed within a text block."); } if (windingRule == Path.FillType.WINDING) { writeOperator("W"); } else if (windingRule == Path.FillType.EVEN_ODD) { writeOperator("W"); } else { throw new IllegalArgumentException("Error: unknown value for winding rule"); } writeOperator("n"); }
Example 4
Source File: GradientFill.java From lottie-android with Apache License 2.0 | 6 votes |
public GradientFill(String name, GradientType gradientType, Path.FillType fillType, AnimatableGradientColorValue gradientColor, AnimatableIntegerValue opacity, AnimatablePointValue startPoint, AnimatablePointValue endPoint, AnimatableFloatValue highlightLength, AnimatableFloatValue highlightAngle, boolean hidden) { this.gradientType = gradientType; this.fillType = fillType; this.gradientColor = gradientColor; this.opacity = opacity; this.startPoint = startPoint; this.endPoint = endPoint; this.name = name; this.highlightLength = highlightLength; this.highlightAngle = highlightAngle; this.hidden = hidden; }
Example 5
Source File: PathAssert.java From assertj-android with Apache License 2.0 | 5 votes |
public PathAssert hasFillType(Path.FillType type) { isNotNull(); Path.FillType actualType = actual.getFillType(); assertThat(actualType) // .overridingErrorMessage("Expected fill type <%s> but was <%s>.", type, actualType) // .isEqualTo(type); return this; }
Example 6
Source File: PageDrawer.java From PdfBox-Android with Apache License 2.0 | 5 votes |
/** * Fills and then strokes the path. * * @param windingRule The winding rule this path will use. * @throws IOException If there is an IO error while filling the path. */ @Override public void fillAndStrokePath(Path.FillType windingRule) throws IOException { // TODO can we avoid cloning the path? Path path = new Path(linePath); fillPath(windingRule); linePath = path; strokePath(); }
Example 7
Source File: PageDrawer.java From PdfBox-Android with Apache License 2.0 | 5 votes |
@Override public void fillPath(Path.FillType windingRule) throws IOException { // graphics.setComposite(getGraphicsState().getNonStrokingJavaComposite()); paint.setColor(getNonStrokingColor()); setClip(); linePath.setFillType(windingRule); // disable anti-aliasing for rectangular paths, this is a workaround to avoid small stripes // which occur when solid fills are used to simulate piecewise gradients, see PDFBOX-2302 // note that we ignore paths with a width/height under 1 as these are fills used as strokes, // see PDFBOX-1658 for an example // RectF bounds = new RectF((); // linePath.computeBounds(bounds, true); // boolean noAntiAlias = isRectangular(linePath) && bounds.width() > 1 && bounds.height() > 1; // if (noAntiAlias) { // graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_OFF); } // TODO: PdfBox-Android: Commit 7f5861f9559e30ad68f0bcbce5b9dd2e7c2621b5 ? paint.setStyle(Paint.Style.FILL); canvas.drawPath(linePath, paint); linePath.reset(); // if (noAntiAlias) { // JDK 1.7 has a bug where rendering hints are reset by the above call to // the setRenderingHint method, so we re-set all hints, see PDFBOX-2302 setRenderingHints(); } }
Example 8
Source File: SVGAndroidRenderer.java From XDroidAnimation with Apache License 2.0 | 5 votes |
private Path.FillType getFillTypeFromState() { if (state.style.fillRule == null) return Path.FillType.WINDING; switch (state.style.fillRule) { case EvenOdd: return Path.FillType.EVEN_ODD; case NonZero: default: return Path.FillType.WINDING; } }
Example 9
Source File: PathDrawable.java From ProjectX with Apache License 2.0 | 5 votes |
/** * Set the path's fill type. This defines how "inside" is computed. * * @param ft The new fill type for this path */ public void setFillType(Path.FillType ft) { if (mPath.getFillType() == ft) return; mPath.setFillType(ft); mDrawPath.setFillType(ft); invalidateSelf(); }
Example 10
Source File: ShapeFill.java From lottie-android with Apache License 2.0 | 5 votes |
public ShapeFill(String name, boolean fillEnabled, Path.FillType fillType, @Nullable AnimatableColorValue color, @Nullable AnimatableIntegerValue opacity, boolean hidden) { this.name = name; this.fillEnabled = fillEnabled; this.fillType = fillType; this.color = color; this.opacity = opacity; this.hidden = hidden; }
Example 11
Source File: ShapeFillParser.java From lottie-android with Apache License 2.0 | 5 votes |
static ShapeFill parse( JsonReader reader, LottieComposition composition) throws IOException { AnimatableColorValue color = null; boolean fillEnabled = false; AnimatableIntegerValue opacity = null; String name = null; int fillTypeInt = 1; boolean hidden = false; while (reader.hasNext()) { switch (reader.selectName(NAMES)) { case 0: name = reader.nextString(); break; case 1: color = AnimatableValueParser.parseColor(reader, composition); break; case 2: opacity = AnimatableValueParser.parseInteger(reader, composition); break; case 3: fillEnabled = reader.nextBoolean(); break; case 4: fillTypeInt = reader.nextInt(); break; case 5: hidden = reader.nextBoolean(); break; default: reader.skipName(); reader.skipValue(); } } Path.FillType fillType = fillTypeInt == 1 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD; return new ShapeFill(name, fillEnabled, fillType, color, opacity, hidden); }
Example 12
Source File: SVGAndroidRenderer.java From starcor.xul with GNU Lesser General Public License v3.0 | 5 votes |
private Path.FillType getClipRuleFromState() { if (state.style.clipRule == null) return Path.FillType.WINDING; switch (state.style.clipRule) { case EvenOdd: return Path.FillType.EVEN_ODD; case NonZero: default: return Path.FillType.WINDING; } }
Example 13
Source File: SVGAndroidRenderer.java From microMathematics with GNU General Public License v3.0 | 5 votes |
private Path.FillType getClipRuleFromState() { if (state.style.clipRule != null && state.style.clipRule == Style.FillRule.EvenOdd) return Path.FillType.EVEN_ODD; else return Path.FillType.WINDING; }
Example 14
Source File: SVGAndroidRenderer.java From microMathematics with GNU General Public License v3.0 | 5 votes |
private Path.FillType getFillTypeFromState() { if (state.style.fillRule != null && state.style.fillRule == Style.FillRule.EvenOdd) return Path.FillType.EVEN_ODD; else return Path.FillType.WINDING; }
Example 15
Source File: ShapeFill.java From lottie-android with Apache License 2.0 | 4 votes |
public Path.FillType getFillType() { return fillType; }
Example 16
Source File: GradientFillParser.java From lottie-android with Apache License 2.0 | 4 votes |
static GradientFill parse( JsonReader reader, LottieComposition composition) throws IOException { String name = null; AnimatableGradientColorValue color = null; AnimatableIntegerValue opacity = null; GradientType gradientType = null; AnimatablePointValue startPoint = null; AnimatablePointValue endPoint = null; Path.FillType fillType = Path.FillType.WINDING; boolean hidden = false; while (reader.hasNext()) { switch (reader.selectName(NAMES)) { case 0: name = reader.nextString(); break; case 1: int points = -1; reader.beginObject(); while (reader.hasNext()) { switch (reader.selectName(GRADIENT_NAMES)) { case 0: points = reader.nextInt(); break; case 1: color = AnimatableValueParser.parseGradientColor(reader, composition, points); break; default: reader.skipName(); reader.skipValue(); } } reader.endObject(); break; case 2: opacity = AnimatableValueParser.parseInteger(reader, composition); break; case 3: gradientType = reader.nextInt() == 1 ? GradientType.LINEAR : GradientType.RADIAL; break; case 4: startPoint = AnimatableValueParser.parsePoint(reader, composition); break; case 5: endPoint = AnimatableValueParser.parsePoint(reader, composition); break; case 6: fillType = reader.nextInt() == 1 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD; break; case 7: hidden = reader.nextBoolean(); break; default: reader.skipName(); reader.skipValue(); } } return new GradientFill( name, gradientType, fillType, color, opacity, startPoint, endPoint, null, null, hidden); }
Example 17
Source File: GradientFill.java From lottie-android with Apache License 2.0 | 4 votes |
public Path.FillType getFillType() { return fillType; }
Example 18
Source File: PathDrawable.java From ProjectX with Apache License 2.0 | 2 votes |
/** * Return the path's fill type. This defines how "inside" is * computed. The default value is WINDING. * * @return the path's fill type */ public Path.FillType getFillType() { return mPath.getFillType(); }
Example 19
Source File: PDFGraphicsStreamEngine.java From PdfBox-Android with Apache License 2.0 | 2 votes |
/** * Modify the current clipping path by intersecting it with the current path. * The clipping path will not be updated until the succeeding painting operator is called. * * @param windingRule The winding rule which will be used for clipping. */ public abstract void clip(Path.FillType windingRule) throws IOException;
Example 20
Source File: PDFGraphicsStreamEngine.java From PdfBox-Android with Apache License 2.0 | 2 votes |
/** * Fills and then strokes the path. * * @param windingRule The winding rule this path will use. */ public abstract void fillAndStrokePath(Path.FillType windingRule) throws IOException;