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


Java Path.quadTo方法代码示例

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


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

示例1: drawBubblePath

import android.graphics.Path; //导入方法依赖的package包/类
private void drawBubblePath(Canvas canvas, float triangleCenterX, float height, float width) {
    final Path path = new Path();

    int padding = 3;
    final Rect rect = new Rect(padding, padding, (int) width - padding, (int) (height - dpToPx(BUBBLE_ARROW_HEIGHT)) - padding);

    final float roundRectHeight = (height - dpToPx(BUBBLE_ARROW_HEIGHT)) / 2;

    path.moveTo(rect.left + roundRectHeight, rect.top);
    path.lineTo(rect.right - roundRectHeight, rect.top);
    path.quadTo(rect.right, rect.top, rect.right, rect.top + roundRectHeight);
    path.lineTo(rect.right, rect.bottom - roundRectHeight);
    path.quadTo(rect.right, rect.bottom, rect.right - roundRectHeight, rect.bottom);

    path.lineTo(triangleCenterX + dpToPx(BUBBLE_ARROW_WIDTH) / 2f, height - dpToPx(BUBBLE_ARROW_HEIGHT) - padding);
    path.lineTo(triangleCenterX, height - padding);
    path.lineTo(triangleCenterX - dpToPx(BUBBLE_ARROW_WIDTH) / 2f, height - dpToPx(BUBBLE_ARROW_HEIGHT) - padding);

    path.lineTo(rect.left + roundRectHeight, rect.bottom);
    path.quadTo(rect.left, rect.bottom, rect.left, rect.bottom - roundRectHeight);
    path.lineTo(rect.left, rect.top + roundRectHeight);
    path.quadTo(rect.left, rect.top, rect.left + roundRectHeight, rect.top);
    path.close();

    canvas.drawPath(path, settings.paintBubble);
}
 
开发者ID:florent37,项目名称:android-slidr,代码行数:27,代码来源:Slidr.java

示例2: drawLeftTop

import android.graphics.Path; //导入方法依赖的package包/类
private void drawLeftTop(Canvas canvas) {

        // 初始化数据点和控制点的位置
        start.x = mCornerRadius;
        start.y = 0;
        end.x = 0;
        end.y = mCornerRadius;
        control.x = 0;
        control.y = 0;

        Path leftTop = new Path();
        leftTop.lineTo(mCornerRadius,0);
        leftTop.quadTo(control.x,control.y,end.x,end.y);
        leftTop.lineTo(0,0);
        canvas.drawPath(leftTop,mPaint);
    }
 
开发者ID:jiajunhui,项目名称:PlayerBase,代码行数:17,代码来源:CornerCutView.java

示例3: composeRoundedRectPath

