Trait ux::TextureCacheExt [−][src]
pub trait TextureCacheExt: 'static { pub fn contains(&self, uri: &str) -> bool; pub fn get_cogl_texture(&self, uri: &str) -> Option<Handle>; pub fn get_size(&self) -> usize; pub fn insert(&self, uri: &str, texture: Handle); pub fn load_cache(&self, filename: &str); }
Required methods
pub fn contains(&self, uri: &str) -> bool
[src]
contains: @self: A #TextureCache @uri: A URI or path to an image file
Checks whether the given URI/path is contained within the texture cache.
Returns: %true if the image exists, %false otherwise
pub fn get_cogl_texture(&self, uri: &str) -> Option<Handle>
[src]
contains_meta: @self: A #TextureCache @uri: A URI or path to an image file @ident: A unique identifier
Checks whether there are any textures associated with the given URI by the given identifier.
Returns: %true if the data exists, %false otherwise
get_cogl_texture: @self: A #TextureCache @uri: A URI or path to an image file
Create a #CoglHandle representing a texture of the specified image. Adds the image to the cache if the image had not been previously loaded. Subsequent calls with the same image URI/path will return the #CoglHandle of the previously loaded image with an increased reference count.
Returns: (transfer none): a #CoglHandle to the cached texture
pub fn get_size(&self) -> usize
[src]
get_meta_cogl_texture: @self: A #TextureCache @uri: A URI or path to an image file @ident: A unique identifier
Retrieves the #CoglHandle of the previously added image associated with the given unique identifier.
See insert_meta()
Returns: (transfer full): A #CoglHandle to a texture, with an added reference. %None if no image was found.
get_size: @self: A #TextureCache
Returns the number of items in the texture cache
Returns: the current size of the cache
pub fn insert(&self, uri: &str, texture: Handle)
[src]
insert: @self: A #TextureCache @uri: A URI or local file path @texture: A #CoglHandle to a texture
Inserts a texture into the texture cache. This can be useful if you want to cache a texture from a custom or unhandled URI type, or you want to override a particular texture.
If the image is already in the cache, this texture will replace it. A reference will be taken on the given texture.
pub fn load_cache(&self, filename: &str)
[src]
insert_meta: @self: A #TextureCache @uri: A URI or local file path @ident: A unique identifier @texture: A #CoglHandle to a texture @destroy_func: An optional destruction function for @ident
Inserts a texture that’s associated with a URI into the cache. If the metadata already exists for this URI, it will be replaced.
This is useful if you have a widely used modification of an image, for example, an image with a border composited around it.
Implementors
impl<O> TextureCacheExt for O where
O: Is<TextureCache>,
[src]
impl<O> TextureCacheExt for O where
O: Is<TextureCache>,
[src]pub fn contains(&self, uri: &str) -> bool
[src]
contains: @self: A #TextureCache @uri: A URI or path to an image file
Checks whether the given URI/path is contained within the texture cache.
Returns: %true if the image exists, %false otherwise
pub fn get_cogl_texture(&self, uri: &str) -> Option<Handle>
[src]
contains_meta: @self: A #TextureCache @uri: A URI or path to an image file @ident: A unique identifier
Checks whether there are any textures associated with the given URI by the given identifier.
Returns: %true if the data exists, %false otherwise
get_cogl_texture: @self: A #TextureCache @uri: A URI or path to an image file
Create a #CoglHandle representing a texture of the specified image. Adds the image to the cache if the image had not been previously loaded. Subsequent calls with the same image URI/path will return the #CoglHandle of the previously loaded image with an increased reference count.
Returns: (transfer none): a #CoglHandle to the cached texture
pub fn get_size(&self) -> usize
[src]
get_meta_cogl_texture: @self: A #TextureCache @uri: A URI or path to an image file @ident: A unique identifier
Retrieves the #CoglHandle of the previously added image associated with the given unique identifier.
See insert_meta()
Returns: (transfer full): A #CoglHandle to a texture, with an added reference. %None if no image was found.
get_size: @self: A #TextureCache
Returns the number of items in the texture cache
Returns: the current size of the cache
pub fn insert(&self, uri: &str, texture: Handle)
[src]
insert: @self: A #TextureCache @uri: A URI or local file path @texture: A #CoglHandle to a texture
Inserts a texture into the texture cache. This can be useful if you want to cache a texture from a custom or unhandled URI type, or you want to override a particular texture.
If the image is already in the cache, this texture will replace it. A reference will be taken on the given texture.
pub fn load_cache(&self, filename: &str)
[src]
insert_meta: @self: A #TextureCache @uri: A URI or local file path @ident: A unique identifier @texture: A #CoglHandle to a texture @destroy_func: An optional destruction function for @ident
Inserts a texture that’s associated with a URI into the cache. If the metadata already exists for this URI, it will be replaced.
This is useful if you have a widely used modification of an image, for example, an image with a border composited around it.