Java 类android.graphics.Path.FillType 实例源码

项目:letv    文件:MaterialProgressDrawable.java   
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (this.mShowArrow) {
        if (this.mArrow == null) {
            this.mArrow = new Path();
            this.mArrow.setFillType(FillType.EVEN_ODD);
        } else {
            this.mArrow.reset();
        }
        float inset = ((float) (((int) this.mStrokeInset) / 2)) * this.mArrowScale;
        float x = (float) ((this.mRingCenterRadius * Math.cos(0.0d)) + ((double) bounds.exactCenterX()));
        float y = (float) ((this.mRingCenterRadius * Math.sin(0.0d)) + ((double) bounds.exactCenterY()));
        this.mArrow.moveTo(0.0f, 0.0f);
        this.mArrow.lineTo(((float) this.mArrowWidth) * this.mArrowScale, 0.0f);
        this.mArrow.lineTo((((float) this.mArrowWidth) * this.mArrowScale) / 2.0f, ((float) this.mArrowHeight) * this.mArrowScale);
        this.mArrow.offset(x - inset, y);
        this.mArrow.close();
        this.mArrowPaint.setColor(this.mCurrentColor);
        c.rotate((startAngle + sweepAngle) - 5.0f, bounds.exactCenterX(), bounds.exactCenterY());
        c.drawPath(this.mArrow, this.mArrowPaint);
    }
}
项目:boohee_v5.6    文件:RoundRectDrawableWithShadow.java   
private void buildShadowCorners() {
    RectF innerBounds = new RectF(-this.mCornerRadius, -this.mCornerRadius, this.mCornerRadius, this.mCornerRadius);
    RectF outerBounds = new RectF(innerBounds);
    outerBounds.inset(-this.mShadowSize, -this.mShadowSize);
    if (this.mCornerShadowPath == null) {
        this.mCornerShadowPath = new Path();
    } else {
        this.mCornerShadowPath.reset();
    }
    this.mCornerShadowPath.setFillType(FillType.EVEN_ODD);
    this.mCornerShadowPath.moveTo(-this.mCornerRadius, 0.0f);
    this.mCornerShadowPath.rLineTo(-this.mShadowSize, 0.0f);
    this.mCornerShadowPath.arcTo(outerBounds, 180.0f, 90.0f, false);
    this.mCornerShadowPath.arcTo(innerBounds, 270.0f, -90.0f, false);
    this.mCornerShadowPath.close();
    float startRatio = this.mCornerRadius / (this.mCornerRadius + this.mShadowSize);
    this.mCornerShadowPaint.setShader(new RadialGradient(0.0f, 0.0f, this.mCornerRadius + this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, startRatio, 1.0f}, TileMode.CLAMP));
    this.mEdgeShadowPaint.setShader(new LinearGradient(0.0f, (-this.mCornerRadius) + this.mShadowSize, 0.0f, (-this.mCornerRadius) - this.mShadowSize, new int[]{this.mShadowStartColor, this.mShadowStartColor, this.mShadowEndColor}, new float[]{0.0f, 0.5f, 1.0f}, TileMode.CLAMP));
    this.mEdgeShadowPaint.setAntiAlias(false);
}
项目:boohee_v5.6    文件:MaterialProgressDrawable.java   
private void drawTriangle(Canvas c, float startAngle, float sweepAngle, Rect bounds) {
    if (this.mShowArrow) {
        if (this.mArrow == null) {
            this.mArrow = new Path();
            this.mArrow.setFillType(FillType.EVEN_ODD);
        } else {
            this.mArrow.reset();
        }
        float inset = ((float) (((int) this.mStrokeInset) / 2)) * this.mArrowScale;
        float x = (float) ((this.mRingCenterRadius * Math.cos(0.0d)) + ((double) bounds.exactCenterX()));
        float y = (float) ((this.mRingCenterRadius * Math.sin(0.0d)) + ((double) bounds.exactCenterY()));
        this.mArrow.moveTo(0.0f, 0.0f);
        this.mArrow.lineTo(((float) this.mArrowWidth) * this.mArrowScale, 0.0f);
        this.mArrow.lineTo((((float) this.mArrowWidth) * this.mArrowScale) / 2.0f, ((float) this.mArrowHeight) * this.mArrowScale);
        this.mArrow.offset(x - inset, y);
        this.mArrow.close();
        this.mArrowPaint.setColor(this.mCurrentColor);
        c.rotate((startAngle + sweepAngle) - 5.0f, bounds.exactCenterX(), bounds.exactCenterY());
        c.drawPath(this.mArrow, this.mArrowPaint);
    }
}
项目:boohee_v5.6    文件:ShadowDrawableWrapper.java   
private void buildShadowCorners() {
    RectF innerBounds = new RectF(-this.mCornerRadius, -this.mCornerRadius, this.mCornerRadius, this.mCornerRadius);
    RectF outerBounds = new RectF(innerBounds);
    outerBounds.inset(-this.mShadowSize, -this.mShadowSize);
    if (this.mCornerShadowPath == null) {
        this.mCornerShadowPath = new Path();
    } else {
        this.mCornerShadowPath.reset();
    }
    this.mCornerShadowPath.setFillType(FillType.EVEN_ODD);
    this.mCornerShadowPath.moveTo(-this.mCornerRadius, 0.0f);
    this.mCornerShadowPath.rLineTo(-this.mShadowSize, 0.0f);
    this.mCornerShadowPath.arcTo(outerBounds, 180.0f, 90.0f, false);
    this.mCornerShadowPath.arcTo(innerBounds, 270.0f, -90.0f, false);
    this.mCornerShadowPath.close();
    float shadowRadius = -outerBounds.top;
    if (shadowRadius > 0.0f) {
        float startRatio = this.mCornerRadius / shadowRadius;
        float midRatio = startRatio + ((1.0f - startRatio) / 2.0f);
        this.mCornerShadowPaint.setShader(new RadialGradient(0.0f, 0.0f, shadowRadius, new int[]{0, this.mShadowStartColor, this.mShadowMiddleColor, this.mShadowEndColor}, new float[]{0.0f, startRatio, midRatio, 1.0f}, TileMode.CLAMP));
    }
    this.mEdgeShadowPaint.setShader(new LinearGradient(0.0f, innerBounds.top, 0.0f, outerBounds.top, new int[]{this.mShadowStartColor, this.mShadowMiddleColor, this.mShadowEndColor}, new float[]{0.0f, SHADOW_HORIZ_SCALE, 1.0f}, TileMode.CLAMP));
    this.mEdgeShadowPaint.setAntiAlias(false);
}
项目:FMTech    文件:DiscoveryBadgeRating.java   
public DiscoveryBadgeRating(Context paramContext, AttributeSet paramAttributeSet)
{
  super(paramContext, paramAttributeSet);
  Resources localResources = getResources();
  this.mBadgeRadius = (localResources.getDimensionPixelSize(2131493007) / 2);
  this.mPaint = new Paint(1);
  this.mOctagonPath = new Path();
  this.mOctagonPath.setFillType(Path.FillType.EVEN_ODD);
  setWillNotDraw(false);
  this.mVertices = new PointF[8];
  for (int i = 0; i < 8; i++) {
    this.mVertices[i] = new PointF();
  }
  this.mWhiteOctagonStrokeWidth = localResources.getDimensionPixelSize(2131493299);
  this.mWhiteOctagonRadius = (this.mBadgeRadius - this.mWhiteOctagonStrokeWidth - this.mWhiteOctagonStrokeWidth / 2);
  this.mPressedFillColor = localResources.getColor(2131689475);
  this.mPressedOutlineColor = localResources.getColor(2131689476);
  this.mFocusedOutlineColor = localResources.getColor(2131689473);
  this.mOutlineStrokeWidth = (0.5F * localResources.getDimensionPixelSize(2131493377));
}
项目:mapsforge    文件:Polygon.java   
@Override
public synchronized boolean draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point canvasPosition) {
    synchronized (this.polygonalChains) {
        if (this.polygonalChains.isEmpty() || (this.paintStroke == null && this.paintFill == null)) {
            return false;
        }

        Path path = new Path();
        path.setFillType(FillType.EVEN_ODD);
        for (int i = 0; i < this.polygonalChains.size(); ++i) {
            PolygonalChain polygonalChain = this.polygonalChains.get(i);
            Path closedPath = polygonalChain.draw(zoomLevel, canvasPosition, true);
            if (closedPath != null) {
                path.addPath(closedPath);
            }
        }

        if (this.paintStroke != null) {
            canvas.drawPath(path, this.paintStroke);
        }
        if (this.paintFill != null) {
            canvas.drawPath(path, this.paintFill);
        }
        return true;
    }
}
项目:Mapyst    文件:RouteMapOverlay.java   
private void drawDirections(Canvas canvas) {
    paint.setShader(null);
    for (int i = 0; i < directions.length; i++) {
        Point[] dirPixelPoints = pixelPoints[i];
        Path path = new Path();
        path.setFillType(FillType.WINDING);
        path.moveTo(dirPixelPoints[0].x, dirPixelPoints[0].y);
        for (int j = 1; j < dirPixelPoints.length; j++)
            path.lineTo(dirPixelPoints[j].x, dirPixelPoints[j].y);

        if (directions[i].isOutside(app.campus) && i != curDir) {
            canvas.drawPath(path, paint);
        } else if (!directions[i].isOutside(app.campus) && i != curDir) {
            setDashPathInnerPaint(i);
            canvas.drawPath(path, insidePaint);
        }
    }
}
项目:FMTech    文件:SVGAndroidRenderer.java   
private Path.FillType getClipRuleFromState()
{
  if (this.state.style.clipRule == null) {
    return Path.FillType.WINDING;
  }
  switch (1.$SwitchMap$com$caverock$androidsvg$SVG$Style$FillRule[this.state.style.clipRule.ordinal()])
  {
  default: 
    return Path.FillType.WINDING;
  }
  return Path.FillType.EVEN_ODD;
}
项目:FMTech    文件:lpc.java   
protected final void onMeasure(int paramInt1, int paramInt2)
{
  int i1 = View.MeasureSpec.getSize(paramInt1);
  int i2 = i1 - this.h.m - this.h.m;
  if (this.a) {
    i2 -= this.d + this.h.m;
  }
  TextPaint localTextPaint = efj.B(getContext(), aw.ei);
  boolean bool = TextUtils.isEmpty(this.b);
  int i3 = 0;
  if (!bool)
  {
    lwj locallwj = this.m;
    String str = this.b;
    int i10 = this.n;
    Point localPoint = new Point();
    lxi locallxi = (lxi)locallwj.a(0, 0, i2, 0, null, null, 0, str, localPoint, localTextPaint, true, i10, true, null);
    locallxi.a(localPoint.x, localPoint.y);
    this.i = locallxi;
    i3 = this.i.getHeight();
  }
  int i4 = i3 + 3 * this.h.m;
  this.l = (i4 - this.h.m);
  if (!this.a)
  {
    int i5 = i1 - this.h.m - this.h.m / 2;
    int i6 = i5 - this.h.aU;
    int i7 = i6 + (i5 - i6) / 2;
    int i8 = this.l - (int)this.h.u.getStrokeWidth();
    int i9 = i8 + this.h.aV;
    this.j.setFillType(Path.FillType.EVEN_ODD);
    this.j.moveTo(i6, i8);
    this.j.lineTo(i5, i8);
    this.j.lineTo(i7, i9);
    this.j.lineTo(i6, i8);
    this.j.close();
  }
  setMeasuredDimension(i1, i4);
}
项目:QuizUpWinner    文件:Chart.java   
private void ˊ( paramナ, Canvas paramCanvas)
{
  int i = -1 + this.ͺ;
  Path localPath = new Path();
  localPath.setFillType(Path.FillType.EVEN_ODD);
  localPath.moveTo(this.ˏ, i);
  Paint localPaint = new Paint(1);
  localPaint.setPathEffect(new CornerPathEffect(4.0F));
  localPaint.setColor(this.ˈ.getResources().getColor(2131230763));
  localPaint.setStyle(Paint.Style.FILL);
  float f1 = this.ˊ / 160.0F;
  for (int j = 0; j < this.ʿ.length; j++)
  {
    int k = j;
    if (paramナ.ˊ[k] == -1.0F)
    {
      float f2 = 0.0F;
      if (j > 0)
        f2 = this.ʿ[(j - 1)];
      localPath.lineTo(f2, this.ͺ);
      localPath.close();
      paramCanvas.drawPath(localPath, localPaint);
      return;
    }
    int m = j;
    float f3 = paramナ.ˊ[m];
    float f4 = this.ʿ[j];
    float f5 = this.ͺ - f1 * f3;
    if (f5 == this.ͺ)
      localPath.moveTo(f4, i);
    else
      localPath.lineTo(f4, f5);
  }
  localPath.lineTo(this.ʽ, this.ͺ);
  localPath.close();
  paramCanvas.drawPath(localPath, localPaint);
}
项目:AccelerationExplorer    文件:GaugeVector.java   
/**
 * Draw the gauge.
 *
 * @param canvas
 */
