Detailed Description

An object which holds and retrieves different types of graphics such as animations, videos (pro only) and textures.

Inheritance diagram for PowerUI.ImagePackage:
Blaze.AtlasEntity

Public Member Functions

 ImagePackage (string src, string relativeTo)
 Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request. More...
 
 ImagePackage (string src, string relativeTo, bool useResolution)
 Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request. More...
 
 ImagePackage (Texture2D image)
 Creates an image package containing the given image. More...
 
 ImagePackage (DynamicTexture image)
 Creates an image package containing the given dynamic image. More...
 
bool MultiThreadDraw ()
 True if DrawToAtlas can be multithreaded for this object. More...
 
void GetDimensionsOnAtlas (out int width, out int height)
 Gets the dimensions of this entity on an atlas. More...
 
bool DrawToAtlas (TextureAtlas atlas, AtlasLocation location)
 Draws this entity to the given atlas now. More...
 
int GetAtlasID ()
 A globally unique ID that can be used to identify the image being held. More...
 
void Get (OnImageReady imageReady)
 Sends the request off and defines a callback to run when the result is ready. More...
 
void GotCached (ImagePackage package)
 Called if the same resource was requested before so the image can be redisplayed quickly. This will always preceed some other result function. More...
 
void GotGraphic (string error)
 Called by the file handler when the response errored. More...
 
void GotGraphic (DynamicTexture image)
 Called by the file handler when a dynamic atlas texture was retrieved successfully. More...
 
void GotGraphic (SPA animation)
 Called by the file handler when an animation was retrieved successfully. More...
 
void GotGraphic (MovieTexture movie)
 Called by the file handler when a video was retrieved successfully. More...
 
void GotGraphic (Texture2D image)
 Called by the file handler when an image was retrieved successfully. More...
 
void GoingOnDisplay ()
 Called when this image is going to be displayed. More...
 
void GoingOffDisplay ()
 Called when this image is no longer being displayed. More...
 
bool Loaded ()
 Checks if this package contains something loaded and useable. More...
 
int Width ()
 Gets the width of the graphic in this package. Note that you should check if it is PowerUI.ImagePackage.Loaded first. More...
 
int Height ()
 Gets the height of the graphic in this package. Note that you should check if it is PowerUI.ImagePackage.Loaded first. More...
 

Public Attributes

SPA SPAFile
 The animation that is in use, if any. More...
 
bool IsVideo
 True if PowerUI.ImagePackage.Video was set. More...
 
string Error
 Any error that occured whilst retrieving the graphic. More...
 
FilePath File
 The file that was requested. More...
 
bool Animated
 True if PowerUI.ImagePackage.AnimationInstance was set. More...
 
bool IsDynamic
 True if PowerUI.ImagePackage.DynamicImage was set. More...
 
string FileType
 The type of file that was requested (e.g. "png" or "jpg") More...
 
Texture2D Image
 The image texture retrieved. More...
 
object ExtraData
 A custom data object for passing anything else when the callback runs. More...
 
MovieTexture Video
 The video retrieved. More...
 
SPAInstance Animation
 An instance of the animation retrieved. More...
 
bool PixelPerfect =true
 True when an image should display itself whilst taking resolution into account. More...
 
DynamicTexture DynamicImage
 The dynamic image retrieved. More...
 

Properties

Material VideoMaterial [get]
 If the package contains a video, this gets the material that the video will playback on. More...
 
Material ImageMaterial [get]
 A material with just the single frame on it. More...
 
string Url [get]
 The fully resolved URL requested. More...
 
bool Ok [get]
 True if there is no error and the graphic is ok. More...
 
bool Errored [get]
 True if there was an error and the graphic is not ok. More...
 

Events

OnImageReady ImageReady
 The callback to run when the graphic has been retrieved (or an error occured). More...
 

Private Member Functions

void SetPath (string src, string relativeTo, bool useResolution)
 Sets up the filepath to the given url which may be relative to a given location. More...
 
void SetPath (string src, string relativeTo)
 Sets up the filepath to the given url which may be relative to a given location. More...
 
void Clear ()
 Removes all content from this image package. More...
 

Private Attributes

Material _VideoMaterial
 The material the video is available from. See PowerUI.ImagePackage.VideoMaterial. More...
 

Constructor & Destructor Documentation

PowerUI.ImagePackage.ImagePackage ( string  src,
string  relativeTo 
)
inline

Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any (may be null).
PowerUI.ImagePackage.ImagePackage ( string  src,
string  relativeTo,
bool  useResolution 
)
inline

Creates a new text package for the named file to get. You must then call PowerUI.TextPackage.Get to perform the request.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any (may be null).
useResolutionTrue if the resolution string should be appended to the name.
PowerUI.ImagePackage.ImagePackage ( Texture2D  image)
inline

Creates an image package containing the given image.

Parameters
imageThe image for this image package. Used to display cached graphics.
PowerUI.ImagePackage.ImagePackage ( DynamicTexture  image)
inline

Creates an image package containing the given dynamic image.

Parameters
imageThe image for this image package. Used to display cached graphics.

Member Function Documentation

void PowerUI.ImagePackage.Clear ( )
inlineprivate

Removes all content from this image package.

bool PowerUI.ImagePackage.DrawToAtlas ( TextureAtlas  atlas,
AtlasLocation  location 
)
inline

