Interface IPluginImages
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
Images a plugin can draw on a canvas: the client's own art by surface id, the icons the client composes for spells and objects, and art the plugin ships itself, decoded by the host. There are no raw pixel uploads.
Every request is counted once per distinct thing asked for and held as many times as it was asked for: asking twice for the same surface returns the same image, and it takes two releases to let it go. A plugin may hold at most MaximumCount images, and its own art at most MaximumBytes of texture memory; a request past either limit, or a plugin image wider or taller than MaximumDimension, is refused with None and reported once in the client's log. Client art is shared with every other reader of the same surface and is not counted against the byte budget.
Call this only from the thread the plugin's own callbacks run on (the one that raises the tick); the host refuses any other. On a host without a window, or before the client's interface is up, every request answers None and IsAvailable is false. Images are dropped when the interface is torn down, for example on a reconnect; drawing with a dropped image draws nothing, and the plugin asks again once it is drawing again.
public interface IPluginImages
Properties
Count
How many distinct images the plugin currently holds.
int Count { get; }
Property Value
IsAvailable
Whether requests can currently be answered: false on a host without a window and until the client's interface is up.
bool IsAvailable { get; }
Property Value
MaximumBytes
The most texture memory, in bytes, the plugin's own art may take; 0 on a host that draws nothing.
long MaximumBytes { get; }
Property Value
MaximumCount
The most distinct images the plugin may hold at once; 0 on a host that draws nothing.
int MaximumCount { get; }
Property Value
MaximumDimension
The widest or tallest a plugin's own image may be, in pixels; 0 on a host that draws nothing.
int MaximumDimension { get; }
Property Value
Methods
FromClientArt(uint)
The client's own art for a render surface, either a full id or a bare index, normalised the way Normalize(uint) does.
PluginImage FromClientArt(uint surfaceIdOrIndex)
Parameters
surfaceIdOrIndexuintThe surface's full id, or its bare index in the image block.
Returns
- PluginImage
The image, or None when the client has no such surface or the request was refused.
FromObjectIcon(uint)
The icon the client composes for a world object it currently knows, with the object's underlay, overlay and effect layers, as the inventory draws it.
PluginImage FromObjectIcon(uint objectId)
Parameters
objectIduintThe object's id.
Returns
- PluginImage
The image, or None when the client does not know the object, it has no icon, or the request was refused.
FromSpellIcon(uint)
The icon the client composes for a spell, as the spell bar draws it.
PluginImage FromSpellIcon(uint spellId)
Parameters
spellIduintThe spell's id.
Returns
- PluginImage
The image, or None when there is no such spell or the request was refused.
FromStream(string, Func<Stream>)
Art the plugin ships, opened through open only when
the host does not already hold an image under name.
The host decodes the stream (PNG, JPEG, BMP, TGA or GIF) and disposes
it; the plugin never sees pixels. A second request under the same
name is the same image, held once more.
PluginImage FromStream(string name, Func<Stream> open)
Parameters
namestringThe plugin's own name for the image, unique within the plugin, such as a relative file path.
openFunc<Stream>Opens a fresh readable stream of the encoded image.
Returns
- PluginImage
The image, or None when the stream could not be opened or decoded, the image is too large, or the request was refused.
Release(PluginImage)
Lets go of one hold on an image. The image stays while another hold remains and is freed on the last.
bool Release(PluginImage image)
Parameters
imagePluginImageAn image this surface issued.
Returns
- bool
False for an image this surface did not issue or has already let go of completely.