android.graphics.Path#FillType ( )源码实例Demo

下面列出了android.graphics.Path#FillType ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: atlas   文件: ShapeFill.java
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);
}
 
源代码2 项目: PdfBox-Android   文件: PDPageContentStream.java
/**
 * 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");
    }
}
 
源代码3 项目: PdfBox-Android   文件: PDPageContentStream.java
/**
 * 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");
}
 
源代码4 项目: lottie-android   文件: GradientFill.java
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;
}
 
源代码5 项目: microMathematics   文件: SVGAndroidRenderer.java
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;
}
 
源代码6 项目: microMathematics   文件: SVGAndroidRenderer.java
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;
}
 
源代码7 项目: starcor.xul   文件: SVGAndroidRenderer.java
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;
   }
}
 
源代码8 项目: lottie-android   文件: ShapeFillParser.java
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);
}
 
源代码9 项目: lottie-android   文件: ShapeFill.java
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;
}
 
源代码10 项目: ProjectX   文件: PathDrawable.java
/**
 * 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();
}
 
源代码11 项目: XDroidAnimation   文件: SVGAndroidRenderer.java
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;
   }
}
 
源代码12 项目: PdfBox-Android   文件: PageDrawer.java
@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();
        }
    }
 
源代码13 项目: PdfBox-Android   文件: PageDrawer.java
/**
 * 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();
}
 
源代码14 项目: assertj-android   文件: PathAssert.java
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;
}
 
源代码15 项目: lottie-android   文件: GradientFillParser.java
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);
}
 
源代码16 项目: lottie-android   文件: ShapeFill.java
public Path.FillType getFillType() {
  return fillType;
}
 
源代码17 项目: lottie-android   文件: GradientFill.java
public Path.FillType getFillType() {
  return fillType;
}
 
源代码18 项目: PdfBox-Android   文件: PDFGraphicsStreamEngine.java
/**
 * Fills and then strokes the path.
 *
 * @param windingRule The winding rule this path will use.
 */
public abstract void fillAndStrokePath(Path.FillType windingRule) throws IOException;
 
源代码19 项目: ProjectX   文件: PathDrawable.java
/**
 * 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();
}
 
源代码20 项目: PdfBox-Android   文件: PDFGraphicsStreamEngine.java
/**
 * 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;