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

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

源代码1 项目: android-DecoView-charting   文件: LineArcSeries.java
/**
 * Draw the {@link EdgeDetail} for this View. Note that on API 11 - 17 clipPath is only available
 * if HardwareAcceleration is disable. A function {@link DecoView#enableCompatibilityMode()}
 * is provided which will disable on affected platforms however this needs to be explicitly
 * called by the user, otherwise EdgeDetails will not be drawn
 *
 * @param canvas Canvas to draw to
 */
private void drawArcEdgeDetail(@NonNull Canvas canvas) {
    ArrayList<EdgeDetail> edgeDetailList = getSeriesItem().getEdgeDetail();
    if (edgeDetailList == null) {
        return;
    }

    for (EdgeDetail edgeDetail : edgeDetailList) {
        final boolean drawInner = edgeDetail.getEdgeType() == EdgeDetail.EdgeType.EDGE_INNER;
        if (edgeDetail.getClipPath() == null) {
            float inset = (edgeDetail.getRatio() - 0.5f) * mSeriesItem.getLineWidth();
            if (drawInner) {
                inset = -inset;
            }

            Path clipPath = new Path();
            RectF clipRect = new RectF(mBoundsInset);
            clipRect.inset(inset, inset);
            clipPath.addOval(clipRect, Path.Direction.CW);
            edgeDetail.setClipPath(clipPath);
        }
        drawClippedArc(canvas, edgeDetail.getClipPath(), edgeDetail.getColor(),
                drawInner ? Region.Op.INTERSECT : Region.Op.DIFFERENCE);
    }
}
 
源代码2 项目: Svg-for-Apache-Weex   文件: WXSvgEllipse.java
@Override
protected Path getPath(Canvas canvas, Paint paint) {
  Path path = new Path();
  float cx = ParserHelper.fromPercentageToFloat(mCx, mCanvasWidth, 0, mScale);
  float cy = ParserHelper.fromPercentageToFloat(mCy, mCanvasHeight, 0, mScale);
  float rx = ParserHelper.fromPercentageToFloat(mRx, mCanvasWidth, 0, mScale);
  float ry = ParserHelper.fromPercentageToFloat(mRy, mCanvasHeight, 0, mScale);
  RectF oval = new RectF(cx - rx, cy - ry, cx + rx, cy + ry);
  path.addOval(oval, Path.Direction.CW);
  return path;
}
 
源代码3 项目: android-DecoView-charting   文件: PieSeries.java
/**
 * Draw the {@link EdgeDetail} for this View. Note that on API 11 - 17 clipPath is only available
 * if HardwareAcceleration is disable. A function {@link DecoView#enableCompatibilityMode()}
 * is provided which will disable on affected platforms however this needs to be explicitly
 * called by the user, otherwise EdgeDetails will not be drawn
 *
 * @param canvas Canvas to draw to
 */
private void drawArcEdgeDetail(@NonNull Canvas canvas) {
    ArrayList<EdgeDetail> edgeDetailList = getSeriesItem().getEdgeDetail();
    if (edgeDetailList == null) {
        return;
    }

    for (EdgeDetail edgeDetail : edgeDetailList) {
        final boolean drawInner = edgeDetail.getEdgeType() == EdgeDetail.EdgeType.EDGE_INNER;
        if (drawInner) {
            //TODO: Implement EDGE_INNER for pie
            Log.w(TAG, "EDGE_INNER Not Yet Implemented for pie chart");
            continue;
        }
        if (edgeDetail.getClipPath() == null) {
            float inset = (edgeDetail.getRatio() - 0.5f) * mPaint.getStrokeWidth();

            Path clipPath = new Path();
            RectF clipRect = new RectF(mBoundsInset);
            clipRect.inset(inset, inset);
            clipPath.addOval(clipRect, Path.Direction.CW);
            edgeDetail.setClipPath(clipPath);
        }
        //noinspection ConstantConditions
        drawClippedArc(canvas, edgeDetail.getClipPath(), edgeDetail.getColor(),
                drawInner ? Region.Op.INTERSECT : Region.Op.DIFFERENCE);
    }
}
 
源代码4 项目: ProjectX   文件: Compat.java
@Override
public void addOval(Path path, float left, float top, float right, float bottom,
                    Path.Direction dir) {
    final RectF oval = get();
    oval.set(left, top, right, bottom);
    path.addOval(oval, dir);
    put(oval);
}
 
源代码5 项目: ProjectX   文件: Compat.java
@Override
public void addOval(Path path, float left, float top, float right, float bottom,
                    Path.Direction dir) {
    final RectF oval = get();
    oval.set(left, top, right, bottom);
    path.addOval(oval, dir);
    put(oval);
}
 
源代码6 项目: pixate-freestyle-android   文件: PXEllipse.java
@Override
protected Path newPath() {
    Path path = ObjectPool.pathPool.checkOut();
    RectF rect = new RectF(center.x - radiusX, center.y - radiusY, center.x + radiusX, center.y
            + radiusY);
    path.addOval(rect, Direction.CW);
    return path;
}
 
源代码7 项目: cidrawing   文件: OvalElement.java
@Override
protected Path createShapePath() {
    Path path = new Path();
    path.addOval(shapeBox, Path.Direction.CW);
    return path;
}
 
源代码8 项目: ticdesign   文件: CircleDrawable.java
@Override
protected void onResetPath(Path path, Rect bounds) {
    path.reset();
    path.addOval(bounds.left, bounds.top, bounds.right, bounds.bottom, Path.Direction.CW);
}
 
源代码9 项目: ticdesign   文件: WindowUtils.java
@Override
protected void onResetPath(Path path, Rect bounds) {
    path.reset();
    path.addOval(bounds.left - 1, bounds.top - 1, bounds.right + 1, bounds.bottom + 1, Path.Direction.CW);
}
 
源代码10 项目: ProjectX   文件: Compat.java
@Override
public void addOval(Path path, float left, float top, float right, float bottom,
                    Path.Direction dir) {
    path.addOval(left, top, right, bottom, dir);
}
 
源代码11 项目: ProjectX   文件: Compat.java
@Override
public void addOval(Path path, float left, float top, float right, float bottom,
                    Path.Direction dir) {
    path.addOval(left, top, right, bottom, dir);
}
 
源代码12 项目: mil-sym-android   文件: PathUtilties.java
public static void addEllipse(Path path, float x, float y, float w, float h)
{
	path.addOval(new RectF(x, y, x + w, y + h), Direction.CW);
}
 
源代码13 项目: mil-sym-android   文件: PathUtilties.java
public static void addEllipse(Path path, float x, float y, float w, float h, Direction dir)
{
	path.addOval(new RectF(x, y, x + w, y + h), dir);
}