當前位置: 首頁>>代碼示例>>Java>>正文


Java Path.arcTo方法代碼示例

本文整理匯總了Java中android.graphics.Path.arcTo方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.arcTo方法的具體用法?Java Path.arcTo怎麽用?Java Path.arcTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Path的用法示例。


在下文中一共展示了Path.arcTo方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setUpTopPath

import android.graphics.Path; //導入方法依賴的package包/類
private void setUpTopPath(RectF rect, Path path) {
    path.moveTo(rect.left + Math.min(mArrowPosition, mAngle), rect.top + mArrowHeight);
    path.lineTo(rect.left + mArrowPosition, rect.top + mArrowHeight);
    path.lineTo(rect.left + mArrowWidth / 2 + mArrowPosition, rect.top);
    path.lineTo(rect.left + mArrowWidth + mArrowPosition, rect.top + mArrowHeight);
    path.lineTo(rect.right - mAngle, rect.top + mArrowHeight);

    path.arcTo(new RectF(rect.right - mAngle, rect.top + mArrowHeight, rect.right, mAngle + rect.top + mArrowHeight), 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 + mAngle, rect.bottom);

    path.arcTo(new RectF(rect.left, rect.bottom - mAngle, mAngle + rect.left, rect.bottom), 90, 90);
    path.lineTo(rect.left, rect.top + mArrowHeight + mAngle);
    path.arcTo(new RectF(rect.left, rect.top + mArrowHeight, mAngle + rect.left, mAngle + rect.top + mArrowHeight), 180, 90);
    path.close();
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:19,代碼來源:BubbleDrawable.java

示例2: drawPath5

import android.graphics.Path; //導入方法依賴的package包/類
/**
 * @param canvas arcTo    addArc
 */
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void drawPath5(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.BLUE);
    paint.setStyle(Paint.Style.STROKE);
    paint.setAntiAlias(true);
    /**
     * 這個方法和 Canvas.drawArc() 比起來,少了一個參數 useCenter,而多了一個參數 forceMoveTo 。

     少了 useCenter ,
     是因為 arcTo() 隻用來畫弧形而不畫扇形,所以不再需要 useCenter 參數;
     而多出來的這個 forceMoveTo 參數的意思是,
     繪製是要「抬一下筆移動過去」,
     還是「直接拖著筆過去」,區別在於是否留下移動的痕跡。

     其實  addArc 意思是  arcTo(xx, xx, xx, xx, xx, xx, true); 的簡化版  將forceMoveTo 寫死為 true 就是 跳過去然後畫
     */

    Path path = new Path();
    path.lineTo(100, 100);
    path.arcTo(100, 100, 300, 300, -90, 90, true); // 強製移動到弧形起點(無痕跡)
    canvas.drawPath(path, paint);

}
 
開發者ID:songjiabin,項目名稱:MySelfDemo,代碼行數:28,代碼來源:MyView2.java

示例3: leftPath

import android.graphics.Path; //導入方法依賴的package包/類
public void leftPath(RectF rect, Path path) {
    path.moveTo(mAngle + mArrowWidth, rect.top);
    path.lineTo(rect.width(), rect.top);
    path.arcTo(new RectF(rect.right - mAngle * 2, rect.top, rect.right,
            mAngle * 2 + rect.top), 270, 90);
    path.lineTo(rect.right, rect.top);
    path.arcTo(new RectF(rect.right - mAngle * 2, rect.bottom - mAngle * 2,
            rect.right, rect.bottom), 0, 90);
    path.lineTo(rect.left + mArrowWidth, rect.bottom);
    path.arcTo(new RectF(rect.left + mArrowWidth, rect.bottom - mAngle * 2,
            mAngle * 2 + rect.left + mArrowWidth, rect.bottom), 90, 90);
    path.lineTo(rect.left + mArrowWidth, mArrowTop + mArrowHeight);
    path.lineTo(rect.left, mArrowTop - mArrowOffset);
    path.lineTo(rect.left + mArrowWidth, mArrowTop);
    path.lineTo(rect.left + mArrowWidth, rect.top);
    path.arcTo(new RectF(rect.left + mArrowWidth, rect.top, mAngle * 2
            + rect.left + mArrowWidth, mAngle * 2 + rect.top), 180, 90);

    path.close();
}
 
