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