本文整理汇总了Java中android.graphics.Canvas.skew方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.skew方法的具体用法?Java Canvas.skew怎么用?Java Canvas.skew使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Canvas
的用法示例。
在下文中一共展示了Canvas.skew方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.translate(mWidth / 2, mHeight / 2);
canvas.drawCircle(0, 0, 400, mPaint);
canvas.drawCircle(0, 0, 380, mPaint);
canvas.skew(1, 0);
for (int i = 0; i <= 360; i += 10) {
canvas.drawLine(0, 380, 0, 400, mPaint);
canvas.rotate(10);
}
canvas.skew(-1, 0);
canvas.skew(-1, 0);
for (int i = 0; i <= 360; i += 10) {
canvas.drawLine(0, 380, 0, 400, mPaint);
canvas.rotate(10);
}
}
示例2: screwTest
import android.graphics.Canvas; //导入方法依赖的package包/类
private void screwTest(Canvas canvas) {
// 将坐标系原点移动到画布正中心
canvas.translate(mWidth / 2, mHeight / 2);
RectF rect = new RectF(-200, 0, 0, 200); // 矩形区域
paint.setColor(Color.BLACK); // 绘制黑色矩形
canvas.drawRect(rect, paint);
canvas.skew(1, 0); // 水平错切 <- 45度
paint.setColor(Color.BLUE); // 绘制蓝色矩形
canvas.drawRect(rect, paint);
}
示例3: invoke
import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
final Canvas canvas = getCanvas();
if (canvas != null) {
if (args.narg() >= 3) {
final float sx = DimenUtil.dpiToPx(LuaUtil.getFloat(args, 2));
final float sy = DimenUtil.dpiToPx(LuaUtil.getFloat(args, 3));
canvas.skew(sx, sy);
}
}
return UDCanvas.this;
}
示例4: draw
import android.graphics.Canvas; //导入方法依赖的package包/类
/**
* The skew effect is handled by changing the transform of the Canvas
* and then calling the usual superclass draw() method.
*/
@Override
public void draw(Canvas canvas) {
if (mSkewX != 0) {
canvas.translate(0, getHeight());
canvas.skew(mSkewX, 0);
canvas.translate(0, -getHeight());
}
super.draw(canvas);
}
示例5: draw
import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
public int draw(Canvas canvas) {
canvas.skew(sx, sy);
return NO_SAVE;
}