開發者ID:GitLqr,項目名稱:LQRWeChat,代碼行數:21,代碼來源:BubbleImageView.java

示例4: initTopRoundedPath

import android.graphics.Path; //導入方法依賴的package包/類
private void initTopRoundedPath(RectF rect, Path path, float strokeWidth) {
    path.moveTo(rect.left + Math.min(mArrowPosition, mCornersRadius) + strokeWidth, rect.top + mArrowHeight + strokeWidth);
    path.lineTo(rect.left + mArrowPosition + (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
    path.lineTo(rect.left + mArrowWidth / 2 + mArrowPosition, rect.top + strokeWidth + strokeWidth);
    path.lineTo(rect.left + mArrowWidth + mArrowPosition - (strokeWidth / 2), rect.top + mArrowHeight + strokeWidth);
    path.lineTo(rect.right - mCornersRadius - strokeWidth, rect.top + mArrowHeight + strokeWidth);

    path.arcTo(new RectF(rect.right - mCornersRadius,
            rect.top + mArrowHeight + strokeWidth, rect.right - strokeWidth, mCornersRadius + rect.top + mArrowHeight), 270, 90);
    path.lineTo(rect.right - strokeWidth, rect.bottom - mCornersRadius - strokeWidth);

    path.arcTo(new RectF(rect.right - mCornersRadius, rect.bottom - mCornersRadius,
            rect.right - strokeWidth, rect.bottom - strokeWidth), 0, 90);
    path.lineTo(rect.left + mCornersRadius + strokeWidth, rect.bottom - strokeWidth);

    path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius,
            mCornersRadius + rect.left, rect.bottom - strokeWidth), 90, 90);

    path.lineTo(rect.left + strokeWidth, rect.top + mArrowHeight + mCornersRadius + strokeWidth);

    path.arcTo(new RectF(rect.left + strokeWidth, rect.top + mArrowHeight + strokeWidth, mCornersRadius
            + rect.left, mCornersRadius + rect.top + mArrowHeight), 180, 90);

    path.close();
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:26,代碼來源:Bubble.java

示例5: initRightRoundedPath

import android.graphics.Path; //導入方法依賴的package包/類
private void initRightRoundedPath(RectF rect, Path path, float strokeWidth) {

        path.moveTo(rect.left + mCornersRadius + strokeWidth, rect.top + strokeWidth);
        path.lineTo(rect.width() - mCornersRadius - mArrowWidth - strokeWidth, rect.top + strokeWidth);
        path.arcTo(new RectF(rect.right - mCornersRadius - mArrowWidth,
                rect.top + strokeWidth, rect.right - mArrowWidth - strokeWidth, mCornersRadius + rect.top), 270, 90);

        path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + (strokeWidth / 2));
        path.lineTo(rect.right - strokeWidth - strokeWidth, mArrowPosition + mArrowHeight / 2);
        path.lineTo(rect.right - mArrowWidth - strokeWidth, mArrowPosition + mArrowHeight - (strokeWidth / 2));
        path.lineTo(rect.right - mArrowWidth - strokeWidth, rect.bottom - mCornersRadius - strokeWidth);

        path.arcTo(new RectF(rect.right - mCornersRadius - mArrowWidth, rect.bottom - mCornersRadius,
                rect.right - mArrowWidth - strokeWidth, rect.bottom - strokeWidth), 0, 90);
        path.lineTo(rect.left + mArrowWidth + strokeWidth, rect.bottom - strokeWidth);

        path.arcTo(new RectF(rect.left + strokeWidth, rect.bottom - mCornersRadius,
                mCornersRadius + rect.left, rect.bottom - strokeWidth), 90, 90);

        path.arcTo(new RectF(rect.left + strokeWidth, rect.top + strokeWidth, mCornersRadius
                + rect.left, mCornersRadius + rect.top), 180, 90);
        path.close();
    }
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:24,代碼來源:Bubble.java

