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


Java Path.rQuadTo方法代碼示例

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


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

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

示例2: createRoundedRectPathPreApi21

import android.graphics.Path; //導入方法依賴的package包/類
private Path createRoundedRectPathPreApi21(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.rQuadTo(0, -ry, -rx, -ry);
	path.rLineTo(-widthMinusCorners, 0);
	path.rQuadTo(-rx, 0, -rx, ry);
	path.rLineTo(0, heightMinusCorners);
	if (conformToOriginalPost) {
		path.rLineTo(0, ry);
		path.rLineTo(width, 0);
		path.rLineTo(0, -ry);
	} else {
		path.rQuadTo(0, ry, rx, ry);
		path.rLineTo(widthMinusCorners, 0);
		path.rQuadTo(rx, 0, rx, -ry);
	}
	path.rLineTo(0, -heightMinusCorners);
	path.close();
	return path;
}
 
開發者ID:rosenpin,項目名稱:QuickDrawEverywhere,代碼行數:30,代碼來源:TapBarMenu.java

示例3: createRoundedRectPathPreApi21

import android.graphics.Path; //導入方法依賴的package包/類
private Path createRoundedRectPathPreApi21(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.rQuadTo(0, -ry, -rx, -ry);
  path.rLineTo(-widthMinusCorners, 0);
  path.rQuadTo(-rx, 0, -rx, ry);
  path.rLineTo(0, heightMinusCorners);
  if (conformToOriginalPost) {
    path.rLineTo(0, ry);
    path.rLineTo(width, 0);
    path.rLineTo(0, -ry);
  } else {
    path.rQuadTo(0, ry, rx, ry);
    path.rLineTo(widthMinusCorners, 0);
    path.rQuadTo(rx, 0, rx, -ry);
  }
  path.rLineTo(0, -heightMinusCorners);
  path.close();
  return path;
}
 
開發者ID:zongkaili,項目名稱:MenuSet,代碼行數:29,代碼來源:TapBarMenu.java


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