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


Java Path.close方法代码示例

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


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

示例1: drawWind

import android.graphics.Path; //导入方法依赖的package包/类
private void drawWind(Canvas canvas) {
    mWindPath = new Path();
    canvas.drawCircle(mCenterPoint.x,mCenterPoint.y,width/40,mWindmillPaint);
    mWindPath.moveTo(x1,y1);
    x2 = mCenterPoint.x + (float) (r1 * Math.cos(rad1 + angle));
    y2 = mCenterPoint.y + (float) (r1 * Math.sin(rad1 + angle));
    x3 = mCenterPoint.x + (float) (r2 * Math.cos(rad2 + angle));
    y3 = mCenterPoint.y + (float) (r2 * Math.sin(rad2 + angle));
    x4 = mCenterPoint.x + (float) (r3 * Math.cos(rad3 + angle));
    y4 = mCenterPoint.y + (float) (r3 * Math.sin(rad3 + angle));
    x5 = mCenterPoint.x + (float) (r4 * Math.cos(rad4 + angle));
    y5 = mCenterPoint.y + (float) (r4 * Math.sin(rad4 + angle));


    mWindPath.cubicTo(x2,y2,x3,y3,x4,y4);
    mWindPath.quadTo(x5,y5,x1,y1);
    mWindPath.close();
    canvas.drawPath(mWindPath,mWindmillPaint);
    canvas.rotate(120,mCenterPoint.x,mCenterPoint.y);
    canvas.drawPath(mWindPath,mWindmillPaint);
    canvas.rotate(120,mCenterPoint.x,mCenterPoint.y);
    canvas.drawPath(mWindPath,mWindmillPaint);
    canvas.rotate(120,mCenterPoint.x,mCenterPoint.y);
}
 
开发者ID:YugengWang,项目名称:OneWeather,代码行数:25,代码来源:Windmill.java

示例2: onSizeChanged

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    super.onSizeChanged(w, h, oldw, oldh);
    path = new Path();
    float halfWidth = (float) w / 2f;
    float firstParam = (float) w * 0.1f;
    float secondParam = (float) w * 0.8875f;

    //Bézier Curves
    path.moveTo(halfWidth, (float) w);
    path.cubicTo(firstParam, (float) w, 0, secondParam, 0, halfWidth);
    path.cubicTo(0, firstParam, firstParam, 0, halfWidth, 0);
    path.cubicTo(secondParam, 0, (float) w, firstParam, (float) w, halfWidth);
    path.cubicTo((float) w, secondParam, secondParam, (float) w, halfWidth, (float) w);
    path.close();
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:17,代码来源:ShapeImageView.java

示例3: drawArea

import android.graphics.Path; //导入方法依赖的package包/类
private void drawArea(Canvas canvas) {
    Path path = new Path();
    //原理就是用path根据各方向值创建一个封闭的区域,然后填充
    for (int i = 0; i < eageCount; i++) {
        float rate = pointValue.get(i);
        float currentX = maxPointXList.get(i) * rate;
        float currentY = maxPointYList.get(i) * rate;
        if (i == 0) {
            path.moveTo(currentX, currentY);
        } else {
            path.lineTo(currentX, currentY);
        }
    }
    path.close();
    canvas.drawPath(path, areaPaint);
}
 
开发者ID:TotoroXkf,项目名称:MyPolygonView,代码行数:17,代码来源:PolygonView.java

示例4: 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

示例5: 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

示例6: testPathClose

import android.graphics.Path; //导入方法依赖的package包/类
private void testPathClose(Canvas canvas) {
    Path path = new Path();
    canvas.translate(mWidth / 2, mHeight / 2);

    path.lineTo(200, 200);
    path.lineTo(0, 200);
    path.close();
    canvas.drawPath(path, paint);
}
 
开发者ID:lixiaodaoaaa,项目名称:ColumnAnimViewProject,代码行数:10,代码来源:CanvasTestView.java

示例7: drawRoundRectPlain