private void drawAxis(Canvas canvas) {
    // Draw the Y axis
    canvas.drawLine(rimRect.centerX(), rimRect.top, rimRect.centerX(),
            rimRect.bottom, axisPaint);

    // Draw the X axis
    canvas.drawLine(rimRect.left, rimRect.centerY(), rimRect.right,
            rimRect.centerY(), axisPaint);

    // Draw the Y axis arrow
    Path yArrowPath = new Path();
    yArrowPath.setFillType(FillType.EVEN_ODD);

    yArrowPath.moveTo(rimRect.centerX() - 0.002f, rimRect.top);
    yArrowPath.lineTo(rimRect.centerX() + 0.05f, rimRect.top + 0.05f);
    yArrowPath.moveTo(rimRect.centerX() + 0.002f, rimRect.top);
    yArrowPath.lineTo(rimRect.centerX() - 0.05f, rimRect.top + 0.05f);

    canvas.drawPath(yArrowPath, axisPaint);

    // Draw the Y axis arrow
    Path xArrowPath = new Path();
    xArrowPath.setFillType(FillType.EVEN_ODD);

    xArrowPath.moveTo(rimRect.right, rimRect.centerY() + 0.002f);
    xArrowPath.lineTo(rimRect.right - 0.05f, rimRect.centerY() - 0.05f);

    xArrowPath.moveTo(rimRect.right, rimRect.centerY() - 0.002f);
    xArrowPath.lineTo(rimRect.right - 0.05f, rimRect.centerY() + 0.05f);

    canvas.drawPath(xArrowPath, axisPaint);

}
项目:FlexiCrop    文件:MainActivity.java   
private void cropImageByPath() {
    //closing the path now.
    clipPath.close();
    //setting the fill type to inverse, so that the outer part of the selected path gets filled.
    clipPath.setFillType(FillType.INVERSE_WINDING);
    Paint xferPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    xferPaint.setColor(Color.BLACK);
    canvas.drawPath(clipPath, xferPaint);
    xferPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    canvas.drawBitmap(alteredBitmap, 0, 0, xferPaint);
}
项目:Mapyst    文件:RouteMapOverlay.java   
public void drawPath(Canvas canvas) {
    Point[] curPixelPoints = pixelPoints[curDir];

    // setup gradient
    paint.setShader(getPathShader(curPixelPoints));

    // draw path
    Path path = new Path();
    path.setFillType(FillType.WINDING);
    path.moveTo(curPixelPoints[0].x, curPixelPoints[0].y);
    for (int i = 1; i < curPixelPoints.length; i += 1)
        path.lineTo(curPixelPoints[i].x, curPixelPoints[i].y);
    canvas.drawPath(path, paint);
}
项目:FMTech    文件:CardBubbleForegroundDrawable.java   
protected final void buildComponents(Rect paramRect)
{
  super.buildComponents(paramRect);
  this.mFullOutlinePath.reset();
  this.mFullOutlinePath.setFillType(Path.FillType.EVEN_ODD);
  this.mFullOutlinePath.moveTo(this.mCardBounds.left + this.mCornerRadius, this.mCardBounds.top);
  if (this.mBubbleGravity == 48)
  {
    this.mFullOutlinePath.lineTo(this.mBubbleCenterX - this.mBubbleTriangleBaseSize / 2.0F, this.mCardBounds.top);
    this.mOutlineCornerRect.set(this.mBubbleCenterX - this.mCornerRadius, this.mCardBounds.top - this.mBubbleSize + this.mShadowSize / 2.0F, this.mBubbleCenterX + this.mCornerRadius, this.mCardBounds.top - this.mBubbleSize + this.mShadowSize / 2.0F + 2.0F * this.mCornerRadius);
    this.mFullOutlinePath.lineTo(this.mOutlineCornerRect.left, this.mOutlineCornerRect.top + this.mCornerRadius / 2.0F);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 225.0F, 90.0F, false);
    this.mFullOutlinePath.lineTo(this.mBubbleCenterX + this.mBubbleTriangleBaseSize / 2.0F, this.mCardBounds.top);
  }
  this.mFullOutlinePath.lineTo(this.mCardBounds.right - this.mCornerRadius, this.mCardBounds.top);
  if (this.mCornerRadius > 0.0F)
  {
    this.mOutlineCornerRect.set(this.mCardBounds.right - 2.0F * this.mCornerRadius, this.mCardBounds.top, this.mCardBounds.right, this.mCardBounds.top + 2.0F * this.mCornerRadius);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 270.0F, 90.0F, false);
  }
  if (this.mBubbleGravity == 5)
  {
    this.mFullOutlinePath.lineTo(this.mCardBounds.right, this.mBubbleCenterY - this.mBubbleTriangleBaseSize / 2.0F);
    this.mOutlineCornerRect.set(this.mCardBounds.right + this.mBubbleSize - this.mShadowSize / 2.0F - 2.0F * this.mCornerRadius, this.mBubbleCenterY - this.mCornerRadius, this.mCardBounds.right + this.mBubbleSize - this.mShadowSize / 2.0F, this.mBubbleCenterY + this.mCornerRadius);
    this.mFullOutlinePath.lineTo(this.mOutlineCornerRect.right - this.mCornerRadius / 2.0F, this.mOutlineCornerRect.top);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 315.0F, 90.0F, false);
    this.mFullOutlinePath.lineTo(this.mCardBounds.right, this.mBubbleCenterY + this.mBubbleTriangleBaseSize / 2.0F);
  }
  this.mFullOutlinePath.lineTo(this.mCardBounds.right, this.mCardBounds.bottom - this.mCornerRadius);
  if (this.mCornerRadius > 0.0F)
  {
    this.mOutlineCornerRect.set(this.mCardBounds.right - 2.0F * this.mCornerRadius, this.mCardBounds.bottom - 2.0F * this.mCornerRadius, this.mCardBounds.right, this.mCardBounds.bottom);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 0.0F, 90.0F, false);
  }
  if (this.mBubbleGravity == 80)
  {
    this.mFullOutlinePath.lineTo(this.mBubbleCenterX + this.mBubbleTriangleBaseSize / 2.0F, this.mCardBounds.bottom);
    this.mOutlineCornerRect.set(this.mBubbleCenterX - this.mCornerRadius, this.mCardBounds.bottom + this.mBubbleSize - this.mShadowSize / 2.0F - 2.0F * this.mCornerRadius, this.mBubbleCenterX + this.mCornerRadius, this.mCardBounds.bottom + this.mBubbleSize - this.mShadowSize / 2.0F);
    this.mFullOutlinePath.lineTo(this.mOutlineCornerRect.right, this.mOutlineCornerRect.bottom - this.mCornerRadius / 2.0F);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 45.0F, 90.0F, false);
    this.mFullOutlinePath.lineTo(this.mBubbleCenterX - this.mBubbleTriangleBaseSize / 2.0F, this.mCardBounds.bottom);
  }
  this.mFullOutlinePath.lineTo(this.mCardBounds.left + this.mCornerRadius, this.mCardBounds.bottom);
  if (this.mCornerRadius > 0.0F)
  {
    this.mOutlineCornerRect.set(this.mCardBounds.left, this.mCardBounds.bottom - 2.0F * this.mCornerRadius, this.mCardBounds.left + 2.0F * this.mCornerRadius, this.mCardBounds.bottom);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 90.0F, 90.0F, false);
  }
  if (this.mBubbleGravity == 3)
  {
    this.mFullOutlinePath.lineTo(this.mCardBounds.left, this.mBubbleCenterY + this.mBubbleTriangleBaseSize / 2.0F);
    this.mOutlineCornerRect.set(this.mCardBounds.left - this.mBubbleSize + this.mShadowSize / 2.0F, this.mBubbleCenterY - this.mCornerRadius, this.mCardBounds.left - this.mBubbleSize + this.mShadowSize / 2.0F + 2.0F * this.mCornerRadius, this.mBubbleCenterY + this.mCornerRadius);
    this.mFullOutlinePath.lineTo(this.mOutlineCornerRect.left + this.mCornerRadius / 2.0F, this.mOutlineCornerRect.bottom);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 135.0F, 90.0F, false);
    this.mFullOutlinePath.lineTo(this.mCardBounds.left, this.mBubbleCenterY - this.mBubbleTriangleBaseSize / 2.0F);
  }
  this.mFullOutlinePath.lineTo(this.mCardBounds.left, this.mCardBounds.top + this.mCornerRadius);
  if (this.mCornerRadius > 0.0F)
  {
    this.mOutlineCornerRect.set(this.mCardBounds.left, this.mCardBounds.top, this.mCardBounds.left + 2.0F * this.mCornerRadius, this.mCardBounds.top + 2.0F * this.mCornerRadius);
    this.mFullOutlinePath.arcTo(this.mOutlineCornerRect, 180.0F, 90.0F, false);
  }
  this.mFullOutlinePath.close();
}
项目:FMTech    文件:StarRatingBar.java   
public StarRatingBar(Context paramContext, AttributeSet paramAttributeSet)
{
  super(paramContext, paramAttributeSet);
  Resources localResources = paramContext.getResources();
  TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.StarRatingBar);
  this.mGap = localTypedArray.getDimensionPixelSize(R.styleable.StarRatingBar_gap, 0);
  this.mRating = localTypedArray.getFloat(R.styleable.StarRatingBar_rating, 0.0F);
  this.mStarHeight = localTypedArray.getDimensionPixelSize(R.styleable.StarRatingBar_star_height, localResources.getDimensionPixelSize(R.dimen.play_star_height_default));
  this.mRange = localTypedArray.getInt(R.styleable.StarRatingBar_range, 5);
  this.mShowEmptyStars = localTypedArray.getBoolean(R.styleable.StarRatingBar_show_empty_stars, true);
  this.mIsInCompactMode = localTypedArray.getBoolean(R.styleable.StarRatingBar_compact_mode, false);
  this.mTextSize = localTypedArray.getDimensionPixelSize(R.styleable.StarRatingBar_text_size, localResources.getDimensionPixelSize(R.dimen.play_medium_size));
  int i = localTypedArray.getColor(R.styleable.StarRatingBar_star_color, localResources.getColor(R.color.play_white));
  int j = localTypedArray.getColor(R.styleable.StarRatingBar_star_bg_color, localResources.getColor(R.color.play_transparent));
  localTypedArray.recycle();
  this.mStarPaint = new Paint(1);
  this.mStarPaint.setColor(i);
  this.mStarPaint.setStyle(Paint.Style.FILL);
  this.mStarBackgroundPaint = new Paint(1);
  this.mStarBackgroundPaint.setColor(j);
  this.mStarBackgroundPaint.setStyle(Paint.Style.FILL);
  this.mStarPath = new Path();
  this.mStarPath.setFillType(Path.FillType.EVEN_ODD);
  this.mLeftHalfStarPath = new Path();
  this.mLeftHalfStarPath.setFillType(Path.FillType.EVEN_ODD);
  this.mRightHalfStarPath = new Path();
  this.mRightHalfStarPath.setFillType(Path.FillType.EVEN_ODD);
  this.mRadius = (this.mStarHeight / (1.0D + Math.sin(0.9424777960769379D)));
  this.mShortRadius = (Math.sin(0.3926990816987241D) * this.mRadius / Math.sin(2.12057504117311D));
  this.mHalfStarWidth = ((float)(this.mRadius * Math.sin(1.256637061435917D)));
  this.mVertices = new PointF[10];
  for (int k = 0; k < 10; k++) {
    this.mVertices[k] = new PointF();
  }
  this.mTextPaint = new TextPaint(1);
  this.mTextPaint.density = localResources.getDisplayMetrics().density;
  this.mTextPaint.setTextSize(this.mTextSize);
  this.mTextPaint.setFakeBoldText(false);
  Paint.FontMetrics localFontMetrics = this.mTextPaint.getFontMetrics();
  this.mTextHeight = ((int)(Math.abs(localFontMetrics.top) + Math.abs(localFontMetrics.bottom)));
  this.mTextBaseline = ((int)Math.abs(localFontMetrics.top));
  updateRatingDescription();
  this.mVertices[0].x = 0.0F;
  this.mVertices[0].y = (-1.0F * (float)this.mRadius);
  this.mVertices[1].x = ((float)(this.mShortRadius * Math.sin(0.6283185307179586D)));
  this.mVertices[1].y = (-1.0F * (float)(this.mShortRadius * Math.cos(0.6283185307179586D)));
  this.mVertices[2].x = ((float)(this.mRadius * Math.sin(1.256637061435917D)));
  this.mVertices[2].y = (-1.0F * (float)(this.mRadius * Math.cos(1.256637061435917D)));
  this.mVertices[3].x = ((float)(this.mShortRadius * Math.sin(1.256637061435917D)));
  this.mVertices[3].y = ((float)(this.mShortRadius * Math.cos(1.256637061435917D)));
  this.mVertices[4].x = ((float)(this.mRadius * Math.sin(0.6283185307179586D)));
  this.mVertices[4].y = ((float)((float)this.mRadius * Math.cos(0.6283185307179586D)));
  this.mVertices[5].x = 0.0F;
  this.mVertices[5].y = ((float)this.mShortRadius);
  this.mVertices[6].x = (-1.0F * this.mVertices[4].x);
  this.mVertices[6].y = this.mVertices[4].y;
  this.mVertices[7].x = (-1.0F * this.mVertices[3].x);
  this.mVertices[7].y = this.mVertices[3].y;
  this.mVertices[8].x = (-1.0F * this.mVertices[2].x);
  this.mVertices[8].y = this.mVertices[2].y;
  this.mVertices[9].x = (-1.0F * this.mVertices[1].x);
  this.mVertices[9].y = this.mVertices[1].y;
  initializeStarPaths();
  setWillNotDraw(false);
}
项目:FMTech    文件:MaterialProgressDrawable.java   
public final void draw(Canvas paramCanvas)
{
  Rect localRect = getBounds();
  int i = paramCanvas.save();
  paramCanvas.rotate(this.mRotation, localRect.exactCenterX(), localRect.exactCenterY());
  Ring localRing = this.mRing;
  RectF localRectF = localRing.mTempBounds;
  localRectF.set(localRect);
  localRectF.inset(localRing.mStrokeInset, localRing.mStrokeInset);
  float f1 = 360.0F * (localRing.mStartTrim + localRing.mRotation);
  float f2 = 360.0F * (localRing.mEndTrim + localRing.mRotation) - f1;
  localRing.mPaint.setColor(localRing.mCurrentColor);
  paramCanvas.drawArc(localRectF, f1, f2, false, localRing.mPaint);
  if (localRing.mShowArrow)
  {
    if (localRing.mArrow != null) {
      break label427;
    }
    localRing.mArrow = new Path();
    localRing.mArrow.setFillType(Path.FillType.EVEN_ODD);
  }
  for (;;)
  {
    float f3 = (int)localRing.mStrokeInset / 2 * localRing.mArrowScale;
    float f4 = (float)(localRing.mRingCenterRadius * Math.cos(0.0D) + localRect.exactCenterX());
    float f5 = (float)(localRing.mRingCenterRadius * Math.sin(0.0D) + localRect.exactCenterY());
    localRing.mArrow.moveTo(0.0F, 0.0F);
    localRing.mArrow.lineTo(localRing.mArrowWidth * localRing.mArrowScale, 0.0F);
    localRing.mArrow.lineTo(localRing.mArrowWidth * localRing.mArrowScale / 2.0F, localRing.mArrowHeight * localRing.mArrowScale);
    localRing.mArrow.offset(f4 - f3, f5);
    localRing.mArrow.close();
    localRing.mArrowPaint.setColor(localRing.mCurrentColor);
    paramCanvas.rotate(f1 + f2 - 5.0F, localRect.exactCenterX(), localRect.exactCenterY());
    paramCanvas.drawPath(localRing.mArrow, localRing.mArrowPaint);
    if (localRing.mAlpha < 255)
    {
      localRing.mCirclePaint.setColor(localRing.mBackgroundColor);
      localRing.mCirclePaint.setAlpha(255 - localRing.mAlpha);
      paramCanvas.drawCircle(localRect.exactCenterX(), localRect.exactCenterY(), localRect.width() / 2, localRing.mCirclePaint);
    }
    paramCanvas.restoreToCount(i);
    return;
    label427:
    localRing.mArrow.reset();
  }
}
项目:FMTech    文件:hfb.java   
public hfb(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
  super(paramContext, paramAttributeSet, paramInt);
  setWillNotDraw(false);
  Context localContext = getContext();
  Resources localResources = localContext.getResources();
  this.B = localResources.getDimensionPixelSize(aau.yx);
  this.A = localResources.getDrawable(aau.yD);
  this.w = localResources.getDimensionPixelSize(aau.yv);
  this.g = localResources.getDimensionPixelSize(aau.yw);
  this.b = localResources.getDimensionPixelSize(aau.yB);
  this.l = localResources.getDimensionPixelSize(aau.yC);
  int i1 = this.l;
  int i2 = this.b;
  int i3 = localResources.getColor(aau.yn);
  Point localPoint1 = new Point(0, 0);
  Point localPoint2 = new Point(0, i2);
  Point localPoint3 = new Point(i1, i2 / 2);
  Path localPath = new Path();
  localPath.setFillType(Path.FillType.EVEN_ODD);
  localPath.lineTo(localPoint2.x, localPoint2.y);
  localPath.lineTo(localPoint3.x, localPoint3.y);
  localPath.lineTo(localPoint1.x, localPoint1.y);
  localPath.close();
  ShapeDrawable localShapeDrawable = new ShapeDrawable(new PathShape(localPath, i1, i2));
  localShapeDrawable.getPaint().setColor(i3);
  this.a = localShapeDrawable;
  this.u = localResources.getDimensionPixelSize(aau.ys);
  this.v = localResources.getDimensionPixelOffset(aau.yr);
  this.x = localResources.getDimensionPixelSize(aau.yp);
  this.C = localResources.getDimensionPixelSize(aau.yu);
  this.c = new Button(localContext, null, 0);
  TypedArray localTypedArray = localContext.obtainStyledAttributes(new int[] { 16843534 });
  this.c.setBackgroundResource(localTypedArray.getResourceId(0, 0));
  localTypedArray.recycle();
  this.c.setGravity(16);
  this.c.setMaxLines(1);
  this.c.setEllipsize(TextUtils.TruncateAt.END);
  this.c.setVisibility(8);
  addView(this.c);
  this.e = new TextView(localContext);
  this.e.setEllipsize(TextUtils.TruncateAt.END);
  addView(this.e);
  this.d = new TextView(localContext);
  this.d.setMaxLines(1);
  this.d.setEllipsize(TextUtils.TruncateAt.END);
  addView(this.d);
  this.f = new TextView(localContext);
  this.f.setMaxLines(1);
  this.f.setEllipsize(TextUtils.TruncateAt.END);
  this.f.setTextAppearance(localContext, aau.yL);
  addView(this.f);
  this.i = new TextView(localContext);
  this.i.setGravity(16);
  this.i.setTextAppearance(localContext, aau.yL);
  this.i.setAllCaps(true);
  this.i.setText(localResources.getString(efj.Gq));
  this.i.setVisibility(8);
  addView(this.i);
}
项目:SevenDaysRateChart    文件:LinePlot.java   
@Override
public void draw(Canvas canvas) {
    //must be located here
    mPaint.setColor(mContext.getResources().getColor(android.R.color.holo_orange_light));
    mPaint.setStyle(Style.STROKE);
    mPaint.setStrokeWidth(RateChartConst.sLineWidth);
    mPaint.setAntiAlias(true);

    RateChartManager manager = mManager;
    int columns = manager.getColumnNum();

    double[] YValues = manager.getYValues();
    if (YValues == null || YValues.length < columns) return;

    double[] yValues = new double[YValues.length];
    System.arraycopy(YValues, 0, yValues, 0, yValues.length);

    double[] yCoordinates = manager.getYCoordinates();
    double deltaYCoordinateMM = RateDataHelper.getAbsDeltaMaxMin(yCoordinates);
    double maxYCoordinate = RateDataHelper.getMax(yCoordinates);

    //draw y coordinate value.
    float[] drawYValue = new float[YValues.length];

    for (int m = 0; m < yValues.length; m++) {
        drawYValue[m] =
                (float) (mRegionHeight * (maxYCoordinate - yValues[m]) / deltaYCoordinateMM);
    }

    // line path
    mLinePath.reset();
    mLinePath.moveTo(mMarginLeft, mMarginTop + drawYValue[0]);
    mShaderPath.reset();
    mShaderPath.moveTo(mMarginLeft, mMarginTop + drawYValue[0]);

    float deltaX = mRegionWidth / (columns - 1);

    if (columns < RateChartConst.sColumnNum) {
        deltaX = mRegionWidth / (RateChartConst.sColumnNum - 1);
    }
    for (int i = 1; i < columns; i++) {
        mLinePath.lineTo(mMarginLeft + deltaX * i, drawYValue[i] + mMarginTop);
        mShaderPath.lineTo(mMarginLeft + deltaX * i, drawYValue[i] + mMarginTop);
    }

    //draw shader
    mShaderPath.lineTo(mMarginLeft + deltaX * (columns - 1), mRegionHeight + mMarginTop);
    mShaderPath.lineTo(mMarginLeft, mRegionHeight + mMarginTop);
    mShaderPath.lineTo(mMarginLeft, mMarginTop + drawYValue[0]);
    mShaderPath.setFillType(FillType.EVEN_ODD);
    canvas.drawPath(mShaderPath, mShaderPaint);

    //draw line
    canvas.drawPath(mLinePath, mPaint);

    //draw orange circle
    mPaint.setStrokeWidth(RateChartConst.sCircleWidth);
    canvas.drawCircle(mMarginLeft + deltaX * (columns - 1),
            drawYValue[columns - 1] + mMarginTop, RateChartConst.sCircleOuterRadius, mPaint);

    //draw inner circle.
    mPaint.setColor(mContext.getResources().getColor(android.R.color.white));
    mPaint.setStyle(Style.FILL);
    canvas.drawCircle(mMarginLeft + deltaX * (columns - 1),
            drawYValue[columns - 1] + mMarginTop, RateChartConst.sCircleInnerRadius, mPaint);

    //draw black pop window.
    float mLatestX = mMarginLeft + deltaX * (columns - 1);
    float mLatestY = mMarginTop + drawYValue[columns - 1];
    showPopText(canvas,
            mDecimalFormat.format(manager.getYValues()[manager.getYValues().length - 1]),
            mLatestX, mLatestY);
}
项目:QuizUpWinner    文件:Chart.java   
private void ˊ( paramナ, Canvas paramCanvas, Paint paramPaint, int paramInt)
{
  int i = -1 + this.ͺ;
  float f1 = this.ˊ / 160.0F;
  float f2 = this.ˈ.getResources().getDimension(2131558465);
  Path localPath = new Path();
  localPath.setFillType(Path.FillType.EVEN_ODD);
  localPath.moveTo(this.ˏ, i);
  paramPaint.setPathEffect(null);
  paramPaint.setColor(paramInt);
  paramPaint.setStyle(Paint.Style.FILL_AND_STROKE);
  paramPaint.setStrokeWidth((int)(3.0F * Resources.getSystem().getDisplayMetrics().density));
  Paint localPaint = new Paint(1);
  localPaint.setPathEffect(new CornerPathEffect(4.0F));
  localPaint.setColor(paramInt);
  localPaint.setStrokeWidth((int)(3.0F * Resources.getSystem().getDisplayMetrics().density));
  localPaint.setStyle(Paint.Style.STROKE);
  for (int j = 0; j < this.ʿ.length; j++)
  {
    int k = j;
    if (paramナ.ˊ[k] == -1.0F)
    {
      float f6;
      float f7;
      if (j > 0)
      {
        f6 = this.ʿ[(j - 1)];
        float f8 = this.ͺ;
        int n = j - 1;
        f7 = f8 - f1 * paramナ.ˊ[n];
      }
      else
      {
        f6 = 0.0F;
        f7 = this.ͺ;
      }
      paramCanvas.drawCircle(f6 - 2.5F, f7, f2, paramPaint);
      break;
    }
    float f3 = this.ʿ[j];
    float f4 = this.ͺ;
    int m = j;
    float f5 = f4 - f1 * paramナ.ˊ[m];
    if (f5 == this.ͺ)
    {
      localPath.moveTo(f3, i);
    }
    else
    {
      if (j == -1 + this.ʿ.length)
        paramCanvas.drawCircle(f3, f5, f2, paramPaint);
      localPath.lineTo(f3, f5);
    }
  }
  paramCanvas.drawPath(localPath, localPaint);
}
项目:sauvignon    文件:SvgRenderer.java   
private static void renderPolygon(SVGPolygon e, Canvas canvas)
{
    Paint fill = e.getStyle().getFill();
    if (fill != null)
    {
        fill.setStyle(Style.FILL);
    }

    Paint stroke = e.getStyle().getStroke();
    if (stroke != null)
    {
        stroke.setStyle(Style.STROKE);
        stroke.setStrokeWidth(e.getStyle().getStrokeWidth());
    }

    FillType ft = null;
    switch (e.getFillRule())
    {
        case EVENODD:
        {
            ft = FillType.EVEN_ODD;
            break;
        }
        case NONZERO:
        {
            ft = FillType.WINDING;
            break;
        }
        default:
        {
            break;
        }
    }

    // Animation : fill
    if (e.getAnimationColor() != null && e.getAnimationColor().getType() == EColorOperatorType.FILL)
    {
        fill = e.getAnimationColor().getResultingPaint();
        fill.setStyle(Style.FILL);
    }

    // Animation : stroke
    if (e.getAnimationColor() != null && e.getAnimationColor().getType() == EColorOperatorType.STROKE)
    {
        stroke = e.getAnimationColor().getResultingPaint();
        stroke.setStrokeWidth(e.getStyle().getStrokeWidth());
        stroke.setStyle(Style.FILL);
    }

    // Animation : transformation
    Matrix ctmElement = e.getElementMatrix();
    Matrix ctmScale = e.getScaleMatrix();
    e = e.applyCTM(ctmScale.multiply(ctmElement));

    List<Vector2> points = e.getPoints();
    Path path = new Path();
    path.moveTo(points.get(0).getX(), points.get(0).getY());

    for (Vector2 point : points)
    {
        path.lineTo(point.getX(), point.getY());
    }

    path.close();
    path.setFillType(ft);

    if (fill != null)
        canvas.drawPath(path, fill);
    if (stroke != null)
        canvas.drawPath(path, stroke);
}
项目:PullToRefresh-Dropper    文件:Droplet.java   
/**
 * @Overrided method that handles the core portion, <br>
 * @warning Dont change the implementation
 * This method get called when ever a invalidate is invoked
 */
