Code example for Rect

Methods: insetoffsetset

0
	@Override 
	protected void onBoundsChange( Rect bounds ) {
		super.onBoundsChange( bounds );
 
		mLeft = Math.abs( bounds.width() - srcRect.width() ) / 2;
		mTop = Math.abs( bounds.height() - srcRect.height() ) / 2;
 
		dstRect.set( srcRect );
		dstRect.inset( -mInset / 2, -mInset / 2 );
		dstRect.offset( (int) ( mLeft ), (int) ( mTop ) );
 
	} 
 
	/* 
	 * (non-Javadoc) 
	 *  
	 * @see android.graphics.drawable.Drawable#draw(android.graphics.Canvas) 
	 */ 
	@Override 
	public void draw( Canvas canvas ) {