DynamicSprite.Crop(int x, int y, int width, int height);
Crops the sprite down to width x height, starting from (x,y) in the image.
The width and height are specified in 320x200-resolution units, as usual.
This allows you to trim the edges off a sprite, and perform related tasks. Only the area
with its top-left corner as (x,y) and of WIDTH x HEIGHT in size will remain.
Example:
DynamicSprite* sprite = DynamicSprite.CreateFromFile("CustomAvatar.bmp");
sprite.Crop(10, 10, sprite.Width - 10, sprite.Height - 10);
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(100, 100, sprite.Graphic);
surface.Release();
sprite.Delete();
will load the CustomAvatar.bmp image, cut off the left and top 10 pixels, and then
draw it onto the room background at (100,100).
See Also: DynamicSprite.ChangeCanvasSize,
DynamicSprite.Flip,
DynamicSprite.Height,
DynamicSprite.Width
|