-
Notifications
You must be signed in to change notification settings - Fork 0
ImageTexture
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.ImageTexture |
| Namespace | Electron2D |
| Kind | class |
| Category | Rendering |
Provides an immutable image-backed 2D texture loaded from a PNG file.
public sealed class Electron2D.ImageTexture : Electron2D.Texture2DProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: ImageTexture
Image-backed texture resource loaded from PNG files or mounted res:// project resources.
Electron2D.ImageTexture is a concrete Electron2D.Texture2D for project
assets that need real pixel data during preview runtime rendering,
screenshots, Electron2D.Sprite2D, Electron2D.TextureRect,
Electron2D.TextureButton and Electron2D.CanvasItem.DrawTexture(Electron2D.Texture2D,Electron2D.Vector2,System.Nullable{Electron2D.Color}).
Electron2D 0.1.0 Preview supports non-interlaced PNG images with 8-bit RGB, RGBA, grayscale-alpha data and 1-bit, 2-bit, 4-bit or 8-bit indexed palette data. Unsupported or malformed files fail before a texture instance is returned.
Instances are immutable after creation. Metadata and opacity queries are safe to call from any thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.AtlasTextureElectron2D.Texture2D
| Member | Kind | Summary |
|---|---|---|
GetHeight() |
Method | Gets the decoded image height in pixels. |
GetWidth() |
Method | Gets the decoded image width in pixels. |
HasAlpha() |
Method | Checks whether the decoded image contains transparent pixels or alpha metadata. |
IsPixelOpaque(System.Int32, System.Int32) |
Method | Checks whether a decoded image pixel is fully opaque. |
LoadFromFile(System.String) |
Method | Loads an Electron2D.ImageTexture from a PNG file or project resource path. |
Kind: Method
public System.Int32 GetHeight()()Gets the decoded image height in pixels.
The positive height of the decoded PNG image in pixels.
This method is safe to call from any thread because Electron2D.ImageTexture
instances are immutable after loading.
This method is available since Electron2D 0.1.0 Preview.
Kind: Method
public System.Int32 GetWidth()()Gets the decoded image width in pixels.
The positive width of the decoded PNG image in pixels.
This method is safe to call from any thread because Electron2D.ImageTexture
instances are immutable after loading.
This method is available since Electron2D 0.1.0 Preview.
Kind: Method
public System.Boolean HasAlpha()()Checks whether the decoded image contains transparent pixels or alpha metadata.
true when the source PNG contained an alpha channel, transparency
chunk or transparent palette entry; otherwise, false.
This method is safe to call from any thread because Electron2D.ImageTexture
instances are immutable after loading.
This method is available since Electron2D 0.1.0 Preview.
Kind: Method
public System.Boolean IsPixelOpaque(System.Int32, System.Int32)(System.Int32 x, System.Int32 y)Checks whether a decoded image pixel is fully opaque.
-
x: The pixel X coordinate in image space. -
y: The pixel Y coordinate in image space.
true when the coordinate is inside the image and its alpha value is
fully opaque; otherwise, false.
This method is safe to call from any thread because Electron2D.ImageTexture
instances are immutable after loading.
This method is available since Electron2D 0.1.0 Preview.
Kind: Method
public static Electron2D.ImageTexture LoadFromFile(System.String)(System.String path)Loads an Electron2D.ImageTexture from a PNG file or project resource path.
Relative paths are resolved by the current process in the normal .NET
file-system manner. Paths beginning with res:// are resolved by
the current Electron2D runtime resource source, which may be a project
directory during development or exported resource packages in a player
build. The returned texture is detached from the source file; later file
changes do not mutate the instance.
The loader accepts non-interlaced PNG images with 8-bit RGB, RGBA and
grayscale-alpha color data, plus indexed palette data with 1-bit, 2-bit,
4-bit or 8-bit palette indices. PNG transparency metadata is applied to
Electron2D.ImageTexture.HasAlpha and Electron2D.ImageTexture.IsPixelOpaque(System.Int32,System.Int32).
-
path: The absolute file path, relative file path, orres://resource path to a PNG image.
A new immutable Electron2D.ImageTexture containing the decoded image pixels.
-
System.ArgumentException: Thrown whenpathis empty. -
System.IO.FileNotFoundException: Thrown whenpathdoes not exist. -
System.FormatException: Thrown when the PNG file is malformed or uses an unsupported PNG mode.
This method performs file IO and should be called before sharing the texture across runtime systems.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.Texture2D
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.