![]() |
Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
|
Represents a tilesheet image and metadata for rendering tiles. More...
Public Member Functions | |
| TilesheetRegion | AddRegion (string name, Rectangle area, Size tileSize, Spacing? tilePadding=null, Spacing? regionMargin=null, Spacing? overhangPixels=null, CollisionAdjust? collisionAdjust=null, TileCollisionType collisionType=TileCollisionType.None) |
| Adds a region with the supplied default collision adjustment and collision type. | |
| TilesheetRegion? | GetRegion (string name) |
| Finds a tilesheet region by its case-insensitive name. | |
| bool | RemoveRegion (string name, bool dispose=true) |
| Removes the named tilesheet region and optionally disposes it. | |
| Frame | GetFrame (string regionName, int x, int y) |
| Creates a frame reference at the specified tile coordinates. | |
| Frame | GetFrame (int x, int y) |
| Creates a frame reference at the specified tile coordinates. | |
| void | ApplyMask (SKColor? maskColor=null, byte tolerance=5) |
| Applies a color-key transparency mask and rebuilds the frame cache. | |
| void | ApplyPremultiplyAlpha () |
| Premultiplies the bitmap alpha and rebuilds the frame cache. | |
| byte[] | ToByteArray (SKEncodedImageFormat format=SKEncodedImageFormat.Png, int quality=100) |
| Encodes the tilesheet bitmap using the requested image format and quality. | |
| void | PersistImageToFile (string imageFilePath, SKEncodedImageFormat format=SKEncodedImageFormat.Png, int quality=100) |
| Persists this tilesheet's source image to a file and promotes the tilesheet from a runtime-only bitmap to a file-backed tilesheet. | |
| SKImage? | GetImage (string regionName, int x, int y) |
| Gets the cached image for the specified frame. | |
| SKBitmap? | GetBitmap (string regionName, int x, int y) |
| Gets the cached bitmap for the specified frame. | |
| Dictionary<(string regionName, int x, int y), SKBitmap > | GetAllBitmaps () |
| Collects the cached frame bitmaps indexed by their tile coordinates. | |
| Dictionary<(string regionName, int x, int y), SKImage > | GetAllImages () |
| Collects the cached frame images indexed by their tile coordinates. | |
| void | Dispose () |
| Releases the resources owned by this instance. | |
Properties | |
| SKBitmap | SkBitmap = null! [get] |
| Gets the current tilesheet bitmap used for rendering. | |
| SKBitmap? | SkBitmapOriginal [get] |
| Gets the source bitmap retained before masking or alpha conversion. | |
| string | Name = string.Empty [get, set] |
| Gets the name. | |
| List< TilesheetRegion > | Regions = new() [get] |
| Gets the named frame regions in the tilesheet. | |
| TilesheetRegion | DefaultRegion [get] |
| Gets the default tilesheet region. | |
| TypedValueBag | ValueBag = new() [get, set] |
| Gets or sets the custom typed values associated with this object. | |
| AssetsFileIdentifier? | AssetIdentifier [get] |
| Gets the packed asset from which the image was loaded, if any. | |
| string | ImageFilePath = string.Empty [get] |
| Gets the loose source image path, when available. | |
| SKColor? | MaskColor [get] |
| Gets the color used for transparency masking. | |
| byte | MaskTolerance = 5 [get] |
| Gets the per-channel tolerance used for transparency masking. | |
| bool | Premultiplied [get] |
| Gets whether alpha premultiplication has been applied. | |
| TilesheetRegion | this[string regionName] [get] |
| Gets the named tilesheet region. | |
| Frame | this[string regionName, int x, int y] [get] |
| Gets a frame reference at the specified tile coordinates. | |
| Frame | this[int x, int y] [get] |
| Gets a frame reference at the specified tile coordinates. | |
Events | |
| Action< Tilesheet >? | Disposed |
| Occurs after the object releases its resources. | |
Represents a tilesheet image and metadata for rendering tiles.
Definition at line 13 of file Tilesheet.cs.
| TilesheetRegion Gondwana.Drawing.Tilesheets.Tilesheet.AddRegion | ( | string | name, |
| Rectangle | area, | ||
| Size | tileSize, | ||
| Spacing? | tilePadding = null, | ||
| Spacing? | regionMargin = null, | ||
| Spacing? | overhangPixels = null, | ||
| CollisionAdjust? | collisionAdjust = null, | ||
| TileCollisionType | collisionType = TileCollisionType::None ) |
Adds a region with the supplied default collision adjustment and collision type.
| name | The name. |
| area | The area. |
| tileSize | The tile size. |
| tilePadding | The tile padding. |
| regionMargin | The region margin. |
| overhangPixels | The overhang pixels. |
| collisionAdjust | The adjustment applied to the frame's collision bounds. |
| collisionType | The collision type. |
Definition at line 210 of file Tilesheet.cs.
| void Gondwana.Drawing.Tilesheets.Tilesheet.ApplyMask | ( | SKColor? | maskColor = null, |
| byte | tolerance = 5 ) |
Applies a color-key transparency mask and rebuilds the frame cache.
| maskColor | The color to make transparent; null uses the default mask color. |
| tolerance | The tolerance. |
Definition at line 304 of file Tilesheet.cs.
| void Gondwana.Drawing.Tilesheets.Tilesheet.ApplyPremultiplyAlpha | ( | ) |
Premultiplies the bitmap alpha and rebuilds the frame cache.
Definition at line 346 of file Tilesheet.cs.
| void Gondwana.Drawing.Tilesheets.Tilesheet.Dispose | ( | ) |
Releases the resources owned by this instance.
Definition at line 554 of file Tilesheet.cs.
| Dictionary<(string regionName, int x, int y), SKBitmap > Gondwana.Drawing.Tilesheets.Tilesheet.GetAllBitmaps | ( | ) |
Collects the cached frame bitmaps indexed by their tile coordinates.
Definition at line 456 of file Tilesheet.cs.
| Dictionary<(string regionName, int x, int y), SKImage > Gondwana.Drawing.Tilesheets.Tilesheet.GetAllImages | ( | ) |
Collects the cached frame images indexed by their tile coordinates.
Definition at line 473 of file Tilesheet.cs.
| SKBitmap? Gondwana.Drawing.Tilesheets.Tilesheet.GetBitmap | ( | string | regionName, |
| int | x, | ||
| int | y ) |
Gets the cached bitmap for the specified frame.
| regionName | The name of the tilesheet region. |
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
null if the frame is unavailable. The tilesheet retains ownership.| Frame Gondwana.Drawing.Tilesheets.Tilesheet.GetFrame | ( | int | x, |
| int | y ) |
Creates a frame reference at the specified tile coordinates.
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
| Frame Gondwana.Drawing.Tilesheets.Tilesheet.GetFrame | ( | string | regionName, |
| int | x, | ||
| int | y ) |
Creates a frame reference at the specified tile coordinates.
| regionName | The name of the tilesheet region. |
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
| SKImage? Gondwana.Drawing.Tilesheets.Tilesheet.GetImage | ( | string | regionName, |
| int | x, | ||
| int | y ) |
Gets the cached image for the specified frame.
| regionName | The name of the tilesheet region. |
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
null if the frame is unavailable. The tilesheet retains ownership.| TilesheetRegion? Gondwana.Drawing.Tilesheets.Tilesheet.GetRegion | ( | string | name | ) |
Finds a tilesheet region by its case-insensitive name.
| name | The name. |
null if no region matches.Definition at line 246 of file Tilesheet.cs.
| void Gondwana.Drawing.Tilesheets.Tilesheet.PersistImageToFile | ( | string | imageFilePath, |
| SKEncodedImageFormat | format = SKEncodedImageFormat::Png, | ||
| int | quality = 100 ) |
Persists this tilesheet's source image to a file and promotes the tilesheet from a runtime-only bitmap to a file-backed tilesheet.
| imageFilePath | The destination image file path. |
| format | The encoded image format. |
| quality | The encoding quality from 0 through 100. |
When masking or alpha premultiplication has transformed the runtime bitmap, the original source bitmap is persisted. The corresponding GTS metadata will reapply that transformation when the tilesheet is loaded.
Definition at line 390 of file Tilesheet.cs.
| bool Gondwana.Drawing.Tilesheets.Tilesheet.RemoveRegion | ( | string | name, |
| bool | dispose = true ) |
Removes the named tilesheet region and optionally disposes it.
| name | The name. |
| dispose | Whether to dispose the removed resource. |
true if the region was found and removed; otherwise, false.Definition at line 266 of file Tilesheet.cs.
| byte[] Gondwana.Drawing.Tilesheets.Tilesheet.ToByteArray | ( | SKEncodedImageFormat | format = SKEncodedImageFormat::Png, |
| int | quality = 100 ) |
Encodes the tilesheet bitmap using the requested image format and quality.
| format | The encoded image format. |
| quality | The image encoding quality, from 0 through 100. |
Definition at line 368 of file Tilesheet.cs.
|
get |
Gets the packed asset from which the image was loaded, if any.
Definition at line 180 of file Tilesheet.cs.
|
get |
Gets the default tilesheet region.
Definition at line 172 of file Tilesheet.cs.
|
get |
Gets the loose source image path, when available.
Definition at line 184 of file Tilesheet.cs.
|
get |
Gets the color used for transparency masking.
Definition at line 188 of file Tilesheet.cs.
|
get |
Gets the per-channel tolerance used for transparency masking.
Definition at line 192 of file Tilesheet.cs.
|
getset |
Gets the name.
Definition at line 164 of file Tilesheet.cs.
|
get |
Gets whether alpha premultiplication has been applied.
Definition at line 196 of file Tilesheet.cs.
|
get |
Gets the named frame regions in the tilesheet.
Definition at line 168 of file Tilesheet.cs.
|
get |
Gets the current tilesheet bitmap used for rendering.
Definition at line 156 of file Tilesheet.cs.
|
get |
Gets the source bitmap retained before masking or alpha conversion.
Definition at line 160 of file Tilesheet.cs.
|
get |
Gets a frame reference at the specified tile coordinates.
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
Definition at line 510 of file Tilesheet.cs.
|
get |
Gets a frame reference at the specified tile coordinates.
| regionName | The name of the tilesheet region. |
| x | The zero-based column in the tile grid. |
| y | The zero-based row in the tile grid. |
Definition at line 502 of file Tilesheet.cs.
|
get |
Gets the named tilesheet region.
| regionName | The name of the tilesheet region. |
Definition at line 490 of file Tilesheet.cs.
|
getset |
Gets or sets the custom typed values associated with this object.
Definition at line 176 of file Tilesheet.cs.
| Action<Tilesheet>? Gondwana.Drawing.Tilesheets.Tilesheet.Disposed |
Occurs after the object releases its resources.
Definition at line 38 of file Tilesheet.cs.