本文整理匯總了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;
}