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 );
 
			mCurrentScale = getScale();
 
			mPaint.setStrokeWidth( mBrushSize );
		} 
	} 
 
	/** 
	 * 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 );
	} 
 
	public RectF getImageRect() {
		if ( getDrawable() != null ) { 
			return new RectF( 0, 0, getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight() );
		} else { 
			return 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 ( drawable != null && ( drawable instanceof IBitmapDrawable ) ) {
			mCanvas = new Canvas();
			mCanvas.drawColor( 0 );
			onDrawModeChanged(); 
		} 
	} 
 
	/** The m moved. */