Code example for Canvas

Methods: drawColor, scale, translate

0
		paint.setFilterBitmap(true);
		//paint.setDither(true); 
	} 
 
	protected void onDraw(final Canvas canvas) {
		canvas.drawColor(Color.TRANSPARENT);
		super.onDraw(canvas);
		long now = SystemClock.uptimeMillis();
 
		final float scale = Math.min((float)getWidth() / mMovie.width(), (float)getHeight() / mMovie.height());
 
		canvas.scale(scale, scale);
		canvas.translate(((float)getWidth() / scale - (float)mMovie.width())/2f,
				((float)getHeight() / scale - (float)mMovie.height())/2f);
 
 
		if(movieStart == 0) movieStart = (int)now;
 
		mMovie.setTime((int)((now - movieStart) % mMovie.duration()));
		mMovie.draw(canvas, 0, 0, paint);