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


Java Path.reset方法代码示例

本文整理汇总了Java中android.graphics.Path.reset方法的典型用法代码示例。如果您正苦于以下问题:Java Path.reset方法的具体用法?Java Path.reset怎么用?Java Path.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Path的用法示例。


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

示例1: drawPolygon

import android.graphics.Path; //导入方法依赖的package包/类
private void drawPolygon(Canvas canvas) {
    Path path = new Path();
    float r = radius / layerCount;
    for (int i = layerCount; i >= 1; i--) {
        float curR = r * i;
        path.reset();
        for (int j = 0; j < count; j++) {
            if (j == 0) {
                path.moveTo(centerX, centerY - curR);
            } else {
                path.lineTo((float) (centerX + Math.cos(angle * j + Math.PI / 2) * curR), (float) (centerY - Math.sin(angle * j + Math.PI / 2) * curR));
            }

        }
        path.close();
        canvas.drawPath(path, cobwebPaint);
    }
}
 
开发者ID:hust201010701,项目名称:XRadarView,代码行数:19,代码来源:XRadarView.java

示例2: computePath

import android.graphics.Path; //导入方法依赖的package包/类
private void computePath(Rect bounds) {
    final float currentScale = mCurrentScale;
    final Path path = mPath;
    final RectF rect = mRect;
    final Matrix matrix = mMatrix;

    path.reset();
    int totalSize = Math.min(bounds.width(), bounds.height());

    float initial = mClosedStateSize;
    float destination = totalSize;
    float currentSize = initial + (destination - initial) * currentScale;

    float halfSize = currentSize / 2f;
    float inverseScale = 1f - currentScale;
    float cornerSize = halfSize * inverseScale;
    float[] corners = new float[]{halfSize, halfSize, halfSize, halfSize, halfSize, halfSize, cornerSize, cornerSize};
    rect.set(bounds.left, bounds.top, bounds.left + currentSize, bounds.top + currentSize);
    path.addRoundRect(rect, corners, Path.Direction.CCW);
    matrix.reset();
    matrix.postRotate(-45, bounds.left + halfSize, bounds.top + halfSize);
    matrix.postTranslate((bounds.width() - currentSize) / 2, 0);
    float hDiff = (bounds.bottom - currentSize - mExternalOffset) * inverseScale;
    matrix.postTranslate(0, hDiff);
    path.transform(matrix);
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:27,代码来源:MarkerDrawable.java

示例3: drawDownLoaded

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * Draw success
 */
private void drawDownLoaded(Canvas canvas, STATUS_MARK status, RectF bounds, float angle) {
    publicPaint.setColor(getProgressColor());
    switch (status) {
        case DRAW_ARC:
            canvas.drawArc(bounds, DEGREE_END_ANGLE - angle, 0.001f * TOTAL_ANGLE, false, publicPaint);
            break;
        case DRAW_MARK:
            final Path dst = mDst;
            dst.reset();
            //to fix hardware speedup bug
            dst.lineTo(0, 0);
            pathMeasure1.getSegment(mMarkOkstart * mMarkOklength, (mMarkOkstart + mMarkOkdegree) * mMarkOklength, dst, true);
            canvas.drawPath(dst, publicPaint);
            break;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:FreshDownloadView.java

示例4: paintTriplet

import android.graphics.Path; //导入方法依赖的package包/类
public void paintTriplet(Triplet triplet, Canvas canvas, Paint tripletPaint,
                         Junction junctionsArray[], Path tripletPath) {
    int junctionNo1 = triplet.getJunctionNo1();
    int junctionNo2 = triplet.getJunctionNo2();
    int junctionNo3 = triplet.getJunctionNo3();

    tripletPath.reset();
    tripletPath.moveTo(junctionsArray[junctionNo1].getX(), junctionsArray[junctionNo1].getY());
    tripletPath.lineTo(junctionsArray[junctionNo2].getX(), junctionsArray[junctionNo2].getY());
    tripletPath.lineTo(junctionsArray[junctionNo3].getX(), junctionsArray[junctionNo3].getY());

    canvas.drawPath(tripletPath, tripletPaint);
}
 
开发者ID:varunon9,项目名称:Fitto,代码行数:14,代码来源:GameUtility.java

示例5: buildBorderPath

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void buildBorderPath(Path borderPath) {
	borderPath.reset();
	
	final float halfBorderWidth = getBorderWidth() * 0.5f;
	
	final int width = getWidth();
	final int height = getHeight();
	radius = Math.min(radius, Math.min(width, height) * 0.5f);
	
	RectF rect = new RectF(halfBorderWidth, halfBorderWidth,
			width - halfBorderWidth, height - halfBorderWidth);
	borderPath.addRoundRect(rect , radius, radius, Direction.CW);
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:15,代码来源:RoundImageView.java

示例6: makeBorderPath

import android.graphics.Path; //导入方法依赖的package包/类
private static void makeBorderPath(Path borderPath, int w, int h, float inset) {
	w -= inset;
	h -= inset;
	borderPath.reset();
	borderPath.moveTo(w, inset);
	borderPath.lineTo(w, h);
	borderPath.lineTo(inset, h);
	borderPath.addArc(new RectF(inset, inset, 2 * w, 2 * h), 180, 270);
	borderPath.close();
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:11,代码来源:HueSatView.java

示例7: updatePath

import android.graphics.Path; //导入方法依赖的package包/类
protected final void updatePath(Path path, float correction) {
  path.reset();

  TMP_RECT.set(
      getLeft() + correction,
      getTop() + correction,
      getRight() - correction,
      getBottom() - correction);

  path.addRoundRect(
      TMP_RECT,
      mBorderRadius,
      mBorderRadius,
      Path.Direction.CW);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:16,代码来源:AbstractDrawBorder.java

示例8: drawLines

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 绘制直线
 */
private void drawLines(Canvas canvas){
    Path path = new Path();
    for(int i=0;i<count;i++){
        path.reset();
        path.moveTo(centerX, centerY);
        float x = (float) (centerX+radius*Math.cos(angle*i));
        float y = (float) (centerY+radius*Math.sin(angle*i));
        path.lineTo(x, y);
        canvas.drawPath(path, mainPaint);
    }
}
 
开发者ID:lixiaodaoaaa,项目名称:ColumnAnimViewProject,代码行数:15,代码来源:RadarView.java

示例9: drawGridLine

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void drawGridLine(Canvas c, float x, float y, Path gridLinePath) {

    gridLinePath.moveTo(mViewPortHandler.contentRight(), y);
    gridLinePath.lineTo(mViewPortHandler.contentLeft(), y);

    // draw a path because lines don't support dashing on lower android versions
    c.drawPath(gridLinePath, mGridPaint);

    gridLinePath.reset();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:12,代码来源:XAxisRendererHorizontalBarChart.java

示例10: fillPolygon

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void fillPolygon(final int[] x, final int[] y, final int length)
{
	final Path path = new Path();
	path.reset(); // only needed when reusing this path for a new build
	path.moveTo(x[0], y[0]); // used for first point
	for (int i = 1; i < length; i++)
	{
		path.lineTo(x[i], y[i]);
	}
	path.lineTo(x[0], y[0]);
	this.paint.setStyle(Style.FILL_AND_STROKE);
	this.canvas.drawPath(path, this.paint);
}
 
开发者ID:1313ou,项目名称:TreebolicLib,代码行数:15,代码来源:Graphics.java

示例11: heart

import android.graphics.Path; //导入方法依赖的package包/类
private Bitmap heart(Bitmap bitmap) {
    Bitmap bmp;
    float width = bitmap.getWidth();
    float height = bitmap.getHeight();

    bmp = Bitmap.createBitmap((int) width, (int) height, Bitmap.Config.ARGB_8888);
    BitmapShader shader = new BitmapShader(bitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);

    Canvas canvas = new Canvas(bmp);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setShader(shader);

    Path oval = new Path();
    Matrix matrix = new Matrix();
    Region region = new Region();
    RectF ovalRect = new RectF(width / OVAL_FACTOR, 0, width - (width / OVAL_FACTOR), height);

    oval.addOval(ovalRect, Path.Direction.CW);
    matrix.postRotate(ROTATION, width / 2, height / 2);
    oval.transform(matrix, oval);
    region.setPath(oval, new Region((int) width / 2, 0, (int) width, (int) height));
    canvas.drawPath(region.getBoundaryPath(), paint);

    matrix.reset();
    oval.reset();
    oval.addOval(ovalRect, Path.Direction.CW);
    matrix.postRotate(-ROTATION, width / 2, height / 2);
    oval.transform(matrix, oval);
    region.setPath(oval, new Region(0, 0, (int) width / 2, (int) height));
    canvas.drawPath(region.getBoundaryPath(), paint);

    return bmp;
}
 
开发者ID:StylingAndroid,项目名称:PresenterLite,代码行数:35,代码来源:ShapedImageView.java

示例12: onSizeChanged

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    mWavePath.reset();
    mWavePath.moveTo(0, mAmplitude);
    int waveCount = (int) (w % mWaveLength == 0 ? w / mWaveLength + 1 : w / mWaveLength + 2);
    for (int i = 0; i < waveCount; i++) {
        mWavePath.quadTo(mWaveLength / 4 + i * mWaveLength, -mAmplitude, mWaveLength / 2 +
                i * mWaveLength, mAmplitude);
        mWavePath.quadTo(mWaveLength / 4 * 3 + i * mWaveLength, mAmplitude * 2, mWaveLength + i
                * mWaveLength, mAmplitude);
    }
    mWavePath.lineTo(mWaveLength * waveCount, mAmplitude * 2 + mTextRect.height());
    mWavePath.lineTo(0, mAmplitude * 2 + mTextRect.height());
    mWavePath.offset(0, -mAmplitude * 2);
    mTextPath.reset();
    float offsetX = 0;
    final Path tempPath = new Path();
    final Paint.FontMetrics tempFontMetrics = new Paint.FontMetrics();
    mTextPaint.getFontMetrics(tempFontMetrics);
    for (int i = 0; i < mText.length(); i++) {
        String str = mText.substring(i, i + 1);
        mTextPaint.getTextPath(str, 0, 1, 0, 0, tempPath);
        mTextPath.addPath(tempPath, offsetX, 0);
        offsetX += mTextSpacing;
        offsetX += mTextPaint.measureText(str, 0, 1);
    }
    tempPath.reset();
    mTextPath.computeBounds(mTextRectF, true);
    mTextPath.offset(w / 2 - mTextRectF.width() / 2, getPaddingTop()
            - mTextRectF.top);
    mOffsetX = 0;
}
 
开发者ID:dkzwm,项目名称:SmoothRefreshLayout,代码行数:33,代码来源:WaveTextRefreshView.java

示例13: setInflightPath

import android.graphics.Path; //导入方法依赖的package包/类
public void setInflightPath(float[] vertex, Path arrowPath) {
    arrowPath.reset();
    arrowPath.moveTo(vertex[0], vertex[1]);
    arrowPath.lineTo(vertex[2], vertex[3]);
    arrowPath.lineTo(vertex[4], vertex[5]);
    arrowPath.lineTo(vertex[6], vertex[7]);
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:8,代码来源:GalaxyView.java

示例14: drawPolyline

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void drawPolyline(final int[] x, final int[] y, final int length)
{
	final Path path = new Path();
	path.reset(); // only needed when reusing this path for a new build
	int i = 0;
	path.moveTo(x[i], y[i]); // used for first point
	for (++i; i < length; i++)
	{
		path.lineTo(x[i], y[i]);
	}
	this.paint.setStyle(Style.STROKE);
	this.canvas.drawPath(path, this.paint);
}
 
开发者ID:1313ou,项目名称:TreebolicLib,代码行数:15,代码来源:Graphics.java

示例15: renderLimitLines

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void renderLimitLines(Canvas c) {

    List<LimitLine> limitLines = mYAxis.getLimitLines();

    if (limitLines == null)
        return;

    float sliceangle = mChart.getSliceAngle();

    // calculate the factor that is needed for transforming the value to
    // pixels
    float factor = mChart.getFactor();

    MPPointF center = mChart.getCenterOffsets();
    MPPointF pOut = MPPointF.getInstance(0,0);
    for (int i = 0; i < limitLines.size(); i++) {

        LimitLine l = limitLines.get(i);

        if (!l.isEnabled())
            continue;

        mLimitLinePaint.setColor(l.getLineColor());
        mLimitLinePaint.setPathEffect(l.getDashPathEffect());
        mLimitLinePaint.setStrokeWidth(l.getLineWidth());

        float r = (l.getLimit() - mChart.getYChartMin()) * factor;

        Path limitPath = mRenderLimitLinesPathBuffer;
        limitPath.reset();


        for (int j = 0; j < mChart.getData().getMaxEntryCountSet().getEntryCount(); j++) {

            Utils.getPosition(center, r, sliceangle * j + mChart.getRotationAngle(), pOut);

            if (j == 0)
                limitPath.moveTo(pOut.x, pOut.y);
            else
                limitPath.lineTo(pOut.x, pOut.y);
        }
        limitPath.close();

        c.drawPath(limitPath, mLimitLinePaint);
    }
    MPPointF.recycleInstance(center);
    MPPointF.recycleInstance(pOut);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:50,代码来源:YAxisRendererRadarChart.java


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