List of usage examples for android.graphics Canvas CLIP_TO_LAYER_SAVE_FLAG
int CLIP_TO_LAYER_SAVE_FLAG
To view the source code for android.graphics Canvas CLIP_TO_LAYER_SAVE_FLAG.
Click Source Link
From source file:ezy.ui.view.ViewPagerIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int flags = Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG; int sc = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, flags); int wg = mItemWidth + mItemGap; int x = (getWidth() - mWidth) / 2; int y = (getHeight() - mItemHeight) / 2; mItemDrawable.setBounds(0, 0, mItemWidth, mItemHeight); mItemDrawableSelected.setBounds(0, 0, mItemWidth, mItemHeight); for (int i = 0; i < mItemCount; i++) { canvas.save();// ww w.ja va 2s. co m canvas.translate(x + i * wg, y); mItemDrawable.draw(canvas); canvas.restore(); } canvas.save(); canvas.translate(x + (mPosition + mPositionOffset) * wg, y); mItemDrawableSelected.draw(canvas); canvas.restore(); canvas.restoreToCount(sc); }
From source file:com.ceabie.EffectiveLib.EffectImageView.java
@Override protected void onDraw(Canvas canvas) { if (mEffectDrawable == null || mEffectDrawable.getOpacity() == PixelFormat.TRANSPARENT // ? || getDrawable() == null) {// w ww. j a v a2 s . c om super.onDraw(canvas); return; } if (mRectF == null) { mRectF = new RectF(); } mRectF.left = 0; mRectF.top = 0; mRectF.right = getMeasuredWidth(); mRectF.bottom = getMeasuredHeight(); int saveBottom = 0; // if (!mHardware) { saveBottom = canvas.saveLayer(mRectF, null, Canvas.CLIP_TO_LAYER_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); } super.onDraw(canvas); mPaint.setXfermode(mXfermodeDstIn); int saveCount = canvas.saveLayer(mRectF, mPaint, Canvas.CLIP_TO_LAYER_SAVE_FLAG); mPaint.setXfermode(null); mEffectDrawable.draw(canvas); canvas.restoreToCount(saveCount); if (!mHardware) { canvas.restoreToCount(saveBottom); } }
From source file:fr.francetv.zoom.share.loader.ZoomLoaderView.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); int sc = canvas.saveLayer(0, 0, mViewWidthPx, mViewHeightPx, null, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); int mAnimationInValue = (int) mAnimationIn.getAnimatedValue(); int mAnimationOutValue = mAnimationOut.isRunning() ? (int) mAnimationOut.getAnimatedValue() : 0; canvas.drawPaint(mBackgroundPaint);/*from w w w .j a v a 2s. c om*/ canvas.drawArc(mLeftCircleArc, LEFT_START_DEGRE - mAnimationOutValue, -mAnimationInValue + mAnimationOutValue, true, mAnimPaint); canvas.drawArc(mRightCircleArc, RIGHT_START_DEGRE - mAnimationOutValue, -mAnimationInValue + mAnimationOutValue, true, mAnimPaint); canvas.drawBitmap(mMaskBitmap, 0, 0, mMaskPaint); canvas.restoreToCount(sc); }
From source file:com.gj.administrator.gjerp.view.CircleIndicator.java
@Override protected void onDraw(Canvas canvas) { Log.e("CircleIndicator", "onDraw()"); super.onDraw(canvas); int sc = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.MATRIX_SAVE_FLAG | Canvas.CLIP_SAVE_FLAG | Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.FULL_COLOR_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG); for (ShapeHolder item : tabItems) { canvas.save();//from w w w . j a va2 s . c om canvas.translate(item.getX(), item.getY()); item.getShape().draw(canvas); canvas.restore(); } if (movingItem != null) { canvas.save(); canvas.translate(movingItem.getX(), movingItem.getY()); movingItem.getShape().draw(canvas); canvas.restore(); } canvas.restoreToCount(sc); }