Provides some convenience methods for drawing to a texture.
Public Member Functions | |
DynamicTexture (int width, int height) | |
Creates a new dynamic texture of the given dimensions. More... | |
DynamicTexture () | |
Creates an empty dynamic texture. Note that this is used internally by canvas. If used, you must call Resize to set it up. More... | |
void | ResizeX (int width) |
Resize this texture on the X axis. More... | |
void | ResizeY (int height) |
Resize this texture on the Y axis. More... | |
bool | Resize (int width, int height, bool clear) |
Resize this texture on the X and Y axis, optionally only doing so if dimensions aren't zero. More... | |
void | Fill (VectorPath path, Color32 colour) |
Fills the given path into this texture. More... | |
void | Refresh () |
Requests the image to be redrawn. The Flush method will end up being called (if you use it). More... | |
void | RequestPaint () |
Requests for this image to be flushed on the next update. More... | |
void | Destroy () |
Tidies up this context. More... | |
void | DrawPixel (int x, int y, Color32 colour) |
Draws a pixel at the given x/y coordinates to the atlas. More... | |
void | DrawLine (int x, int y, int x2, int y2, Color32 colour) |
Draws a line on the atlas from one point to another. More... | |
void | DrawCircle (int x0, int y0, int radius, Color32 colour) |
Draws a filled circle on the atlas. More... | |
virtual void | Flush () |
Override this to use the special update queue - essentially it avoids spamming writing out pixels (canvas does this part) and also avoids spam redrawing the actual graphic (but canvas doesn't do this; metering that is up to you). More... | |
void | Clear () |
Wipes the graphic clean using transparent black. More... | |
void | Clear (Color32 clearColour) |
Wipes the graphic clean. More... | |
override string[] | GetNames () |
The set of lowercase file types that this format will handle. More... | |
override Material | GetImageMaterial (ShaderSet shaders) |
A single-frame image material. Used for e.g. videos and animations. More... | |
override ImageFormat | Instance () |
Creates an instance of this format. More... | |
override void | ClearX () |
Resets this image format container. More... | |
Public Member Functions inherited from PowerUI.ImageFormat | |
virtual int | GetAtlasID () |
Get the identifier used for this content on an atlas. More... | |
Material | GetImageMaterial () |
A single-frame image material using the standard UI shader set. Used for e.g. videos and animations. More... | |
virtual bool | InternallyCached (Location path, ImagePackage package) |
Some formats may cache their result internally. This checks and updates if it has. More... | |
virtual bool | LoadFromAsset (UnityEngine.Object asset, ImagePackage package) |
Attempt to load the image from a Unity resource. More... | |
virtual bool | LoadData (byte[] data, ImagePackage package) |
Loads the raw block of data into an object of this format. More... | |
virtual void | OnLayout (RenderableData context, LayoutBox box, out float width, out float height) |
Called when the host element is drawing. More... | |
virtual void | GoingOnDisplay (Css.RenderableData context) |
Called when this image is going to be displayed. More... | |
virtual void | GoingOffDisplay () |
Called when this image is going to stop being displayed. More... | |
virtual bool | DrawToAtlas (TextureAtlas atlas, AtlasLocation location) |
Draws this image to the given atlas. More... | |
Static Public Member Functions | |
static void | Update () |
Repaints dynamic textures, writing out their pixels. More... | |
Public Attributes | |
Color32[] | Pixels |
The pixels of this texture. More... | |
Scanner | Rasteriser |
The rasteriser used to fill with. More... | |
Package Attributes | |
bool | RefreshRequired |
True if this texture needs a refresh this frame. More... | |
Properties | |
override FilterMode | FilterMode [get, set] |
The filter mode of this dynamic texture. The default filtering is point. More... | |
Texture2D | Texture [get] |
The texture. More... | |
override bool | Isolate [get] |
override int | Height [get] |
override int | Width [get] |
override bool | Loaded [get] |
Properties inherited from PowerUI.ImageFormat | |
virtual int | Height [get] |
The height of the image. More... | |
virtual int | Width [get] |
The width of the image. More... | |
virtual FilterMode | FilterMode [get, set] |
Get/set the filter mode. More... | |
virtual bool | Loaded [get] |
Is this image loaded? More... | |
virtual bool | Isolate [get] |
Should this image be isolated - i.e. off atlas. More... | |
Private Member Functions | |
void | Repaint () |
Called by the update system to redraw this texture (only if it requires it). More... | |
Private Attributes | |
Material | IsolatedMaterial |
An isolated material for this image. More... | |
Texture2D | Texture_ |
A placeholder texture which is only used by the atlas. More... | |
DynamicTexture | NextToUpdate |
Next in the queue. More... | |
Static Private Attributes | |
static DynamicTexture | ToUpdate =null |
The pending queue of textures which require updates. More... | |
|
inline |
Creates a new dynamic texture of the given dimensions.
width | The width of the texture. |
height | The height of the texture. |
|
inline |
Creates an empty dynamic texture. Note that this is used internally by canvas. If used, you must call Resize to set it up.
|
inline |
Wipes the graphic clean using transparent black.
|
inline |
Wipes the graphic clean.
clearColour | The colour to set the whole graphic to. |
|
inlinevirtual |
Resets this image format container.
Reimplemented from PowerUI.ImageFormat.
|
inline |
Tidies up this context.
|
inline |
Draws a filled circle on the atlas.
x0 | The x coordinate of the circles center in pixels from the left. |
y0 | The y coordinate of the circles center in pixels from the bottom. |
radius | The radius of the circle, in pixels. |
colour | The colour of the circle. |
|
inline |
Draws a line on the atlas from one point to another.
x | The x coordinate in pixels from the left of the start of the line. |
y | The y coordinate in pixels from the left of the start of the line. |
x2 | The x coordinate in pixels from the left of the end of the line. |
y2 | The y coordinate in pixels from the left of the end of the line. |
colour | The colour of the line. |
|
inline |
Draws a pixel at the given x/y coordinates to the atlas.
x | The x coordinate in pixels from the left of the texture. |
y | The y coordinate in pixels from the bottom of the texture. |
colour | The colour of the pixel to draw. |
|
inline |
Fills the given path into this texture.
|
inlinevirtual |
Override this to use the special update queue - essentially it avoids spamming writing out pixels (canvas does this part) and also avoids spam redrawing the actual graphic (but canvas doesn't do this; metering that is up to you).
|
inlinevirtual |
A single-frame image material. Used for e.g. videos and animations.
Reimplemented from PowerUI.ImageFormat.
|
inlinevirtual |
The set of lowercase file types that this format will handle.
Reimplemented from PowerUI.ImageFormat.
|
inlinevirtual |
Creates an instance of this format.
Reimplemented from PowerUI.ImageFormat.
|
inline |
Requests the image to be redrawn. The Flush method will end up being called (if you use it).
|
inlineprivate |
Called by the update system to redraw this texture (only if it requires it).
|
inline |
Requests for this image to be flushed on the next update.
|
inline |
Resize this texture on the X and Y axis, optionally only doing so if dimensions aren't zero.
width | The new width. |
height | The new height. |
|
inline |
Resize this texture on the X axis.
width | The new width. |
|
inline |
Resize this texture on the Y axis.
height | The new height. |
|
inlinestatic |
Repaints dynamic textures, writing out their pixels.
|
private |
An isolated material for this image.
|
private |
Next in the queue.
Color32 [] PowerUI.DynamicTexture.Pixels |
The pixels of this texture.
Scanner PowerUI.DynamicTexture.Rasteriser |
The rasteriser used to fill with.
|
package |
True if this texture needs a refresh this frame.
|
private |
A placeholder texture which is only used by the atlas.
|
staticprivate |
The pending queue of textures which require updates.
|
getset |
The filter mode of this dynamic texture. The default filtering is point.
|
get |
|
get |
|
get |
|
get |
The texture.
|
get |