Interface IBitmap
A low level bitmap which can be manipulated.
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface IBitmap
Properties
| Improve this Doc View SourceHeight
Gets the height of the bitmap (in pixels).
Declaration
int Height { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The height. |
Width
Gets the width of the bitmap (in pixels).
Declaration
int Width { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The width. |
Methods
| Improve this Doc View SourceApplyArea(IAreaComponent)
Create a new bitmap with only the pixels which are in the specified area, and makes all of the rest transparent.
Declaration
IBitmap ApplyArea(IAreaComponent area)
Parameters
Type | Name | Description |
---|---|---|
IAreaComponent | area | Area. |
Returns
Type | Description |
---|---|
IBitmap | The new bitmap. |
Clear()
Clears the bitmap.
Declaration
void Clear()
CreateMask(IGameFactory, String, Boolean, Nullable<Color>, String, String)
Creates a mask from the bitmap.
Declaration
IMask CreateMask(IGameFactory factory, string path, bool transparentMeansMasked = false, Color? debugDrawColor = default(Color? ), string saveMaskToFile = null, string id = null)
Parameters
Type | Name | Description |
---|---|---|
IGameFactory | factory | The game factory. |
System.String | path | The path the bitmap was created from (will be used as the id for the debug mask image, if a debug draw color is given). |
System.Boolean | transparentMeansMasked | If set to |
System.Nullable<Color> | debugDrawColor | An optional debug draw color, this will make the mask be saved as an image with the specified color. |
System.String | saveMaskToFile | An optional file path to the save the mask (for debugging purposes). |
System.String | id | A unique id which will be given to the mask (null will use the path as the id). |
Returns
Type | Description |
---|---|
IMask | The mask. |
Crop(Rectangle)
Creates a new bitmap which is cropped to the given rectangle.
Declaration
IBitmap Crop(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | Rectangle. |
Returns
Type | Description |
---|---|
IBitmap | The new bitmap. |
GetPixel(Int32, Int32)
Gets the pixel color on the specified coordinates.
Declaration
Color GetPixel(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The x coordinate. |
System.Int32 | y | The y coordinate. |
Returns
Type | Description |
---|---|
Color | The pixel color. |
GetTextDraw()
Allows to draw text on the bitmap.
Declaration
IBitmapTextDraw GetTextDraw()
Returns
Type | Description |
---|---|
IBitmapTextDraw | The text draw. |
LoadTexture(Nullable<Int32>)
Uploads the bitmap to graphics memory, and optionally binds to a texture.
Declaration
void LoadTexture(int? textureToBind)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | textureToBind | Texture to bind. |
MakeTransparent(Color)
Replaces all pixels with the specified color to be transparent.
Declaration
void MakeTransparent(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
SaveToFile(String)
Saves the bitmap as an image to the specified file path.
Declaration
void SaveToFile(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path. |
SetPixel(Color, Int32, Int32)
Sets a pixel color on the specified coordinates.
Declaration
void SetPixel(Color color, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
System.Int32 | x | The x coordinate. |
System.Int32 | y | The y coordinate. |
SetPixels(Color, List<Point>)
Sets multiple pixels with the specified color.
Declaration
void SetPixels(Color color, List<Point> points)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
System.Collections.Generic.List<Point> | points | Points. |