Code example for Canvas

Methods: drawColor, setMatrix

0
			m1.invert( m1 );
			float[] v2 = getMatrixValues( m1 );
 
			mInvertedMatrix.postTranslate( -v1[Matrix.MTRANS_X], -v1[Matrix.MTRANS_Y] );
			mInvertedMatrix.postScale( v2[Matrix.MSCALE_X], v2[Matrix.MSCALE_Y] );
			mCanvas.setMatrix( mInvertedMatrix );
		} 
	} 
 
	/** 
	 * Gets the paint. 
	 *  
	 * @return the paint 
	 */ 
	public Paint getPaint() {
		return mPaint;
	} 
 
	/** 
	 * Sets the paint. 
	 *  
	 * @param paint 
	 *           the new paint 
	 */ 
	public void setPaint( Paint paint ) {
		mPaint.set( paint );
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see android.widget.ImageView#onDraw(android.graphics.Canvas) 
	 */ 
	@Override 
	protected void onDraw( Canvas canvas ) {
		super.onDraw( canvas );
 
		// canvas.drawPath( tmpPath, mPaint ); 
 
		if ( mCopy != null ) {
			final int saveCount = canvas.getSaveCount();
			canvas.save();
			canvas.drawBitmap( mCopy, getImageMatrix(), null );
			canvas.restoreToCount( saveCount );
		} 
	} 
 
	/** 
	 * Commit. 
	 *  
	 * @param canvas 
	 *           the canvas 
	 */ 
	public void commit( Canvas canvas ) {
		canvas.drawBitmap( ( (IBitmapDrawable) getDrawable() ).getBitmap(), new Matrix(), null );
		canvas.drawBitmap( mCopy, new Matrix(), null );
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see it.sephiroth.android.library.imagezoom.ImageViewTouch#onBitmapChanged(android.graphics.drawable.Drawable) 
	 */ 
	@Override 
	protected void onBitmapChanged( Drawable drawable ) {
		super.onBitmapChanged( drawable );
 
		if ( mCopy != null ) {
			mCopy.recycle();
			mCopy = null;
		} 
 
		if ( drawable != null && ( drawable instanceof IBitmapDrawable ) ) {
			final Bitmap bitmap = ( (IBitmapDrawable) drawable ).getBitmap();
			mCopy = Bitmap.createBitmap( bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888 );
			mCanvas = new Canvas( mCopy );
			mCanvas.drawColor( 0 );
			onDrawModeChanged(); 
		} 
	} 
 
	/**