本文整理匯總了Java中android.graphics.Region.Op類的典型用法代碼示例。如果您正苦於以下問題:Java Op類的具體用法?Java Op怎麽用?Java Op使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Op類屬於android.graphics.Region包,在下文中一共展示了Op類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawChild
import android.graphics.Region.Op; //導入依賴的package包/類
private void drawChild(Canvas canvas, View child, LayoutParams lp) {
mSrcCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
mDstCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
mSrcCanvas.save();
int childLeft = child.getLeft();
int childTop = child.getTop();
int childRight = child.getRight();
int childBottom = child.getBottom();
mSrcCanvas.clipRect(childLeft, childTop, childRight, childBottom, Op.REPLACE);
mSrcCanvas.translate(childLeft, childTop);
child.draw(mSrcCanvas);
mSrcCanvas.restore();
mXferPaint.setXfermode(null);
mXferPaint.setColor(Color.BLACK);
float sweepAngle = (lp.endAngle - lp.startAngle) % 361;
mDstCanvas.drawArc(mBounds, lp.startAngle, sweepAngle, true, mXferPaint);
mXferPaint.setXfermode(mXfer);
mDstCanvas.drawBitmap(mSrc, 0f, 0f, mXferPaint);
canvas.drawBitmap(mDst, 0f, 0f, null);
}
示例2: commitSelectionOval
import android.graphics.Region.Op; //導入依賴的package包/類
void commitSelectionOval(Rect rect, Op op)
{
ActionSelectionChange action = new ActionSelectionChange(image);
action.setOldRegion();
RectF rectF = new RectF(rect);
Path ovalPath = new Path();
ovalPath.addOval(rectF, CW);
Region ovalRegion = new Region();
ovalRegion.setPath(ovalPath, new Region(0, 0, imageRect.right, imageRect.bottom));
region.op(ovalRegion, op);
updatePath();
action.applyAction();
}
示例3: a
import android.graphics.Region.Op; //導入依賴的package包/類
private final boolean a(ghu paramghu, boolean paramBoolean, Canvas paramCanvas)
{
int j = 255;
if (getDrawingTime() >= paramghu.e + this.g) {
return false;
}
if (paramBoolean)
{
float f1 = 1.0F - (float)(getDrawingTime() - paramghu.e) / this.g;
j = efj.a(Math.round(255.0F * (f1 * f1)), 0, j);
}
this.d.setAlpha(j);
if (this.h != null)
{
this.h.setBounds(paramghu.a(0, 0));
this.h.draw(paramCanvas);
}
for (;;)
{
return true;
paramCanvas.clipRect(paramghu.a(0, 0), Region.Op.UNION);
paramCanvas.drawCircle(paramghu.a, paramghu.b, paramghu.c, this.d);
}
}
示例4: drawWithPadding
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draw this BubbleTextView into the given Canvas.
*
* @param destCanvas the canvas to draw on
* @param padding the horizontal and vertical padding to use when drawing
*/
private void drawWithPadding(Canvas destCanvas, int padding) {
final Rect clipRect = mTempRect;
getDrawingRect(clipRect);
// adjust the clip rect so that we don't include the text label
clipRect.bottom =
getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + getLayout().getLineTop(0);
// Draw the View into the bitmap.
// The translate of scrollX and scrollY is necessary when drawing TextViews, because
// they set scrollX and scrollY to large values to achieve centered text
destCanvas.save();
destCanvas.scale(getScaleX(), getScaleY(),
(getWidth() + padding) / 2, (getHeight() + padding) / 2);
destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
draw(destCanvas);
destCanvas.restore();
}
示例5: setBitmap
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Sets the bitmap to be used for the zoomed view.
*/
public void setBitmap(Bitmap bitmap) {
if (mZoomedBitmap != null) {
mZoomedBitmap.recycle();
mZoomedBitmap = null;
}
mZoomedBitmap = bitmap;
// Round the corners of the bitmap so it doesn't stick out around the overlay.
Canvas canvas = new Canvas(mZoomedBitmap);
Path path = new Path();
RectF canvasRect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight());
float overlayCornerRadius = getOverlayCornerRadius(getContext());
path.addRoundRect(canvasRect, overlayCornerRadius, overlayCornerRadius, Direction.CCW);
canvas.clipPath(path, Op.XOR);
Paint clearPaint = new Paint();
clearPaint.setXfermode(new PorterDuffXfermode(Mode.SRC));
clearPaint.setColor(Color.TRANSPARENT);
canvas.drawPaint(clearPaint);
}
示例6: drawDragView
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draw the View v into the given Canvas.
*
* @param v the view to draw
* @param destCanvas the canvas to draw on
* @param padding the horizontal and vertical padding to use when drawing
*/
private static void drawDragView(View v, Canvas destCanvas, int padding) {
final Rect clipRect = sTempRect;
v.getDrawingRect(clipRect);
destCanvas.save();
if (v instanceof TextView) {
Drawable d = ((TextView) v).getCompoundDrawables()[1];
Rect bounds = getDrawableBounds(d);
clipRect.set(0, 0, bounds.width() + padding, bounds.height() + padding);
destCanvas.translate(padding / 2 - bounds.left, padding / 2 - bounds.top);
d.draw(destCanvas);
} else {
destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
v.draw(destCanvas);
}
destCanvas.restore();
}
示例7: drawWithPadding
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draw this BubbleTextView into the given Canvas.
*
* @param destCanvas the canvas to draw on
* @param padding the horizontal and vertical padding to use when drawing
*/
private void drawWithPadding(Canvas destCanvas, int padding) {
final Rect clipRect = mTempRect;
getDrawingRect(clipRect);
// adjust the clip rect so that we don't include the text label
clipRect.bottom =
getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V + getLayout().getLineTop(0);
// Draw the View into the bitmap.
// The translate of scrollX and scrollY is necessary when drawing TextViews, because
// they set scrollX and scrollY to large values to achieve centered text
destCanvas.save();
destCanvas.translate(-getScrollX() + padding / 2, -getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
draw(destCanvas);
destCanvas.restore();
}
示例8: testTouch
import android.graphics.Region.Op; //導入依賴的package包/類
private boolean testTouch() {
mTouchRect.offset(mTouchX, mTouchY);
Iterator<Region> ir = mRegions.iterator();
mSelectedRegion = null;
boolean hit = false;
while (ir.hasNext()) {
Region original = ir.next();
Region region = new Region(original);
if (region.op(mTouchRect, Op.INTERSECT)) {
mSelectedRegion = original;
hit = true;
}
}
mTouchRect.offset(-mTouchX, -mTouchY);
return hit;
}
示例9: drawDragView
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draws the {@link #mView} into the given {@param destCanvas}.
*/
private void drawDragView(Canvas destCanvas) {
destCanvas.save();
if (mView instanceof TextView) {
Drawable d = Workspace.getTextViewIcon((TextView) mView);
Rect bounds = getDrawableBounds(d);
destCanvas.translate(blurSizeOutline / 2 - bounds.left,
blurSizeOutline / 2 - bounds.top);
d.draw(destCanvas);
} else {
final Rect clipRect = mTempRect;
mView.getDrawingRect(clipRect);
boolean textVisible = false;
if (mView instanceof FolderIcon) {
// For FolderIcons the text can bleed into the icon area, and so we need to
// hide the text completely (which can't be achieved by clipping).
if (((FolderIcon) mView).getTextVisible()) {
((FolderIcon) mView).setTextVisible(false);
textVisible = true;
}
}
destCanvas.translate(-mView.getScrollX() + blurSizeOutline / 2,
-mView.getScrollY() + blurSizeOutline / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
mView.draw(destCanvas);
// Restore text visibility of FolderIcon if necessary
if (textVisible) {
((FolderIcon) mView).setTextVisible(true);
}
}
destCanvas.restore();
}
示例10: drawDimmedLayer
import android.graphics.Region.Op; //導入依賴的package包/類
protected void drawDimmedLayer(@NonNull Canvas canvas) {
canvas.save();
if (this.mOvalDimmedLayer) {
canvas.clipPath(this.mCircularPath, Op.DIFFERENCE);
} else {
canvas.clipRect(this.mCropViewRect, Op.DIFFERENCE);
}
canvas.drawColor(this.mDimmedColor);
canvas.restore();
if (this.mOvalDimmedLayer) {
canvas.drawOval(this.mCropViewRect, this.mDimmedStrokePaint);
}
}
示例11: drawDragView
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draws the {@link #mView} into the given {@param destCanvas}.
*/
private void drawDragView(Canvas destCanvas) {
destCanvas.save();
if (mView instanceof TextView) {
Drawable d = Workspace.getTextViewIcon((TextView) mView);
Rect bounds = getDrawableBounds(d);
destCanvas.translate(DRAG_BITMAP_PADDING / 2 - bounds.left,
DRAG_BITMAP_PADDING / 2 - bounds.top);
d.draw(destCanvas);
} else {
final Rect clipRect = mTempRect;
mView.getDrawingRect(clipRect);
boolean textVisible = false;
if (mView instanceof FolderIcon) {
// For FolderIcons the text can bleed into the icon area, and so we need to
// hide the text completely (which can't be achieved by clipping).
if (((FolderIcon) mView).getTextVisible()) {
((FolderIcon) mView).setTextVisible(false);
textVisible = true;
}
}
destCanvas.translate(-mView.getScrollX() + DRAG_BITMAP_PADDING / 2,
-mView.getScrollY() + DRAG_BITMAP_PADDING / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
mView.draw(destCanvas);
// Restore text visibility of FolderIcon if necessary
if (textVisible) {
((FolderIcon) mView).setTextVisible(true);
}
}
destCanvas.restore();
}
示例12: drawDragView
import android.graphics.Region.Op; //導入依賴的package包/類
/**
* Draw the View v into the given Canvas.
*
* @param v the view to draw
* @param destCanvas the canvas to draw on
* @param padding the horizontal and vertical padding to use when drawing
*/
private static void drawDragView(View v, Canvas destCanvas, int padding) {
final Rect clipRect = sTempRect;
v.getDrawingRect(clipRect);
boolean textVisible = false;
destCanvas.save();
if (v instanceof TextView) {
Drawable d = getTextViewIcon((TextView) v);
Rect bounds = getDrawableBounds(d);
clipRect.set(0, 0, bounds.width() + padding, bounds.height() + padding);
destCanvas.translate(padding / 2 - bounds.left, padding / 2 - bounds.top);
d.draw(destCanvas);
} else {
if (v instanceof FolderIcon) {
// For FolderIcons the text can bleed into the icon area, and so we need to
// hide the text completely (which can't be achieved by clipping).
if (((FolderIcon) v).getTextVisible()) {
((FolderIcon) v).setTextVisible(false);
textVisible = true;
}
}
destCanvas.translate(-v.getScrollX() + padding / 2, -v.getScrollY() + padding / 2);
destCanvas.clipRect(clipRect, Op.REPLACE);
v.draw(destCanvas);
// Restore text visibility of FolderIcon if necessary
if (textVisible) {
((FolderIcon) v).setTextVisible(true);
}
}
destCanvas.restore();
}
示例13: commitSelectionRectangle
import android.graphics.Region.Op; //導入依賴的package包/類
void commitSelectionRectangle(Rect rect, Op op)
{
ActionSelectionChange action = new ActionSelectionChange(image);
action.setOldRegion();
region.op(rect, op);
updatePath();
action.applyAction();
}
示例14: drawChild
import android.graphics.Region.Op; //導入依賴的package包/類
private void drawChild(Canvas canvas, View child, LayoutParams lp) {
mSrcCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
mDstCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
mSrcCanvas.save();
int childLeft = child.getLeft();
int childTop = child.getTop();
int childRight = child.getRight();
int childBottom = child.getBottom();
mSrcCanvas.clipRect(childLeft, childTop, childRight, childBottom, Op.REPLACE);
mSrcCanvas.translate(childLeft, childTop);
child.draw(mSrcCanvas);
mSrcCanvas.restore();
mXferPaint.setXfermode(null);
mXferPaint.setColor(Color.BLACK);
float sweepAngle = (lp.endAngle - lp.startAngle) % 361;
mDstCanvas.drawArc(mBounds, lp.startAngle, sweepAngle, true, mXferPaint);
mXferPaint.setXfermode(mXfer);
mDstCanvas.drawBitmap(mSrc, 0f, 0f, mXferPaint);
canvas.drawBitmap(mDst, 0f, 0f, null);
}
示例15: dispatchDraw
import android.graphics.Region.Op; //導入依賴的package包/類
@Override
protected void dispatchDraw(Canvas canvas) {
if (showcaseX < 0 || showcaseY < 0 || isRedundant) {
super.dispatchDraw(canvas);
return;
}
boolean recalculatedCling = mShowcaseDrawer.calculateShowcaseRect(showcaseX, showcaseY);
boolean recalculateText = recalculatedCling || mAlteredText;
mAlteredText = false;
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB && !mHasNoTarget) {
Path path = new Path();
path.addCircle(showcaseX, showcaseY, showcaseRadius, Path.Direction.CW);
canvas.clipPath(path, Op.DIFFERENCE);
}
//Draw background color
canvas.drawColor(mBackgroundColor);
// Draw the showcase drawable
if (!mHasNoTarget) {
mShowcaseDrawer.drawShowcase(canvas, showcaseX, showcaseY, scaleMultiplier, showcaseRadius);
}
// Draw the text on the screen, recalculating its position if necessary
if (recalculateText) {
mTextDrawer.calculateTextPosition(canvas.getWidth(), canvas.getHeight(), this);
}
mTextDrawer.draw(canvas, recalculateText);
super.dispatchDraw(canvas);
}