当前位置: 首页>>代码示例>>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;未经允许,请勿转载。