DynamicSprite.ChangeCanvasSize(int width, int height, int x, int y);
Changes the sprite size to width x height, placing the current image
at offset (x, y) within the new canvas. Unlike the Resize
command, the current image is kept at its original size.
This function allows you to enlarge the sprite background in order to draw
more onto it than its current boundaries allow. It is effectively the
opposite of Crop. The additional surface area
will be transparent.
The width and height are specified in 320x200-resolution units.
Example:
DynamicSprite* sprite = DynamicSprite.CreateFromExistingSprite(10);
sprite.ChangeCanvasSize(sprite.Width + 10, sprite.Height, 5, 0);
DrawingSurface *surface = sprite.GetDrawingSurface();
surface.DrawingColor = 14;
surface.DrawLine(0, 0, 5, surface.Height);
surface.Release();
sprite.Delete();
creates a dynamic sprite as a copy of sprite 10, enlarges it by 5 pixels to the
left and right, and draws a line in the new area to the left.
See Also: DynamicSprite.Crop,
DynamicSprite.Resize,
DynamicSprite.Height,
DynamicSprite.Width
|