spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * DynamicSprite functions and properties

ChangeCanvasSize

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


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.