Class Image : draw Method


void draw( Integer frame, DrawContext dc, Integer left, Integer top, [ Integer right ], [ Integer bottom ] )

Summary

Draw, or stretch, an image.


Remarks

If you don't specify the bottom/right then the image will be drawn using it's default size. By specifiying the bottom/right you can stretch or shrink the drawn image.

For most images frame will be 0.


Parameters

ParameterDescription
Integer frame The frame you want to draw
DrawContext dc The drawing canvas to draw onto
Integer left The upper-left position to begin drawing
Integer top The upper-left position to begin drawing
Integer right [optional] The lower-right position to stop drawing
Integer bottom [optional] The lower-right position to stop drawing


Examples

//
// adjust the size so it doesn't spill out, and also keep aspect ratio of the image
var rcLocal = new Rect( rc );
var divisor = image.getSize().cx / rcLocal.height();
rcLocal.setWidth( image.getSize().cy / divisor );
image.draw( 0, dc, rcLocal );


See Also

  • DrawContext


    Requirements

    build 1065