本文整理匯總了Java中android.graphics.PathMeasure.nextContour方法的典型用法代碼示例。如果您正苦於以下問題:Java PathMeasure.nextContour方法的具體用法?Java PathMeasure.nextContour怎麽用?Java PathMeasure.nextContour使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.PathMeasure
的用法示例。
在下文中一共展示了PathMeasure.nextContour方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildPathData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void buildPathData() {
SvgPathParser parser = getPathParser();
pathData = new PathData();
try {
pathData.path = parser.parsePath(svgPath);
} catch (ParseException e) {
pathData.path = new Path();
}
PathMeasure pm = new PathMeasure(pathData.path, true);
while (true) {
pathData.length = Math.max(pathData.length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
}
示例2: buildPathData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void buildPathData() {
SvgPathParser parser = getPathParser();
pathData = new PathData();
try {
pathData.path = parser.parsePath(svgPath);
} catch (ParseException e) {
pathData.path = new Path();
}
PathMeasure pm = new PathMeasure(pathData.path, true);
while (true) {
pathData.length = Math.max(pathData.length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
}
示例3: rebuildGlyphData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
/**
* If you set the SVG data paths more than once using {@link #setGlyphStrings(String...)} you should call this method
* before playing the animation.
*/
@SuppressWarnings("SuspiciousNameCombination")
public void rebuildGlyphData() {
float X = mWidth / mViewport.x;
float Y = mHeight / mViewport.y;
Matrix scaleMatrix = new Matrix();
RectF outerRect = new RectF(X, X, Y, Y);
scaleMatrix.setScale(X, Y, outerRect.centerX(), outerRect.centerY());
mGlyphData = new GlyphData[mGlyphStrings.length];
for (int i = 0; i < mGlyphStrings.length; i++) {
mGlyphData[i] = new GlyphData();
try {
mGlyphData[i].path = WoWoPathParser.createPathFromPathData(mGlyphStrings[i]);
mGlyphData[i].path.transform(scaleMatrix);
} catch (Exception e) {
mGlyphData[i].path = new Path();
Log.e(TAG, "Couldn't parse path", e);
}
PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
while (true) {
mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData[i].paint = new Paint();
mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
mGlyphData[i].paint.setAntiAlias(true);
mGlyphData[i].paint.setColor(Color.WHITE);
mGlyphData[i].paint.setStrokeWidth(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
}
}
示例4: rebuildGlyphData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void rebuildGlyphData() {
SvgPathParser parser = new SvgPathParser() {
@Override
protected float transformX(float x) {
return x * mWidth / VIEWPORT.x;
}
@Override
protected float transformY(float y) {
return y * mHeight / VIEWPORT.y;
}
};
mGlyphData = new GlyphData[SVGPathData.GLYPHS.length];
for (int i = 0; i < SVGPathData.GLYPHS.length; i++) {
mGlyphData[i] = new GlyphData();
try {
mGlyphData[i].path = parser.parsePath(SVGPathData.GLYPHS[i]);
} catch (ParseException e) {
mGlyphData[i].path = new Path();
}
PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
while (true) {
mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData[i].paint = new Paint();
mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
mGlyphData[i].paint.setAntiAlias(true);
mGlyphData[i].paint.setColor(Color.WHITE);
mGlyphData[i].paint.setStrokeWidth(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
}
}
示例5: rebuildGlyphData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
/**
* If you set the SVG data paths more than once using {@link #setGlyphStrings(String...)} you should call this method
* before playing the animation.
*/
@SuppressWarnings("SuspiciousNameCombination")
public void rebuildGlyphData() {
float X = mWidth / mViewport.x;
float Y = mHeight / mViewport.y;
Matrix scaleMatrix = new Matrix();
RectF outerRect = new RectF(X, X, Y, Y);
scaleMatrix.setScale(X, Y, outerRect.centerX(), outerRect.centerY());
mGlyphData = new GlyphData[mGlyphStrings.length];
for (int i = 0; i < mGlyphStrings.length; i++) {
mGlyphData[i] = new GlyphData();
try {
mGlyphData[i].path = PathParser.createPathFromPathData(mGlyphStrings[i]);
mGlyphData[i].path.transform(scaleMatrix);
} catch (Exception e) {
mGlyphData[i].path = new Path();
Log.e(TAG, "Couldn't parse path", e);
}
PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
while (true) {
mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData[i].paint = new Paint();
mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
mGlyphData[i].paint.setAntiAlias(true);
mGlyphData[i].paint.setColor(Color.WHITE);
mGlyphData[i].paint.setStrokeWidth(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
}
}
示例6: rebuildGlyphData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void rebuildGlyphData() {
SvgPathParser parser = new SvgPathParser() {
@Override
protected float transformX(float x) {
return x * mWidth / VIEWPORT.x;
}
@Override
protected float transformY(float y) {
return y * mHeight / VIEWPORT.y;
}
};
mGlyphData = new GlyphData[LogoPaths.GLYPHS.length];
for (int i = 0; i < LogoPaths.GLYPHS.length; i++) {
mGlyphData[i] = new GlyphData();
try {
mGlyphData[i].path = parser.parsePath(LogoPaths.GLYPHS[i]);
} catch (ParseException e) {
mGlyphData[i].path = new Path();
Log.e(TAG, "Couldn't parse path", e);
}
PathMeasure pm = new PathMeasure(mGlyphData[i].path, true);
while (true) {
mGlyphData[i].length = Math.max(mGlyphData[i].length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData[i].paint = new Paint();
mGlyphData[i].paint.setStyle(Paint.Style.STROKE);
mGlyphData[i].paint.setAntiAlias(true);
mGlyphData[i].paint.setColor(Color.WHITE);
mGlyphData[i].paint.setStrokeWidth(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
getResources().getDisplayMetrics()));
}
}
示例7: rebuildGlyphData
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void rebuildGlyphData() {
SvgPathParser parser = new SvgPathParser() {
@Override
protected float transformX(float x) {
return x * mWidth / VIEWPORT.width();
}
@Override
protected float transformY(float y) {
return y * mHeight / VIEWPORT.height();
}
};
mGlyphData = new GlyphData();
try {
mGlyphData.path = parser.parsePath(LogoPaths.GLYPHS[0]);
} catch (ParseException e) {
mGlyphData.path = new Path();
Log.e(TAG, "Couldn't parse path", e);
}
PathMeasure pm = new PathMeasure(mGlyphData.path, true);
while (true) {
mGlyphData.length = Math.max(mGlyphData.length, pm.getLength());
if (!pm.nextContour()) {
break;
}
}
mGlyphData.paint = new Paint();
mGlyphData.paint.setStyle(Paint.Style.STROKE);
mGlyphData.paint.setAntiAlias(true);
mGlyphData.paint.setColor(Color.WHITE);
mGlyphData.paint.setStrokeWidth(
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1,
getResources().getDisplayMetrics()));
}
示例8: testNextContour
import android.graphics.PathMeasure; //導入方法依賴的package包/類
private void testNextContour(Canvas canvas) {
Path path = new Path();
path.addRect(-100, -100, 100, 100, Path.Direction.CW); // 添加小矩形
path.addRect(-200, -200, 200, 200, Path.Direction.CW); // 添加大矩形
canvas.drawPath(path, mDeafultPaint); // 繪製 Path
PathMeasure measure = new PathMeasure(path, false); // 將Path與PathMeasure關聯
float len1 = measure.getLength(); // 獲得第一條路徑的長度
measure.nextContour(); // 跳轉到下一條路徑
float len2 = measure.getLength(); // 獲得第二條路徑的長度
Log.i("LEN", "len1=" + len1); // 輸出兩條路徑的長度
Log.i("LEN", "len2=" + len2);
}