當前位置: 首頁>>代碼示例>>Java>>正文


Java Op類代碼示例

本文整理匯總了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);
}
 
開發者ID:ehanoc,項目名稱:xwallet,代碼行數:30,代碼來源:CircleLayout.java

示例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();
}
 
開發者ID:karol-202,項目名稱:PaintPlusPlus,代碼行數:18,代碼來源:Selection.java

示例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);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:25,代碼來源:TouchVisualizationView.java

示例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();
}
 
開發者ID:Phonemetra,項目名稱:TurboLauncher,代碼行數:26,代碼來源:BubbleTextView.java

示例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);
}
 
開發者ID:mogoweb,項目名稱:365browser,代碼行數:23,代碼來源:PopupZoomer.java

示例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();
}
 
開發者ID:krajeswaran,項目名稱:LeanLauncher,代碼行數:26,代碼來源:Workspace.java

示例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();
}
 
開發者ID:pengqinping,項目名稱:androidProject,代碼行數:24,代碼來源:BubbleTextView.java

示例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;
}
 
開發者ID:imbryk,項目名稱:CustomViews,代碼行數:17,代碼來源:TextWithLinksContainer.java

示例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();
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:37,代碼來源:DragPreviewProvider.java

示例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);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:14,代碼來源:OverlayView.java

示例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();
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:37,代碼來源:DragPreviewProvider.java

示例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();
}
 
開發者ID:Mr-lin930819,項目名稱:SimplOS,代碼行數:41,代碼來源:Workspace.java

示例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();
}
 
開發者ID:karol-202,項目名稱:PaintPlusPlus,代碼行數:11,代碼來源:Selection.java

示例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);
}
 
開發者ID:AvijitGhosh82,項目名稱:Madad_SOS,代碼行數:30,代碼來源:CircleLayout.java

示例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);

}
 
開發者ID:RayBa82,項目名稱:DVBViewerController,代碼行數:35,代碼來源:ShowcaseView.java


注:本文中的android.graphics.Region.Op類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。