示例6: initPaint

import android.graphics.Path; //導入方法依賴的package包/類
private void initPaint() {
    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setColor(background);
    paint.setStyle(Style.FILL);
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();
    path = new Path();
    path.moveTo(0, height);
    path.lineTo(0, 0);
    path.lineTo(width, 0);
    path.lineTo(width, height);
    path.lineTo(0, height);

    path.arcTo(new RectF(Margin, Margin, width - Margin, width - Margin), 180, -359, true);
    path.close();
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:18,代碼來源:OvalWindowLayout.java

示例7: rightPath

import android.graphics.Path; //導入方法依賴的package包/類
public void rightPath(RectF rect, Path path) {
    path.moveTo(mAngle, rect.top);
    path.lineTo(rect.width(), rect.top);
    path.arcTo(new RectF(rect.right - mAngle * 2 - mArrowWidth, rect.top,
            rect.right - mArrowWidth, mAngle * 2 + rect.top), 270, 90);
    path.lineTo(rect.right - mArrowWidth, mArrowTop);
    path.lineTo(rect.right, mArrowTop - mArrowOffset);
    path.lineTo(rect.right - mArrowWidth, mArrowTop + mArrowHeight);
    path.lineTo(rect.right - mArrowWidth, rect.height() - mAngle);
    path.arcTo(new RectF(rect.right - mAngle * 2 - mArrowWidth, rect.bottom
            - mAngle * 2, rect.right - mArrowWidth, rect.bottom), 0, 90);
    path.lineTo(rect.left, rect.bottom);
    path.arcTo(new RectF(rect.left, rect.bottom - mAngle * 2, mAngle * 2
            + rect.left, rect.bottom), 90, 90);
    path.lineTo(rect.left, rect.top);
    path.arcTo(new RectF(rect.left, rect.top, mAngle * 2 + rect.left,
            mAngle * 2 + rect.top), 180, 90);
    path.close();
}
 
開發者ID:starryxp,項目名稱:LQRWeChat-master,代碼行數:20,代碼來源:BubbleImageView.java

示例8: drawLiftUp

import android.graphics.Path; //導入方法依賴的package包/類
private void drawLiftUp(Canvas canvas) {
    Path path = new Path();
    path.moveTo(0, roundHeight);
    path.lineTo(0, 0);
    path.lineTo(roundWidth, 0);
    path.arcTo(new RectF(0, 0, roundWidth * 2, roundHeight * 2), -90, -90);
    path.close();
    canvas.drawPath(path, paint);
}
 
開發者ID:h4h13,項目名稱:RetroMusicPlayer,代碼行數:10,代碼來源:RoundImageView.java

示例9: createRoundedRectPathApi21

import android.graphics.Path; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Path createRoundedRectPathApi21(Path path, float left, float top, float right, float bottom, float rx, float ry, boolean
        conformToOriginalPost) {
  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.arcTo(right - 2 * rx, top, right, top + 2 * ry, 0, -90, false);
  path.rLineTo(-widthMinusCorners, 0);
  path.arcTo(left, top, left + 2 * rx, top + 2 * ry, 270, -90, false);
  path.rLineTo(0, heightMinusCorners);
  if (conformToOriginalPost) {
    path.rLineTo(0, ry);
    path.rLineTo(width, 0);
    path.rLineTo(0, -ry);
  } else {
    path.arcTo(left, bottom - 2 * ry, left + 2 * rx, bottom, 180, -90, false);
    path.rLineTo(widthMinusCorners, 0);
    path.arcTo(right - 2 * rx, bottom - 2 * ry, right, bottom, 90, -90, false);
  }
  path.rLineTo(0, -heightMinusCorners);
  path.close();
  return path;
}
 
開發者ID:zongkaili,項目名稱:MenuSet,代碼行數:30,代碼來源:TapBarMenu.java

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

示例11: createRoundedRectPathApi21

import android.graphics.Path; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Path createRoundedRectPathApi21(Path path, float left, float top, float right,
                                        float bottom, float rx, float ry, boolean
		                                        conformToOriginalPost) {
	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.arcTo(right - 2 * rx, top, right, top + 2 * ry, 0, -90, false);
	path.rLineTo(-widthMinusCorners, 0);
	path.arcTo(left, top, left + 2 * rx, top + 2 * ry, 270, -90, false);
	path.rLineTo(0, heightMinusCorners);
	if (conformToOriginalPost) {
		path.rLineTo(0, ry);
		path.rLineTo(width, 0);
		path.rLineTo(0, -ry);
	} else {
		path.arcTo(left, bottom - 2 * ry, left + 2 * rx, bottom, 180, -90, false);
		path.rLineTo(widthMinusCorners, 0);
		path.arcTo(right - 2 * rx, bottom - 2 * ry, right, bottom, 90, -90, false);
	}
	path.rLineTo(0, -heightMinusCorners);
	path.close();
	return path;
}
 
開發者ID:rosenpin,項目名稱:QuickDrawEverywhere,代碼行數:31,代碼來源:TapBarMenu.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:h4h13,項目名稱:RetroMusicPlayer,代碼行數:10,代碼來源:RoundImageView.java

示例13: demo

import android.graphics.Path; //導入方法依賴的package包/類
private void demo(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.RED);
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.STROKE);


    Path path = new Path();
    RectF rectFLeft = new RectF();
    RectF rectfRight = new RectF();


    // 矩形
    float x1 = (getWidth() - getHeight() / 2) / 2;
    float y1 = getHeight() / 4;
    float x2 = getWidth() / 2;
    float y2 = getHeight() / 2;
    rectFLeft.set(x1, y1, x2, y2);


    float xx1 = getWidth() / 2;
    float yy1 = getHeight() / 4;
    float xx2 = getWidth() - x1;
    float yy2 = getHeight() / 2;
    rectfRight.set(xx1, yy1, xx2, yy2);


    path.arcTo(rectFLeft, -225, 225, false);
    path.arcTo(rectfRight, -180, 225, false);
    path.lineTo(getWidth() / 2, getHeight() - y1);
    path.close();
    canvas.drawPath(path, paint);
}
 
