本文整理汇总了Java中android.graphics.Path.computeBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Path.computeBounds方法的具体用法?Java Path.computeBounds怎么用?Java Path.computeBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Path
的用法示例。
在下文中一共展示了Path.computeBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doTextContainer
import android.graphics.Path; //导入方法依赖的package包/类
@Override
public boolean doTextContainer(TextContainer obj) {
if (obj instanceof SVG.TextPath) {
// Since we cheat a bit with our textPath rendering, we need
// to cheat a bit with our bbox calculation.
SVG.TextPath tpath = (SVG.TextPath) obj;
SVG.SvgObject ref = obj.document.resolveIRI(tpath.href);
if (ref == null) {
error("TextPath path reference '%s' not found", tpath.href);
return false;
}
SVG.Path pathObj = (SVG.Path) ref;
Path path = (new PathConverter(pathObj.d)).getPath();
if (pathObj.transform != null)
path.transform(pathObj.transform);
RectF pathBounds = new RectF();
path.computeBounds(pathBounds, true);
bbox.union(pathBounds);
return false;
}
return true;
}
示例2: getScaleMatrix
import android.graphics.Path; //导入方法依赖的package包/类
public Matrix getScaleMatrix(Path srcPath, float scaleX, float scaleY) {
Matrix scaleMatrix = new Matrix();
RectF rectF = new RectF();
srcPath.computeBounds(rectF, true);
scaleMatrix.setScale(scaleX, scaleY, rectF.left, rectF.top);
return scaleMatrix;
}
示例3: setPath
import android.graphics.Path; //导入方法依赖的package包/类
public PathShape setPath(final Path path) {
this.path = path;
path.computeBounds(pathBounds, false);
return this;
}
示例4: calculatePathBounds
import android.graphics.Path; //导入方法依赖的package包/类
private Box calculatePathBounds(Path path) {
RectF pathBounds = new RectF();
path.computeBounds(pathBounds, true);
return new Box(pathBounds.left, pathBounds.top, pathBounds.width(),
pathBounds.height());
}
示例5: run
import android.graphics.Path; //导入方法依赖的package包/类
@Override
public void run() {
InputStream inputStream = context.getResources().openRawResource(R.raw.taiwanhigh);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
Element rootElement = doc.getDocumentElement();
NodeList items = rootElement.getElementsByTagName("path");
for (int i = 0; i <items.getLength() ; i++) {
Element element = (Element) items.item(i);
String pathData = element.getAttribute("android:pathData");
Path path = PathParser.createPathFromPathData(pathData);
RectF rectF = new RectF();
path.computeBounds(rectF,true);
left = left == -1 ? rectF.left : Math.min(rectF.left,left);
top = top == -1 ? rectF.top : Math.min(rectF.top,top);
right = right == -1 ? rectF.right : Math.max(rectF.right,right);
bottom = bottom == -1 ? rectF.bottom : Math.max(rectF.bottom,bottom);
CountyItem countyItem = new CountyItem(path);
countyItems.add(countyItem);
}
topRectF = new RectF(left,top,right,bottom);
handler.sendEmptyMessage(1);
} catch (Exception e) {
e.printStackTrace();
}
}