import android.graphics.Path; //导入方法依赖的package包/类
protected static Path composeRoundedRectPath(RectF rect, float tl, float tr, float bl, float br) {
    Path path = new Path();
    tl = tl < 0 ? 0 : tl;
    tr = tr < 0 ? 0 : tr;
    bl = bl < 0 ? 0 : bl;
    br = br < 0 ? 0 : br;

    path.moveTo(rect.left + tl, rect.top);
    path.lineTo(rect.right - tr, rect.top);
    path.quadTo(rect.right, rect.top, rect.right, rect.top + tr);
    path.lineTo(rect.right, rect.bottom - br);
    path.quadTo(rect.right, rect.bottom, rect.right - br, rect.bottom);
    path.lineTo(rect.left + bl, rect.bottom);
    path.quadTo(rect.left, rect.bottom, rect.left, rect.bottom - bl);
    path.lineTo(rect.left, rect.top + tl);
    path.quadTo(rect.left, rect.top, rect.left + tl, rect.top);
    path.close();

    return path;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:21,代码来源:BaseAppWidget.java

示例4: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    // 绘制数据点和控制点
    mPaint.setColor(Color.GRAY);
    mPaint.setStrokeWidth(10);
    canvas.drawPoint(mStart.x, mStart.y, mPaint);
    canvas.drawPoint(mEnd.x, mEnd.y, mPaint);
    canvas.drawPoint(mControl.x, mControl.y, mPaint);

    // 绘制辅助线
    canvas.drawLine(mStart.x, mStart.y, mControl.x, mControl.y, mPaint);
    canvas.drawLine(mControl.x, mControl.y, mEnd.x, mEnd.y, mPaint);

    // 绘制贝塞尔曲线
    mPaint.setColor(Color.RED);
    mPaint.setStrokeWidth(8);

    Path path = new Path();
    path.moveTo(mStart.x, mStart.y);
    path.quadTo(mControl.x, mControl.y, mEnd.x, mEnd.y);

    canvas.drawPath(path, mPaint);
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:26,代码来源:Bezier2View.java

示例5: drawLeftBottom

import android.graphics.Path; //导入方法依赖的package包/类
private void drawLeftBottom(Canvas canvas) {

        // 初始化数据点和控制点的位置
        start.x = 0;
        start.y = mHeight - mCornerRadius;
        end.x = mCornerRadius;
        end.y = mHeight;
        control.x = 0;
        control.y = mHeight;

        Path leftBottom = new Path();
        leftBottom.moveTo(0,mHeight);
        leftBottom.lineTo(0,mHeight - mCornerRadius);
        leftBottom.quadTo(control.x,control.y,end.x,end.y);
        leftBottom.lineTo(0,mHeight);
        canvas.drawPath(leftBottom,mPaint);
    }
 
开发者ID:jiajunhui,项目名称:PlayerBase,代码行数:18,代码来源:CornerCutView.java

示例6: createWaitPath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createWaitPath(RectF bounds) {
    Path path = new Path();
    //create circle
    path.moveTo(bounds.centerX() + mWaitCircleRadius, bounds.centerY());

    //create w
    path.cubicTo(bounds.centerX() + mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius * 0.5f,
            bounds.centerX() + mWaitCircleRadius * 0.3f, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() - mWaitCircleRadius * 0.35f, bounds.centerY() + mWaitCircleRadius * 0.5f);
    path.quadTo(bounds.centerX() + mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() + mWaitCircleRadius * 0.05f, bounds.centerY() + mWaitCircleRadius * 0.5f);
    path.lineTo(bounds.centerX() + mWaitCircleRadius * 0.75f, bounds.centerY() - mWaitCircleRadius * 0.2f);

    path.cubicTo(bounds.centerX(), bounds.centerY() + mWaitCircleRadius * 1f,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY() + mWaitCircleRadius * 0.4f,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY());

    //create arc
    path.arcTo(new RectF(bounds.centerX() - mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY() + mWaitCircleRadius), 0, -359);
    path.arcTo(new RectF(bounds.centerX() - mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY() + mWaitCircleRadius), 1, -359);
    path.arcTo(new RectF(bounds.centerX() - mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY() + mWaitCircleRadius), 2, -2);
    //create w
    path.cubicTo(bounds.centerX() + mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius * 0.5f,
            bounds.centerX() + mWaitCircleRadius * 0.3f, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() - mWaitCircleRadius * 0.35f, bounds.centerY() + mWaitCircleRadius * 0.5f);
    path.quadTo(bounds.centerX() + mWaitCircleRadius, bounds.centerY() - mWaitCircleRadius,
            bounds.centerX() + mWaitCircleRadius * 0.05f, bounds.centerY() + mWaitCircleRadius * 0.5f);
    path.lineTo(bounds.centerX() + mWaitCircleRadius * 0.75f, bounds.centerY() - mWaitCircleRadius * 0.2f);

    path.cubicTo(bounds.centerX(), bounds.centerY() + mWaitCircleRadius * 1f,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY() + mWaitCircleRadius * 0.4f,
            bounds.centerX() + mWaitCircleRadius, bounds.centerY());

    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:CoolWaitLoadingRenderer.java

示例7: createMotherMovePath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createMotherMovePath() {
    Path path = new Path();

    float centerX = mCurrentBounds.centerX();
    float centerY = mCurrentBounds.centerY();
    float currentPathLength = 0.0f;

    path.moveTo(centerX, centerY);
    //forward top left
    path.quadTo(centerX - mMotherOvalHalfWidth * 2.0f, centerY,
            centerX - mMotherOvalHalfWidth * 2.0f, centerY - mMotherOvalHalfHeight);
    mStageMotherForwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageMotherForwardTopLeftLength;

    //backward top left
    path.quadTo(centerX - mMotherOvalHalfWidth * 1.0f, centerY - mMotherOvalHalfHeight,
            centerX, centerY);
    mStageMotherBackwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageMotherBackwardTopLeftLength;
    //forward bottom left
    path.quadTo(centerX, centerY + mMotherOvalHalfHeight,
            centerX - mMotherOvalHalfWidth / 2, centerY + mMotherOvalHalfHeight * 1.1f);
    mStageMotherForwardBottomLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageMotherForwardBottomLeftLength;
    //backward bottom left
    path.quadTo(centerX - mMotherOvalHalfWidth / 2, centerY + mMotherOvalHalfHeight * 0.6f,
            centerX, centerY);
    mStageMotherBackwardBottomLeftLength = getRestLength(path, currentPathLength);

    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:CircleBroodLoadingRenderer.java

示例8: createMoonPath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createMoonPath(float moonCenterX, float moonCenterY) {
    RectF moonRectF = new RectF(moonCenterX - mSun$MoonRadius, moonCenterY - mSun$MoonRadius,
            moonCenterX + mSun$MoonRadius, moonCenterY + mSun$MoonRadius);
    Path path = new Path();
    path.addArc(moonRectF, -90, 180);
    path.quadTo(moonCenterX + mSun$MoonRadius / 2.0f, moonCenterY, moonCenterX, moonCenterY - mSun$MoonRadius);
    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:DayNightLoadingRenderer.java

示例9: createFishPath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createFishPath(float fishCenterX, float fishCenterY) {
    Path path = new Path();

    float fishHeadX = fishCenterX;
    float fishHeadY = fishCenterY - mFishHeight / 2.0f;

    //the head of the fish
    path.moveTo(fishHeadX, fishHeadY);
    //the left body of the fish
    path.quadTo(fishHeadX - mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.222f, fishHeadX - mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.444f);
    path.lineTo(fishHeadX - mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.666f);
    path.lineTo(fishHeadX - mFishWidth * 0.5f, fishHeadY + mFishHeight * 0.8f);
    path.lineTo(fishHeadX - mFishWidth * 0.5f, fishHeadY + mFishHeight);

    //the tail of the fish
    path.lineTo(fishHeadX, fishHeadY + mFishHeight * 0.9f);

    //the right body of the fish
    path.lineTo(fishHeadX + mFishWidth * 0.5f, fishHeadY + mFishHeight);
    path.lineTo(fishHeadX + mFishWidth * 0.5f, fishHeadY + mFishHeight * 0.8f);
    path.lineTo(fishHeadX + mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.666f);
    path.lineTo(fishHeadX + mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.444f);
    path.quadTo(fishHeadX + mFishWidth * 0.333f, fishHeadY + mFishHeight * 0.222f, fishHeadX, fishHeadY);

    path.close();

    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:FishLoadingRenderer.java

示例10: eraserTouchEvent

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 橡皮擦事件
 */
private void eraserTouchEvent(MotionEvent event) {
    int action = event.getAction();
    float x = event.getX();
    float y = event.getY();
    switch (action) {
        case MotionEvent.ACTION_DOWN:
            //路径
            eraserPath = new Path();
            mLastX = x;
            mLastY = y;
            eraserPath.moveTo(mLastX, mLastY);
            break;
        case MotionEvent.ACTION_MOVE:
            float dx = Math.abs(x - mLastX);
            float dy = Math.abs(y - mLastY);
            if (dx >= 3 || dy >= 3) {//绘制的最小距离 3px
                eraserPath.quadTo(mLastX, mLastY, (mLastX + x) / 2, (mLastY + y) / 2);
            }
            mLastX = x;
            mLastY = y;
            break;
        case MotionEvent.ACTION_UP:
            mCanvas.drawPath(eraserPath, eraserPaint);//将路径绘制在mBitmap上
            eraserPath.reset();
            eraserPath = null;
            break;
    }
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:32,代码来源:PaintView.java

示例11: drawPillar

import android.graphics.Path; //导入方法依赖的package包/类
private void drawPillar(Canvas canvas) {
    mPillarPath = new Path();
    mPillarPath.moveTo(mCenterPoint.x-width/90,mCenterPoint.y-width/90);
    mPillarPath.lineTo(mCenterPoint.x+width/90,mCenterPoint.y-width/90);//连线
    mPillarPath.lineTo(mCenterPoint.x+width/35,height-height/35);
    mPillarPath.quadTo(mCenterPoint.x,height,mCenterPoint.x-width/35,height-height/35);//贝塞尔曲线,控制点和终点
    mPillarPath.close();//闭合图形
    canvas.drawPath(mPillarPath,mWindmillPaint);

}
 
开发者ID:YugengWang,项目名称:OneWeather,代码行数:11,代码来源:Windmill.java

示例12: drawPath2

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 画线   一天线
 *
 * @param canvas
 */
private void drawPath2(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.BLUE);
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    Path path = new Path();
    path.lineTo(100, 100);
    path.rLineTo(100, 0); //r 是相对路径 意思是从上次的(100,100)为起点,相对来说画一条向右 100 的直线
    path.quadTo(100, 100, 500, 500);
    canvas.drawPath(path, paint);
}
 
开发者ID:songjiabin,项目名称:MySelfDemo,代码行数:17,代码来源:MyView2.java

示例13: getPath

import android.graphics.Path; //导入方法依赖的package包/类
Path getPath() {
    Path path = new Path();
    path.moveTo(LEFT_CURVE[0].x, LEFT_CURVE[0].y);
    path.quadTo(LEFT_CURVE[1].x, LEFT_CURVE[1].y, LEFT_CURVE[2].x, LEFT_CURVE[2].y);
    path.cubicTo(CURVE_CTR[3].x, CURVE_CTR[3].y, CURVE_CTR[2].x, CURVE_CTR[2].y, RIGHT_CURVE[2].x, RIGHT_CURVE[2].y);
    path.quadTo(RIGHT_CURVE[1].x, RIGHT_CURVE[1].y, RIGHT_CURVE[0].x, RIGHT_CURVE[0].y);
    path.cubicTo(CURVE_CTR[0].x, CURVE_CTR[0].y, CURVE_CTR[1].x, CURVE_CTR[1].y, LEFT_CURVE[0].x, LEFT_CURVE[0].y);
    return path;
}
 
开发者ID:shellljx,项目名称:FuckingVolumeSlider,代码行数:10,代码来源:Speaker.java

示例14: createChildMovePath

import android.graphics.Path; //导入方法依赖的package包/类
private Path createChildMovePath() {
    Path path = new Path();

    float centerX = mCurrentBounds.centerX();
    float centerY = mCurrentBounds.centerY();
    float currentPathLength = 0.0f;

    //start
    path.moveTo(centerX, centerY);
    //pre forward top left
    path.lineTo(centerX + mMotherOvalHalfWidth * 0.75f, centerY);
    mStageChildPreForwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageChildPreForwardTopLeftLength;
    //forward top left
    path.quadTo(centerX - mMotherOvalHalfWidth * 0.5f, centerY,
            centerX - mMotherOvalHalfWidth * 2.0f, centerY - mMotherOvalHalfHeight);
    mStageChildForwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageChildForwardTopLeftLength;
    //pre backward top left
    path.lineTo(centerX - mMotherOvalHalfWidth * 2.0f + mMotherOvalHalfWidth * 0.2f, centerY - mMotherOvalHalfHeight);
    path.quadTo(centerX - mMotherOvalHalfWidth * 2.5f, centerY - mMotherOvalHalfHeight * 2,
            centerX - mMotherOvalHalfWidth * 1.5f, centerY - mMotherOvalHalfHeight * 2.25f);
    mStageChildPreBackwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageChildPreBackwardTopLeftLength;
    //backward top left
    path.quadTo(centerX - mMotherOvalHalfWidth * 0.2f, centerY - mMotherOvalHalfHeight * 2.25f,
            centerX, centerY);
    mStageChildBackwardTopLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageChildBackwardTopLeftLength;
    //forward bottom left
    path.cubicTo(centerX, centerY + mMotherOvalHalfHeight,
            centerX - mMotherOvalHalfWidth, centerY + mMotherOvalHalfHeight * 2.5f,
            centerX - mMotherOvalHalfWidth * 1.5f, centerY + mMotherOvalHalfHeight * 2.5f);
    mStageChildForwardBottomLeftLength = getRestLength(path, currentPathLength);
    currentPathLength += mStageChildForwardBottomLeftLength;
    //backward bottom left
    path.cubicTo(
            centerX - mMotherOvalHalfWidth * 2.0f, centerY + mMotherOvalHalfHeight * 2.5f,
            centerX - mMotherOvalHalfWidth * 3.0f, centerY + mMotherOvalHalfHeight * 0.8f,
            centerX, centerY);
    mStageChildBackwardBottomLeftLength = getRestLength(path, currentPathLength);

    return path;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:CircleBroodLoadingRenderer.java

示例15: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (width > imageRadius && height > imageRadius) {
        Path path = new Path();
        switch (imagePosition) {
            case 0://all
                path.moveTo(imageRadius, 0);
                path.lineTo(width - imageRadius, 0);
                path.quadTo(width, 0, width, imageRadius);
                path.lineTo(width, height - imageRadius);
                path.quadTo(width, height, width - imageRadius, height);
                path.lineTo(imageRadius, height);
                path.quadTo(0, height, 0, height - imageRadius);
                path.lineTo(0, imageRadius);
                path.quadTo(0, 0, imageRadius, 0);
                break;
            case 1://left
                path.moveTo(imageRadius, 0);
                path.lineTo(width, 0);
                path.lineTo(width, height);
                path.lineTo(imageRadius, height);
                path.quadTo(0, height, 0, height - imageRadius);
                path.lineTo(0, imageRadius);
                path.quadTo(0, 0, imageRadius, 0);
                break;
            case 2://top
                path.moveTo(imageRadius, 0);
                path.lineTo(width - imageRadius, 0);
                path.quadTo(width, 0, width, imageRadius);
                path.lineTo(width, height);
                path.lineTo(0, height);
                path.lineTo(0, imageRadius);
                path.quadTo(0, 0, imageRadius, 0);
                break;
            case 3://right
                path.lineTo(width - imageRadius, 0);
                path.quadTo(width, 0, width, imageRadius);
                path.lineTo(width, height - imageRadius);
                path.quadTo(width, height, width - imageRadius, height);
                path.lineTo(0, height);
                path.lineTo(0, 0);
                break;
            case 4://bottom
                path.lineTo(width, 0);
                path.lineTo(width, height - imageRadius);
                path.quadTo(width, height, width - imageRadius, height);
                path.lineTo(imageRadius, height);
                path.quadTo(0, height, 0, height - imageRadius);
                path.lineTo(0, 0);
                break;
        }
        canvas.clipPath(path);
    }

    super.onDraw(canvas);
}
 
开发者ID:Jusenr,项目名称:AppFirCloud,代码行数:57,代码来源:RoundImageView.java


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