@Override
protected void onDraw(Canvas canvas) {
    // Gets the whole available width to work on
    width = canvas.getWidth();

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.reload);
    // Create a mutable bitmap to work on. @warning dont load large images 
    Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);

    // Set the radius based on image width
    RADIUS = bitmap.getWidth() / 2;

    calculatePoints();
    // release unused bitmap memory
    bitmap.recycle();
    Path _path = new Path();

    if(distance < REFRESH_POSITION && distance >= 0)
    {
        // Rough Y point which bend to pass through
        BEND_POINT_Y = distance/2;
        // Rough X point which bend to pass through
        BEND_POINT_X = distance/5;

        _path.moveTo(top_X1, CENTER_POINT_Y); 
        _path.quadTo(top_X1 + BEND_POINT_X, CENTER_POINT_Y + BEND_POINT_Y, bottom_X1, CENTER_POINT_Y + distance);

        /* Calculate the radius of the bottom arc */
        int bottomRadius = (bottom_X2 - bottom_X1)/2; 

        _path.quadTo(bottom_X1 + bottomRadius, CENTER_POINT_Y + distance + bottomRadius, bottom_X2, CENTER_POINT_Y + distance);
        _path.quadTo(top_X2 - BEND_POINT_X, CENTER_POINT_Y + BEND_POINT_Y, top_X2, CENTER_POINT_Y );

        _path.lineTo(top_X1, CENTER_POINT_Y);

        _path.setFillType(FillType.WINDING);
    }
    _path.close();

    // Draw on canvas
    canvas.drawPath(_path, paint);
    canvas.drawBitmap(mutableBitmap, (width/2) - RADIUS, CENTER_POINT_Y - RADIUS, paint);

    refreshList();
    mutableBitmap.recycle();
}
项目:MicroscropeKnob    文件:MicroscopeKnobView.java   
@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);
    float mx = this.getWidth()/2;
    float my = this.getHeight()/2;
    float r = getBaseRadius();
    int d = 0;
    float velocity = (value - valueOld1);
    for (d = depth; d > 0; d--) {
        Paint p = new Paint(knobColour);
        int colour = p.getColor();
        int green = (colour & 0x0000FF00) >> 8;
        green += d * 10;
        colour = (colour & 0xFFFF00FF) | ((green << 8) & 0x0000FF00);
        p.setColor(colour);
        float R = r*d;
        float Rsub = r*d-r;
        if (d == 1) {
            Rsub = (float) (r*(d-0.75));
        }
        canvas.drawCircle(0, my, R, p);
        Path arc = null;
        float radVelocity = (float) (Math.abs(velocity) * Math.pow(power, d));
        radVelocity = radVelocity/16;
        radVelocity = Math.min(10f/360f*2f*(float)Math.PI, radVelocity);
        radVelocity = Math.max(1.0f/Rsub, radVelocity); // minimum size
        radVelocity = radVelocity/2;
        float alpha = (float) ((0.7f/Rsub / radVelocity));
        alpha = Math.min(1.0f, alpha);
        if (arcs) {
            arc = new Path();
            float lx1 = (float) ((R-10)*Math.cos(-radVelocity));
            float ly1 = (float) ((R-10)*Math.sin(-radVelocity));
            float lxSub1 = (float) ((Rsub+10)*Math.cos(-radVelocity));
            float lySub1 = (float) ((Rsub+10)*Math.sin(-radVelocity));

            float lx2 = (float) ((R-10)*Math.cos(radVelocity));
            float ly2 = (float) ((R-10)*Math.sin(radVelocity));
            float lxSub2 = (float) ((Rsub+10)*Math.cos(radVelocity));
            float lySub2 = (float) ((Rsub+10)*Math.sin(radVelocity));
            arc.moveTo(lxSub1, lySub1);
            arc.lineTo(lx1, ly1);
            arc.lineTo(lx2, ly2);
            arc.lineTo(lxSub2, lySub2);
            arc.close();
            arc.setFillType(FillType.EVEN_ODD);
        }
        canvas.save();
        canvas.rotate(value * 360.0f * ((float) Math.pow(power, d)) / 2 / (float) Math.PI, 0, my);
        Paint marksC = new Paint(marksColour);
        marksC.setAlpha((int)(alpha * 255));
        for (float a = 0; a < 359.8; a += 10f) {
            canvas.save();
            canvas.rotate(a, 0, my);
            canvas.translate(0, my);
            if (arcs) {
                canvas.drawPath(arc, marksC);
            }
            else {
                canvas.drawLine(Rsub, 0, R, 0, marksC);
            }
            canvas.restore();
        }
        canvas.restore();
    }
    canvas.drawText("Value :" + value, 0, this.getHeight(), textColour);
    if (value != valueOld1) {
        valueOld1 = value;
        this.invalidate();
    }
}
项目:dev    文件:TouchSink.java   
@Override
public void draw(Canvas canvas) {
    if (!isInitialized) {
        calculateRegions();
        connected = getResources().getDrawable(A.drawable.remote_control_connected);
        disconnected = getResources().getDrawable(A.drawable.remote_control_disconnected);
        isInitialized = true;
    }
    int width = this.getWidth();
    int height = this.getHeight();

    Paint paint = new Paint();
    paint.setColor(Color.LTGRAY);
    paint.setStyle(Style.STROKE);

    if (isScrollPadActive()) {
        int sbLeft = width - (xScrollBar * 2 / 3);
        int sbRight = width - (xScrollBar / 3);
        Path path = new Path();
        path.setFillType(FillType.EVEN_ODD);
        path.moveTo((sbLeft + sbRight) / 2, scrollPad.top);
        path.lineTo(sbLeft, scrollPad.top + yBorder / 2);
        path.lineTo(sbRight, scrollPad.top + yBorder / 2);
        path.lineTo((sbLeft + sbRight) / 2, scrollPad.top);
        path.close();
        canvas.drawPath(path, paint);

        path = new Path();
        path.setFillType(FillType.EVEN_ODD);
        path.moveTo((sbLeft + sbRight) / 2, scrollPad.bottom);
        path.lineTo(sbLeft, scrollPad.bottom - yBorder / 2);
        path.lineTo(sbRight, scrollPad.bottom - yBorder / 2);
        path.lineTo((sbLeft + sbRight) / 2, scrollPad.bottom);
        path.close();
        canvas.drawPath(path, paint);

        for (int i = (2 * yBorder); i < height - (2 * yBorder); i += yScrollBarItem) {
            canvas.drawRect(
                    new Rect(sbLeft, i, sbRight, Math.min((i + (yScrollBarItem / 2)), (height - (2 * yScrollBarItem)))), paint);
        }
    }

    if (isButtonsActive()) {
        canvas.drawRoundRect(leftButton, 5, 5, paint);
        canvas.drawRoundRect(rightButton, 5, 5, paint);
    }

    if (isTouchPadActive()) {
        canvas.drawLines(new float[] { touchPad.left, touchPad.top + yBorder, touchPad.left, touchPad.bottom - yBorder,
                touchPad.right, touchPad.top + yBorder, touchPad.right, touchPad.bottom - yBorder, touchPad.left + xBorder,
                touchPad.top, touchPad.right - xBorder, touchPad.top, touchPad.left + xBorder, touchPad.bottom,
                touchPad.right - xBorder, touchPad.bottom }, paint);
    }

    if (isPointerStickActive()) {
        canvas.drawOval(pointerStick, paint);
        canvas.drawOval(pointerStickCenter, paint);
    }

    Drawable image = ((client != null) && client.isConnected()) ? connected : disconnected;
    if (image instanceof BitmapDrawable) {
        Bitmap bitmap = ((BitmapDrawable) image).getBitmap();
        Matrix matrix = new Matrix();
        matrix.setScale(0.5F, 0.5F);
        canvas.drawBitmap(bitmap, matrix, new Paint());
    }

    invalidate();
}