Code example for Canvas

Methods: restore, save, scale, translate

    public void draw(Canvas canvas) {
        final float threshold = 1.0f / 256.0f; // contribution less than 1 LSB of RGB byte
        if (mAlpha <= threshold) // don't bother if it won't show up
        canvas.translate(mX, mY);
        canvas.scale(mScaleX, mScaleY);
        canvas.translate(-0.5f*getWidth(), -0.5f*getHeight());
        mDrawable.setAlpha((int) Math.round(mAlpha * 255f));
     * Starts all animations added since the last call to this function.  Used to synchronize 
     * animations. 
     * @param listener an optional listener to add to the animations. Typically used to know when 
     * to invalidate the surface these are being drawn to.