Interface IGraphicsFactory
Factory to allow loading graphics (images/animations).
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IGraphicsFactory
Properties
| Improve this Doc View SourceBorders
Factory for creating borders.
Declaration
IBorderFactory Borders { get; }
Property Value
Type | Description |
---|---|
IBorderFactory | The borders. |
Brushes
Factory for creating brushes.
Declaration
IBrushLoader Brushes { get; }
Property Value
Type | Description |
---|---|
IBrushLoader | The brushes. |
Icons
Factory for creating icons.
Declaration
IIconFactory Icons { get; }
Property Value
Type | Description |
---|---|
IIconFactory | The icons. |
Methods
| Improve this Doc View SourceGetBitmap(Int32, Int32)
Creates an empty bitmap with the specified width and height (in pixels).
Declaration
IBitmap GetBitmap(int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | Width. |
System.Int32 | height | Height. |
Returns
Type | Description |
---|---|
IBitmap | The bitmap. |
GetSprite()
Creates a new sprite
Declaration
ISprite GetSprite()
Returns
Type | Description |
---|---|
ISprite | The sprite. |
LoadAnimationFromFiles(IAnimationConfiguration, ILoadImageConfig, String[])
Loads an animation from a list of resource/file paths (IResourceLoader). The order of the files/resources will decide the order of the animation.
Declaration
IAnimation LoadAnimationFromFiles(IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null, params string[] files)
Parameters
Type | Name | Description |
---|---|---|
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
System.String[] | files | A list of resource/file paths. |
Returns
Type | Description |
---|---|
IAnimation | The animation. |
LoadAnimationFromFilesAsync(IAnimationConfiguration, ILoadImageConfig, String[])
Loads an animation asynchronously from a list of resource/file paths (IResourceLoader). The order of the files/resources will decide the order of the animation.
Declaration
Task<IAnimation> LoadAnimationFromFilesAsync(IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null, params string[] files)
Parameters
Type | Name | Description |
---|---|---|
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
System.String[] | files | A list of resource/file paths. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IAnimation> | The animation. |
LoadAnimationFromFolder(String, IAnimationConfiguration, ILoadImageConfig)
Loads an animation from a resource/file folder (IResourceLoader). The files/resources will be loaded in an alphabetical order which will determine the order of the animation. So if you list your files in the folder, for example: walk1.png, walk2.png, walk3.png, the animation will be ordered accordingly.
Declaration
IAnimation LoadAnimationFromFolder(string folderPath, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | The resource/file folder path. |
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
Returns
Type | Description |
---|---|
IAnimation | The animation. |
LoadAnimationFromFolderAsync(String, IAnimationConfiguration, ILoadImageConfig)
Loads an animation asynchronously from a resource/file folder (IResourceLoader). The files/resources will be loaded in an alphabetical order which will determine the order of the animation. So if you list your files in the folder, for example: walk1.png, walk2.png, walk3.png, the animation will be ordered accordingly.
Declaration
Task<IAnimation> LoadAnimationFromFolderAsync(string folderPath, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | folderPath | The resource/file folder path. |
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IAnimation> | The animation. |
LoadAnimationFromSpriteSheet(ISpriteSheet, IAnimationConfiguration, ILoadImageConfig)
Loads an animation from a sprite sheet.
Declaration
IAnimation LoadAnimationFromSpriteSheet(ISpriteSheet spriteSheet, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
ISpriteSheet | spriteSheet | Sprite sheet. |
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
Returns
Type | Description |
---|---|
IAnimation | The animation. |
LoadAnimationFromSpriteSheetAsync(ISpriteSheet, IAnimationConfiguration, ILoadImageConfig)
Loads an animation asynchronously from a sprite sheet.
Declaration
Task<IAnimation> LoadAnimationFromSpriteSheetAsync(ISpriteSheet spriteSheet, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
ISpriteSheet | spriteSheet | Sprite sheet. |
IAnimationConfiguration | animationConfig | Animation configuration. |
ILoadImageConfig | loadConfig | Configuration for how to load the images. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IAnimation> | The animation. |
LoadBitmap(String)
Loads a raw bitmap from a resource/file path (IResourceLoader).
Declaration
IBitmap LoadBitmap(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | File/resource path. |
Returns
Type | Description |
---|---|
IBitmap | The bitmap. |
LoadBitmapAsync(String)
Loads a raw bitmap asynchronously from a resource/file path (IResourceLoader).
Declaration
Task<IBitmap> LoadBitmapAsync(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | File/resource path. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IBitmap> | The bitmap. |
LoadDirectionalAnimationFromFolders(String, String, String, String, String, IAnimationConfiguration, ILoadImageConfig)
Loads a directional animation from file/resource folders (IResourceLoader .
Declaration
IDirectionalAnimation LoadDirectionalAnimationFromFolders(string baseFolder, string leftFolder = null, string rightFolder = null, string downFolder = null, string upFolder = null, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseFolder | A base folder, from which all other folders will be relative to. |
System.String | leftFolder | Left animation folder (null to not have a left animation). |
System.String | rightFolder | Right animation folder (null to not have a right animation). |
System.String | downFolder | Down animation folder (null to not have a down animation). |
System.String | upFolder | Up animation folder (null to not have an up animation). |
IAnimationConfiguration | animationConfig | Animation configuration (will be applied to all directions). |
ILoadImageConfig | loadConfig | Configuration for loading the images (will be applied to all loaded images). |
Returns
Type | Description |
---|---|
IDirectionalAnimation | The directional animation. |
LoadDirectionalAnimationFromFoldersAsync(String, String, String, String, String, IAnimationConfiguration, ILoadImageConfig)
Loads a directional animation asynchronously from file/resource folders (IResourceLoader .
Declaration
Task<IDirectionalAnimation> LoadDirectionalAnimationFromFoldersAsync(string baseFolder, string leftFolder = null, string rightFolder = null, string downFolder = null, string upFolder = null, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | baseFolder | A base folder, from which all other folders will be relative to. |
System.String | leftFolder | Left animation folder (null to not have a left animation). |
System.String | rightFolder | Right animation folder (null to not have a right animation). |
System.String | downFolder | Down animation folder (null to not have a down animation). |
System.String | upFolder | Up animation folder (null to not have an up animation). |
IAnimationConfiguration | animationConfig | Animation configuration (will be applied to all directions). |
ILoadImageConfig | loadConfig | Configuration for loading the images (will be applied to all loaded images). |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IDirectionalAnimation> | The directional animation. |
LoadImage(IBitmap, ILoadImageConfig, String)
Loads an image from a bitmap.
Declaration
IImage LoadImage(IBitmap bitmap, ILoadImageConfig loadConfig = null, string id = null)
Parameters
Type | Name | Description |
---|---|---|
IBitmap | bitmap | The bitmap. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
System.String | id | An optional unique id for the image (if not given, the engine will generate one automatically). |
Returns
Type | Description |
---|---|
IImage | The image. |
LoadImage(String, ILoadImageConfig)
Loads an image from a resource/file path (IResourceLoader).
Declaration
IImage LoadImage(string filePath, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | File/resource path. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
Returns
Type | Description |
---|---|
IImage | The image. |
LoadImageAsync(String, ILoadImageConfig)
Loads an image asynchronously from a resource/file path (IResourceLoader).
Declaration
Task<IImage> LoadImageAsync(string filePath, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | File/resource path. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<IImage> | The image. |
LoadSprite(IBitmap, ILoadImageConfig, String)
Loads a sprite from a bitmap.
Declaration
ISprite LoadSprite(IBitmap bitmap, ILoadImageConfig loadConfig = null, string id = null)
Parameters
Type | Name | Description |
---|---|---|
IBitmap | bitmap | The bitmap. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
System.String | id | An optional unique id for the image (if not given, the engine will generate one automatically). |
Returns
Type | Description |
---|---|
ISprite | The image. |
LoadSprite(String, ILoadImageConfig)
Loads a sprite from a resource/file path (IResourceLoader).
Declaration
ISprite LoadSprite(string path, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | File/resource path. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
Returns
Type | Description |
---|---|
ISprite | The sprite. |
LoadSpriteAsync(String, ILoadImageConfig)
Loads a sprite asynchronously from a resource/file path (IResourceLoader).
Declaration
Task<ISprite> LoadSpriteAsync(string path, ILoadImageConfig loadConfig = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | File/resource path. |
ILoadImageConfig | loadConfig | Configuration on how to load the image. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ISprite> | The sprite. |