本文整理汇总了Java中android.graphics.Canvas.clipRegion方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.clipRegion方法的具体用法?Java Canvas.clipRegion怎么用?Java Canvas.clipRegion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Canvas
的用法示例。
在下文中一共展示了Canvas.clipRegion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDraw
import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
if (mTiledCanvas != null) {
canvas.save(Canvas.MATRIX_SAVE_FLAG);
if (mPanX != 0 || mPanY != 0 || !mZoomMatrix.isIdentity()) {
canvas.translate(mPanX, mPanY);
canvas.concat(mZoomMatrix);
canvas.drawRect(-20000, -20000, 20000, 0, mWorkspacePaint);
canvas.drawRect(-20000, 0, 0, mTiledCanvas.getHeight(), mWorkspacePaint);
canvas.drawRect(mTiledCanvas.getWidth(), 0, 20000, mTiledCanvas.getHeight(), mWorkspacePaint);
canvas.drawRect(-20000, mTiledCanvas.getHeight(), 20000, 20000, mWorkspacePaint);
}
if (!mDirtyRegion.isEmpty()) {
canvas.clipRegion(mDirtyRegion);
mDirtyRegion.setEmpty();
}
// TODO: tune this threshold based on the device density
mBlitPaint.setFilterBitmap(getScale(mZoomMatrix) < 3f);
mTiledCanvas.drawTo(canvas, 0, 0, mBlitPaint, false); // @@ set to true for dirty tile updates
if (0 != (mDebugFlags & FLAG_DEBUG_STROKES)) {
drawStrokeDebugInfo(canvas);
}
canvas.restore();
if (0 != (mDebugFlags & FLAG_DEBUG_PRESSURE)) {
mPressureCooker.drawDebug(canvas);
}
}
}