Code example for Picture

Methods: draw, getHeight, getWidth

0
    	Bitmap  b = Bitmap.createBitmap(width,height,Bitmap.Config.RGB_565); 
        Canvas canvas = new Canvas(b); 
 
        // May need to tweak these values to determine what is the 
        // best scale factor 
        int picWidth = picture.getWidth();
        int picHeight = picture.getHeight();
        float scaleFactorX = 1.0f;
        float scaleFactorY = 1.0f;
        if (picWidth > 0) {
            scaleFactorX = (float) width /
                    (float)picWidth;
        } else { 
            return null; 
        } 
 
        if (picWidth > picHeight)
        { 
            // If the device is in landscape and the page is shorter 
            // than the height of the view, stretch the thumbnail to fill the 
            // space. 
            scaleFactorY = (float) height /
                    (float)picHeight;
        } else { 
            // In the portrait case, this looks nice. 
            scaleFactorY = scaleFactorX;
        } 
 
        canvas.scale(scaleFactorX, scaleFactorY);
 
        picture.draw(canvas);
        return b;
    } 
}