HDK
|
#include <ImageHandler.h>
Public Member Functions | |
virtual | ~ImageHandler () |
void | addLoader (ImageLoaderPtr loader) |
StringSet | supportedExtensions () |
Get a list of extensions supported by the handler. More... | |
bool | saveImage (const FilePath &filePath, ConstImagePtr image, bool verticalFlip=false) |
ImagePtr | acquireImage (const FilePath &filePath, const Color4 &defaultColor=Color4(0.0f)) |
virtual bool | bindImage (ImagePtr image, const ImageSamplingProperties &samplingProperties) |
virtual bool | unbindImage (ImagePtr image) |
void | unbindImages () |
Unbind all images that are currently stored in the cache. More... | |
void | setSearchPath (const FileSearchPath &path) |
Set the search path to be used for finding images on the file system. More... | |
const FileSearchPath & | getSearchPath () const |
Return the image search path. More... | |
void | setFilenameResolver (StringResolverPtr resolver) |
Set the filename resolver for images. More... | |
StringResolverPtr | getFilenameResolver () const |
Return the filename resolver for images. More... | |
virtual bool | createRenderResources (ImagePtr image, bool generateMipMaps, bool useAsRenderTarget=false) |
Create rendering resources for the given image. More... | |
virtual void | releaseRenderResources (ImagePtr image=nullptr) |
void | clearImageCache () |
ImagePtr | getZeroImage () const |
Return a fallback image with zeroes in all channels. More... | |
ImageVec | getReferencedImages (ConstDocumentPtr doc) |
Static Public Member Functions | |
static ImageHandlerPtr | create (ImageLoaderPtr imageLoader) |
Protected Member Functions | |
ImageHandler (ImageLoaderPtr imageLoader) | |
ImagePtr | loadImage (const FilePath &filePath) |
void | cacheImage (const string &filePath, ImagePtr image) |
ImagePtr | getCachedImage (const FilePath &filePath) |
Protected Attributes | |
ImageLoaderMap | _imageLoaders |
ImageMap | _imageCache |
FileSearchPath | _searchPath |
StringResolverPtr | _resolver |
ImagePtr | _zeroImage |
Base image handler class. Keeps track of images which are loaded from disk via supplied ImageLoader. Derived classes are responsible for determinining how to perform the logic for "binding" of these resources for a given target (such as a given shading language).
Definition at line 163 of file ImageHandler.h.
|
inlinevirtual |
Definition at line 170 of file ImageHandler.h.
|
protected |
ImagePtr ImageHandler::acquireImage | ( | const FilePath & | filePath, |
const Color4 & | defaultColor = Color4(0.0f) |
||
) |
Acquire an image from the cache or file system. If the image is not found in the cache, then each image loader will be applied in turn. If the image cannot be found by any loader, then a uniform image of the given default color will be returned.
filePath | File path of the image. |
defaultColor | Default color to use as a fallback for missing images. |
void ImageHandler::addLoader | ( | ImageLoaderPtr | loader | ) |
Add another image loader to the handler, which will be invoked if existing loaders cannot load a given image.
|
virtual |
Bind an image for rendering.
image | The image to bind. |
samplingProperties | Sampling properties for the image. |
Reimplemented in GLTextureHandler.
|
inline |
Clear the contents of the image cache, first releasing any render resources associated with cached images.
Definition at line 241 of file ImageHandler.h.
|
inlinestatic |
Definition at line 166 of file ImageHandler.h.
|
virtual |
Create rendering resources for the given image.
Reimplemented in GLTextureHandler.
|
inline |
Return the filename resolver for images.
Definition at line 227 of file ImageHandler.h.
ImageVec ImageHandler::getReferencedImages | ( | ConstDocumentPtr | doc | ) |
Acquire all images referenced by the given document, and return the images in a vector.
|
inline |
Return the image search path.
Definition at line 215 of file ImageHandler.h.
|
inline |
Return a fallback image with zeroes in all channels.
Definition at line 248 of file ImageHandler.h.
Release rendering resources for the given image, or for all cached images if no image pointer is specified.
Reimplemented in GLTextureHandler.
bool ImageHandler::saveImage | ( | const FilePath & | filePath, |
ConstImagePtr | image, | ||
bool | verticalFlip = false |
||
) |
Save image to disk. This method must be implemented by derived classes. The first image loader which supports the file name extension will be used.
filePath | File path to be written |
image | The image to be saved |
verticalFlip | Whether the image should be flipped in Y during save |
|
inline |
Set the filename resolver for images.
Definition at line 221 of file ImageHandler.h.
|
inline |
Set the search path to be used for finding images on the file system.
Definition at line 209 of file ImageHandler.h.
StringSet ImageHandler::supportedExtensions | ( | ) |
Get a list of extensions supported by the handler.
|
virtual |
Unbind an image, making it no longer active for rendering.
image | The image to unbind. |
Reimplemented in GLTextureHandler.
void ImageHandler::unbindImages | ( | ) |
Unbind all images that are currently stored in the cache.
|
protected |
Definition at line 273 of file ImageHandler.h.
|
protected |
Definition at line 272 of file ImageHandler.h.
|
protected |
Definition at line 275 of file ImageHandler.h.
|
protected |
Definition at line 274 of file ImageHandler.h.
|
protected |
Definition at line 276 of file ImageHandler.h.