Bitmap eraseColor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Bitmap eraseColor method.

This code example shows how to use the following methods:eraseColor, getHeight, getWidth
 
	} 
 
	public static Bitmap drawViewToBitmap(View view, Bitmap bitmap) {
 
		bitmap.eraseColor(Color.TRANSPARENT);
 
		int bitmapWidth = bitmap.getWidth();
 
		int bitmapHeight = bitmap.getHeight();
 
		Canvas canvas = new Canvas(bitmap);
 
		int measureWidth = View.MeasureSpec.makeMeasureSpec(bitmapWidth,
				View.MeasureSpec.EXACTLY);
 
		int measuredHeight = View.MeasureSpec.makeMeasureSpec(bitmapHeight,
				View.MeasureSpec.EXACTLY);
 
		view.measure(measureWidth, measuredHeight);
7
CodeRank
This code example shows how to use the following methods:eraseColor
        mLineHeight = 0;
        Bitmap.Config config = mFullColor ?
                Bitmap.Config.ARGB_4444 : Bitmap.Config.ALPHA_8;
        mBitmap = Bitmap.createBitmap(mStrikeWidth, mStrikeHeight, config);
        mCanvas = new Canvas(mBitmap);
        mBitmap.eraseColor(0);
    } 
 
    /** 
     * Call to add a label 
     * 
     * @param gl 
     * @param text the text of the label 
     * @param textPaint the paint of the label 
     * @return the id of the label, used to measure and draw the label 
     */ 
    public int add(GL10 gl, String text, Paint textPaint) {
        return add(gl, null, text, textPaint);
    } 
 
5
CodeRank
This code example shows how to use the following methods:eraseColor
        mRecreateBitmap = true;
    } 
 
 
    public void clear() { 
        mBitmap.eraseColor(mBackgroundColor);
        unlock(); 
    } 
 
 
    private void unlock() { 
        mLocked = false;
    } 
 
    // XXX: Unused 
    // If we don't need to lock the whiteboard, then we should remove mLocked too 
//    public void lock() { 
//        mLocked = true; 
//    } 
 
5
CodeRank
This code example shows how to use the following methods:eraseColor
This code example shows how to use the following methods:eraseColor
			mCanvas = new Canvas(mRenderBitmap);
		} 
 
		if (mEntireRedrawNeeded) {
			mEntireRedrawNeeded = false;
			mRenderBitmap.eraseColor(android.graphics.Color.TRANSPARENT);
			Canvas c = new Canvas(mRenderBitmap);
			mSvgImage.paintImage(c, subtree, getWidth(), getHeight(),
					mController, mFill, mRotation);
		} 
 
		canvas.drawBitmap(mRenderBitmap, 0f, 0f, mDrawPaint);
	} 
 
	/** 
	 * This could be called from non-UI thread. 
	 */ 
	public void invalidateBitmap() { 
		mEntireRedrawNeeded = true;
		super.postInvalidate(); 
5
CodeRank
This code example shows how to use the following methods:eraseColor
	} 
 
	private void init(Context context) {
		setupPaint(context);
		bitmap = Bitmap.createBitmap(screenWidth, screenWidth, Bitmap.Config.ARGB_8888);
		bitmap.eraseColor(Color.argb(255, 255, 255, 255));
		mCanvas = new Canvas(bitmap);
		currPath = new Path();
	} 
 
	public DrawView(Context context, AttributeSet attributeSet) {
		super(context, attributeSet);
	} 
 
	private void setupPaint(Context context) {
		pen = new Paint();
		pen.setFlags(Paint.ANTI_ALIAS_FLAG | Paint.DITHER_FLAG | pen.getFlags());
		pen.setStyle(Paint.Style.STROKE);
		pen.setStrokeJoin(Paint.Join.ROUND);
		pen.setStrokeCap(Paint.Cap.ROUND);
4
CodeRank
This code example shows how to use the following methods:eraseColor
        mLineHeight = 0;
        Bitmap.Config config = mFullColor ?
                Bitmap.Config.ARGB_4444 : Bitmap.Config.ALPHA_8;
        mBitmap = Bitmap.createBitmap(mStrikeWidth, mStrikeHeight, config);
        mCanvas = new Canvas(mBitmap);
        mBitmap.eraseColor(0);
    } 
 
    /** 
     * Call to add a label 
     * 
     * @param gl 
     * @param text the text of the label 
     * @param textPaint the paint of the label 
     * @return the id of the label, used to measure and draw the label 
     */ 
    public int add(GL10 gl, String text, Paint textPaint) {
        return add(gl, null, text, textPaint);
    } 
 
4
CodeRank
This code example shows how to use the following methods:eraseColor
    this.drawMatrix = drawMatrix;
    clearDecorateCache(); 
  } 
  private void clearDecorateCache() { 
    final Bitmap cache = decoratedCache != null ? decoratedCache.get() : null;
    if (cache != null) { cache.eraseColor(0); }
    decoratedCacheActual = false;
 
  } 
  /** @return the haveFrame */ 
  boolean isHaveFrame() { return haveFrame; }
 
  @Override 
  protected void drawableStateChanged() { 
    super.drawableStateChanged(); 
    final ImageDecorator d = imageDecorator;
    if (d != null && d.dependsOnDrawableState()) {
      clearDecorateCache(); 
      invalidate();
    } 
4
CodeRank

Related Bitmap eraseColor Questions & Answers:

eraseColor Method Overview
Fills the bitmap's pixels with the specified Color.
See Code Examples for other Android Bitmap Methods: