当前位置: 首页>>代码示例>>Java>>正文


Java FillType类代码示例

本文整理汇总了Java中android.graphics.Path.FillType的典型用法代码示例。如果您正苦于以下问题:Java FillType类的具体用法?Java FillType怎么用?Java FillType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FillType类属于android.graphics.Path包,在下文中一共展示了FillType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawTriangle

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:MaterialProgressDrawable.java

示例2: buildShadowCorners

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:RoundRectDrawableWithShadow.java

示例3: buildShadowCorners

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:ShadowDrawableWrapper.java

示例4: DiscoveryBadgeRating

import android.graphics.Path.FillType; //导入依赖的package包/类
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));
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:DiscoveryBadgeRating.java

示例5: draw

import android.graphics.Path.FillType; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:27,代码来源:Polygon.java

示例6: drawDirections

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:Mapyst,项目名称:Mapyst,代码行数:19,代码来源:RouteMapOverlay.java

示例7: getClipRuleFromState

import android.graphics.Path.FillType; //导入依赖的package包/类
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;
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:13,代码来源:SVGAndroidRenderer.java

示例8: onMeasure

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:40,代码来源:lpc.java

示例9: Path

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:38,代码来源:Chart.java

示例10: drawAxis

import android.graphics.Path.FillType; //导入依赖的package包/类
/**
 * 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);

}
 
开发者ID:KalebKE,项目名称:AccelerationExplorer,代码行数:39,代码来源:GaugeVector.java

示例11: cropImageByPath

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:coderush,项目名称:FlexiCrop,代码行数:12,代码来源:MainActivity.java

示例12: drawPath

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:Mapyst,项目名称:Mapyst,代码行数:15,代码来源:RouteMapOverlay.java

示例13: buildComponents

import android.graphics.Path.FillType; //导入依赖的package包/类
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();
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:65,代码来源:CardBubbleForegroundDrawable.java

示例14: StarRatingBar

import android.graphics.Path.FillType; //导入依赖的package包/类
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);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:66,代码来源:StarRatingBar.java

示例15: draw

import android.graphics.Path.FillType; //导入依赖的package包/类
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();
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:47,代码来源:MaterialProgressDrawable.java


注:本文中的android.graphics.Path.FillType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。