開發者ID:songjiabin,項目名稱:MySelfDemo,代碼行數:34,代碼來源:Practice9DrawPathView.java

示例14: getOutline

import android.graphics.Path; //導入方法依賴的package包/類
private Path getOutline(float scale) {
    RectF outerBB = new RectF(-mOuter * scale, -mOuter * scale, mOuter * scale, mOuter * scale);
    RectF innerBB = new RectF(-mInner * scale, -mInner * scale, mInner * scale, mInner * scale);

    double gamma = (mInner + mOuter) * Math.sin(Math.toRadians(mGap / 2.0f));
    float alphaOuter = (float) Math.toDegrees(Math.asin( gamma / (mOuter * 2.0f)));
    float alphaInner = (float) Math.toDegrees(Math.asin( gamma / (mInner * 2.0f)));

    Path path = new Path();
    path.arcTo(outerBB, mStart + alphaOuter, mSweep - 2 * alphaOuter, true);
    path.arcTo(innerBB, mStart + mSweep - alphaInner, 2 * alphaInner - mSweep);
    path.close();

    return path;
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:16,代碼來源:PieItem.java

示例15: drawLiftDown

import android.graphics.Path; //導入方法依賴的package包/類
private void drawLiftDown(Canvas canvas) {
        Path path = new Path();
        path.moveTo(0, getHeight() - roundHeight);
        path.lineTo(0, getHeight());
        path.lineTo(roundWidth, getHeight());
        path.arcTo(new RectF(
                        0,
                        getHeight() - roundHeight * 2,
                        0 + roundWidth * 2,
                        getHeight()),
                90,
                90);
        path.close();
        canvas.drawPath(path, paint);
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:16,代碼來源:RoundAngleImageView.java


注:本文中的android.graphics.Path.arcTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。