import android.graphics.Path; //导入方法依赖的package包/类
public void drawRoundRectPlain(float left, float top, float right, float bottom, float rx, float ry, Paint paint, Canvas canvas) {
    Path path = new Path();
    if (rx < 0) {
        rx = 0;
    }
    if (ry < 0) {
        ry = 0;
    }
    float width = right - left;
    float height = bottom - top;
    if (rx > width / 2) {
        rx = width / 2;
    }
    if (ry > height / 2) {
        ry = height / 2;
    }
    float widthMinusCorners = (width - (2 * rx));
    float heightMinusCorners = (height - (2 * ry));

    path.moveTo(right, top + ry);
    path.rQuadTo(0, -ry, -rx, -ry);//top-right corner
    path.rLineTo(-widthMinusCorners, 0);
    path.rQuadTo(-rx, 0, -rx, ry); //top-left corner
    path.rLineTo(0, heightMinusCorners);
    path.rQuadTo(0, ry, rx, ry);//bottom-left corner
    path.rLineTo(widthMinusCorners, 0);
    path.rQuadTo(rx, 0, rx, -ry); //bottom-right corner
    path.rLineTo(0, -heightMinusCorners);

    path.close();//Given close, last lineto can be removed.

    canvas.drawPath(path, paint);
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:34,代码来源:UDCanvas.java

示例8: create

import android.graphics.Path; //导入方法依赖的package包/类
public static TriangleShape create(float width, float height, boolean isPointingUp) {
    Path triangularPath = new Path();
    if (isPointingUp) {
        triangularPath.moveTo(0, height);
        triangularPath.lineTo(width, height);
        triangularPath.lineTo(width / 2, 0);
        triangularPath.close();
    } else {
        triangularPath.moveTo(0, 0);
        triangularPath.lineTo(width / 2, height);
        triangularPath.lineTo(width, 0);
        triangularPath.close();
    }
    return new TriangleShape(triangularPath, width, height);
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:16,代码来源:TriangleShape.java

示例9: setUpLeftPath

import android.graphics.Path; //导入方法依赖的package包/类
private void setUpLeftPath(RectF rect, Path path) {
    path.moveTo(mArrowWidth + rect.left + mAngle, rect.top);
    path.lineTo(rect.width() - mAngle, rect.top);
    path.arcTo(new RectF(rect.right - mAngle, rect.top, rect.right, mAngle + rect.top), 270, 90);
    path.lineTo(rect.right, rect.bottom - mAngle);
    path.arcTo(new RectF(rect.right - mAngle, rect.bottom - mAngle, rect.right, rect.bottom), 0, 90);
    path.lineTo(rect.left + mArrowWidth + mAngle, rect.bottom);
    path.arcTo(new RectF(rect.left + mArrowWidth, rect.bottom - mAngle, mAngle + rect.left + mArrowWidth, rect.bottom), 90, 90);
    path.lineTo(rect.left + mArrowWidth, mArrowHeight + mArrowPosition);
    path.lineTo(rect.left, mArrowPosition + mArrowHeight / 2);
    path.lineTo(rect.left + mArrowWidth, mArrowPosition);
    path.lineTo(rect.left + mArrowWidth, rect.top + mAngle);
    path.arcTo(new RectF(rect.left + mArrowWidth, rect.top, mAngle + rect.left + mArrowWidth, mAngle + rect.top), 180, 90);
    path.close();
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:16,代码来源:BubbleDrawable.java

示例10: drawRightUp

import android.graphics.Path; //导入方法依赖的package包/类
private void drawRightUp(Canvas canvas) {
        Path path = new Path();
        path.moveTo(getWidth(), roundHeight);
        path.lineTo(getWidth(), 0);
        path.lineTo(getWidth() - roundWidth, 0);
        path.arcTo(new RectF(
                        getWidth() - roundWidth * 2,
                        0,
                        getWidth(),
                        0 + roundHeight * 2),
                -90,
                90);
        path.close();
        canvas.drawPath(path, paint);
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:16,代码来源:RoundAngleImageView.java

示例11: draw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void draw(Canvas canvas, Paint paint) {
    Path path=new Path();
    path.moveTo(getWidth()/5,getHeight()*4/5);
    path.lineTo(getWidth()*4/5, getHeight()*4/5);
    path.lineTo(getWidth()/2,getHeight()/5);
    path.close();
    canvas.drawPath(path, paint);
}
 
开发者ID:zhouphenix,项目名称:Multi-SwipeToRefreshLayout,代码行数:10,代码来源:TriangleSkewSpinIndicator.java

示例12: drawRightDown

import android.graphics.Path; //导入方法依赖的package包/类
private void drawRightDown(Canvas canvas) {
    Path path = new Path();
    path.moveTo(getWidth() - roundWidth, getHeight());
    path.lineTo(getWidth(), getHeight());
    path.lineTo(getWidth(), getHeight() - roundHeight);
    path.arcTo(new RectF(getWidth() - roundWidth * 2, getHeight() - roundHeight * 2, getWidth(), getHeight()), -0, 90);
    path.close();
    canvas.drawPath(path, paint);
}
 
开发者ID:yingLanNull,项目名称:ShadowImageView,代码行数:10,代码来源:RoundImageView.java

示例13: drawTrapezoid

import android.graphics.Path; //导入方法依赖的package包/类
/**
     * Draws the trapezoid background for the horizontal tabs on a canvas object using
     * the specified color.
     *
     * @param canvas the canvas to draw upon
     * @param color  the color to use to draw the tab
     */
    public static void drawTrapezoid(@NonNull Canvas canvas, int color, boolean withShader) {

        Paint paint = new Paint();
        paint.setColor(color);
        paint.setStyle(Paint.Style.FILL);
//        paint.setFilterBitmap(true);
        paint.setAntiAlias(true);
        paint.setDither(true);
        if (withShader) {
            paint.setShader(new LinearGradient(0, 0.9f * canvas.getHeight(),
                0, canvas.getHeight(),
                color, mixTwoColors(Color.BLACK, color, 0.5f),
                Shader.TileMode.CLAMP));
        } else {
            paint.setShader(null);
        }
        int width = canvas.getWidth();
        int height = canvas.getHeight();
        double radians = Math.PI / 3;
        int base = (int) (height / Math.tan(radians));

        Path wallpath = new Path();
        wallpath.reset();
        wallpath.moveTo(0, height);
        wallpath.lineTo(width, height);
        wallpath.lineTo(width - base, 0);
        wallpath.lineTo(base, 0);
        wallpath.close();

        canvas.drawPath(wallpath, paint);
    }
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:39,代码来源:Utils.java

示例14: drawFire

import android.graphics.Path; //导入方法依赖的package包/类
private void drawFire(Canvas canvas) {
    canvas.drawColor(Color.BLACK);
    if (mFirePices.size() < 10) {
        if (mFirePices.size() == 0 || mFirePices.size() > 0 && mFirePices.get(mFirePices.size() - 1).i > fireWidth / 4) {
            isLeft = !isLeft;
            mFirePices.add(new FirePice(isLeft));
        }
    } else {
        mFirePices.remove(0);
    }
    Observable.from(mFirePices).subscribe(mFirePice -> mFirePice.draw(canvas));
    fireHeight = fireHeight - fireWidth / 6;
    Path mpath1 = new Path();
    mpath1.moveTo(halfWidth - fireWidth * 3 / 4, fireHeight - 2 * distance);
    mpath1.lineTo(halfWidth + distance - fireWidth * 3 / 4, fireHeight - 4 * distance);
    mpath1.lineTo(halfWidth + fireWidth * 3 / 4 + distance, fireHeight);
    mpath1.lineTo(halfWidth + fireWidth * 3 / 4, fireHeight + 2 * distance);
    mpath1.close();
    canvas.drawPath(mpath1, mPaint);
    Path mpath2 = new Path();
    mpath2.moveTo(halfWidth - fireWidth * 3 / 4, fireHeight);
    mpath2.lineTo(halfWidth + distance - fireWidth * 3 / 4, fireHeight + 2 * distance);
    mpath2.lineTo(halfWidth + fireWidth * 3 / 4 + distance, fireHeight - 2 * distance);
    mpath2.lineTo(halfWidth + fireWidth * 3 / 4, fireHeight - 4 * distance);
    mpath2.close();
    canvas.drawPath(mpath2, mPaint);
    fireHeight = fireHeight + fireWidth / 6;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:FireView.java

示例15: updateRotationDependant

import android.graphics.Path; //导入方法依赖的package包/类
protected void updateRotationDependant(){
    A.set(mCenter.x + (mRadius-mPadding) * (float) Math.cos(Math.toRadians(mRotation - 90)),
            mCenter.y + (mRadius-mPadding) * (float) Math.sin(Math.toRadians(mRotation - 90)));
    B.set(mCenter.x + (mRadius-mPadding) * (float) Math.cos(Math.toRadians(mRotation + 30)),
            mCenter.y + (mRadius-mPadding) * (float) Math.sin(Math.toRadians(mRotation + 30)));
    C.set(mCenter.x + (mRadius-mPadding) * (float) Math.cos(Math.toRadians(mRotation + 150)),
            mCenter.y + (mRadius-mPadding) * (float) Math.sin(Math.toRadians(mRotation + 150)));

    path = new Path();
    path.moveTo(A.x, A.y);
    path.lineTo(B.x, B.y);
    path.lineTo(C.x, C.y);
    path.close();

}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:16,代码来源:ColorWheelView.java


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