Draws this entity to the given atlas now.

Implements Blaze.AtlasEntity.

void PowerUI.ImagePackage.Get ( OnImageReady  imageReady)
inline

Sends the request off and defines a callback to run when the result is ready.

Parameters
imageReadyThe callback to run when the graphic has been retrieved. Note that the callback must check if the result is PowerUI.ImagePackage.Ok.
int PowerUI.ImagePackage.GetAtlasID ( )
inline

A globally unique ID that can be used to identify the image being held.

Implements Blaze.AtlasEntity.

void PowerUI.ImagePackage.GetDimensionsOnAtlas ( out int  width,
out int  height 
)
inline

Gets the dimensions of this entity on an atlas.

Implements Blaze.AtlasEntity.

void PowerUI.ImagePackage.GoingOffDisplay ( )
inline

Called when this image is no longer being displayed.

void PowerUI.ImagePackage.GoingOnDisplay ( )
inline

Called when this image is going to be displayed.

void PowerUI.ImagePackage.GotCached ( ImagePackage  package)
inline

Called if the same resource was requested before so the image can be redisplayed quickly. This will always preceed some other result function.

void PowerUI.ImagePackage.GotGraphic ( string  error)
inline

Called by the file handler when the response errored.

Parameters
errorThe error that occured.
void PowerUI.ImagePackage.GotGraphic ( DynamicTexture  image)
inline

Called by the file handler when a dynamic atlas texture was retrieved successfully.

Parameters
imageThe image received.
void PowerUI.ImagePackage.GotGraphic ( SPA  animation)
inline

Called by the file handler when an animation was retrieved successfully.

Parameters
animationThe animation received.
void PowerUI.ImagePackage.GotGraphic ( MovieTexture  movie)
inline

Called by the file handler when a video was retrieved successfully.

Parameters
videoThe video received.
void PowerUI.ImagePackage.GotGraphic ( Texture2D  image)
inline

Called by the file handler when an image was retrieved successfully.

Parameters
imageThe image received.
int PowerUI.ImagePackage.Height ( )
inline

Gets the height of the graphic in this package. Note that you should check if it is PowerUI.ImagePackage.Loaded first.

Returns
The height of the graphic.
bool PowerUI.ImagePackage.Loaded ( )
inline

Checks if this package contains something loaded and useable.

Returns
True if there is a useable graphic in this package.
bool PowerUI.ImagePackage.MultiThreadDraw ( )
inline

True if DrawToAtlas can be multithreaded for this object.

Implements Blaze.AtlasEntity.

void PowerUI.ImagePackage.SetPath ( string  src,
string  relativeTo,
bool  useResolution 
)
inlineprivate

Sets up the filepath to the given url which may be relative to a given location.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any. May be null.
useResolutionTrue if the resolution string should be appended to the name.
void PowerUI.ImagePackage.SetPath ( string  src,
string  relativeTo 
)
inlineprivate

Sets up the filepath to the given url which may be relative to a given location.

Parameters
srcThe file to get.
relativeToThe path the file to get is relative to, if any. May be null.
int PowerUI.ImagePackage.Width ( )
inline

Gets the width of the graphic in this package. Note that you should check if it is PowerUI.ImagePackage.Loaded first.

Returns
The width of the graphic.

Member Data Documentation

Material PowerUI.ImagePackage._VideoMaterial
private

The material the video is available from. See PowerUI.ImagePackage.VideoMaterial.

bool PowerUI.ImagePackage.Animated

True if PowerUI.ImagePackage.AnimationInstance was set.

SPAInstance PowerUI.ImagePackage.Animation

An instance of the animation retrieved.

DynamicTexture PowerUI.ImagePackage.DynamicImage

The dynamic image retrieved.

string PowerUI.ImagePackage.Error

Any error that occured whilst retrieving the graphic.

object PowerUI.ImagePackage.ExtraData

A custom data object for passing anything else when the callback runs.

FilePath PowerUI.ImagePackage.File

The file that was requested.

string PowerUI.ImagePackage.FileType

The type of file that was requested (e.g. "png" or "jpg")

Texture2D PowerUI.ImagePackage.Image

The image texture retrieved.

bool PowerUI.ImagePackage.IsDynamic
bool PowerUI.ImagePackage.IsVideo

True if PowerUI.ImagePackage.Video was set.

bool PowerUI.ImagePackage.PixelPerfect =true

True when an image should display itself whilst taking resolution into account.

SPA PowerUI.ImagePackage.SPAFile

The animation that is in use, if any.

MovieTexture PowerUI.ImagePackage.Video

The video retrieved.

Property Documentation

bool PowerUI.ImagePackage.Errored
get

True if there was an error and the graphic is not ok.

Material PowerUI.ImagePackage.ImageMaterial
get

A material with just the single frame on it.

bool PowerUI.ImagePackage.Ok
get

True if there is no error and the graphic is ok.

string PowerUI.ImagePackage.Url
get

The fully resolved URL requested.

Material PowerUI.ImagePackage.VideoMaterial
get

If the package contains a video, this gets the material that the video will playback on.

Event Documentation

OnImageReady PowerUI.ImagePackage.ImageReady

The callback to run when the graphic has been retrieved (or an error occured).