Trait components::ImageExt[][src]

pub trait ImageExt: 'static {
Show methods fn animate_scale_mode(
        &self,
        mode: u64,
        duration: u32,
        scale_mode: ImageScaleMode
    );
fn clear(&self);
fn get_allow_upscale(&self) -> bool;
fn get_image_rotation(&self) -> f32;
fn get_load_async(&self) -> bool;
fn get_scale_height_threshold(&self) -> u32;
fn get_scale_mode(&self) -> ImageScaleMode;
fn get_scale_width_threshold(&self) -> u32;
fn get_transition_duration(&self) -> u32;
fn set_allow_upscale(&self, allow: bool);
fn set_from_buffer(&self, buffer: &[u8]) -> Result<(), Error>;
fn set_from_buffer_at_size(
        &self,
        buffer: &[u8],
        width: i32,
        height: i32
    ) -> Result<(), Error>;
fn set_from_cogl_texture(&self, texture: Handle) -> bool;
fn set_from_data(
        &self,
        data: &[u8],
        pixel_format: PixelFormat,
        width: i32,
        height: i32,
        rowstride: i32
    ) -> Result<(), Error>;
fn set_from_file(&self, filename: &str) -> Result<(), Error>;
fn set_from_file_at_size(
        &self,
        filename: &str,
        width: i32,
        height: i32
    ) -> Result<(), Error>;
fn set_image_rotation(&self, rotation: f32);
fn set_load_async(&self, load_async: bool);
fn set_scale_height_threshold(&self, pixels: u32);
fn set_scale_mode(&self, mode: ImageScaleMode);
fn set_scale_width_threshold(&self, pixels: u32);
fn set_transition_duration(&self, duration: u32);
fn set_property_filename(&self, filename: Option<&str>);
fn connect_image_load_error<F: Fn(&Self, &Error) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_image_loaded<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_allow_upscale_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_filename_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_image_rotation_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_load_async_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_scale_height_threshold_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_scale_mode_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_scale_width_threshold_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_transition_duration_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
}

Required methods

fn animate_scale_mode(
    &self,
    mode: u64,
    duration: u32,
    scale_mode: ImageScaleMode
)
[src]

animate_scale_mode: @image: An #Image @mode: a #AnimationMode @duration: duration of the animation in milliseconds @scale_mode: The #ImageScaleMode to set

Sets the value of #Image:scale-mode to @scale_mode and animates the scale factor of the image between the previous value and the new value.

fn clear(&self)[src]

clear: @image: A #Image

Clear the current image and set a blank, transparent image.

Returns: static void

fn get_allow_upscale(&self) -> bool[src]

get_allow_upscale: @image: A #Image

Determines whether image up-scaling is allowed.

Returns: %true if upscaling is allowed, %false otherwise

fn get_image_rotation(&self) -> f32[src]

get_image_rotation: @image: A #Image

Get the value of the Image:image-rotation property.

Returns: The value of the image-rotation property.

fn get_load_async(&self) -> bool[src]

get_load_async: @image: A #Image

Determines whether asynchronous image loading is in use.

Returns: %true if images are set to load asynchronously, %false otherwise

fn get_scale_height_threshold(&self) -> u32[src]

get_scale_height_threshold: @image: A #Image

Retrieves the height scaling threshold.

Returns: The height scaling threshold, in pixels

fn get_scale_mode(&self) -> ImageScaleMode[src]

get_scale_mode: @image: An #Image

Get the current scale mode of @Image.

Returns: The current ImageScaleMode

fn get_scale_width_threshold(&self) -> u32[src]

get_scale_width_threshold: @image: A #Image

Retrieves the width scaling threshold.

Returns: The width scaling threshold, in pixels

fn get_transition_duration(&self) -> u32[src]

get_transition_duration: @image: A #Image

Get the value of the Image:transition-duration property.

Returns: The value of the transition-duration property.

fn set_allow_upscale(&self, allow: bool)[src]

set_allow_upscale: @image: A #Image @allow: %true to allow upscaling, %false otherwise

Sets whether up-scaling of images is allowed. If set to %true and a size larger than the image is requested, the image will be up-scaled in software.

The advantage of this is that software up-scaling is potentially higher quality, but it comes at the expense of video memory.

fn set_from_buffer(&self, buffer: &[u8]) -> Result<(), Error>[src]

set_from_buffer: @image: An #Image @buffer: (array length=buffer_size) (transfer full): A buffer pointing to encoded image data @buffer_size: The size of @buffer, in bytes @buffer_free_func: (allow-none): A function to free @buffer, or %None @error: Return location for a #GError, or #None

Set the image data from unencoded image data, stored in memory. In case of failure, #false is returned and @error is set. It is expected that @buffer will remain accessible for the duration of the load. Once it is finished with, @buffer_free_func will be called.

Returns: #true if the image was successfully updated

fn set_from_buffer_at_size(
    &self,
    buffer: &[u8],
    width: i32,
    height: i32
) -> Result<(), Error>
[src]

set_from_buffer_at_size: @image: An #Image @buffer: (array length=buffer_size) (transfer full): A buffer pointing to encoded image data @buffer_size: The size of @buffer, in bytes @buffer_free_func: (allow-none): A function to free @buffer, or %None @width: Width to scale the image to, or -1 @height: Height to scale the image to, or -1 @error: Return location for a #GError, or #None

Set the image data from unencoded image data, stored in memory, and scales it while loading. In case of failure, #false is returned and @error is set. It is expected that @buffer will remain accessible for the duration of the load. Once it is finished with, @buffer_free_func will be called. The aspect ratio will always be maintained.

Returns: #true if the image was successfully updated

fn set_from_cogl_texture(&self, texture: Handle) -> bool[src]

set_from_cogl_texture: @image: A #Image @texture: A #CoglHandle to a texture

Sets the contents of the image from the given Cogl texture.

Returns: %true on success, %false on failure

fn set_from_data(
    &self,
    data: &[u8],
    pixel_format: PixelFormat,
    width: i32,
    height: i32,
    rowstride: i32
) -> Result<(), Error>
[src]

set_from_data: @image: An #Image @data: (array): Image data @pixel_format: The #CoglPixelFormat of the buffer @width: Width in pixels of image data. @height: Height in pixels of image data @rowstride: Distance in bytes between row starts. @error: Return location for a #GError, or #None

Set the image data from a buffer. In case of failure, #false is returned and @error is set.

Returns: #true if the image was successfully updated

fn set_from_file(&self, filename: &str) -> Result<(), Error>[src]

set_from_file: @image: An #Image @filename: Filename to read the file from @error: Return location for a #GError, or #None

Set the image data from an image file. In case of failure, #false is returned and @error is set.

Returns: #true if the image was successfully updated

fn set_from_file_at_size(
    &self,
    filename: &str,
    width: i32,
    height: i32
) -> Result<(), Error>
[src]

set_from_file_at_size: @image: An #Image @filename: Filename to read the file from @width: Width to scale the image to, or -1 @height: Height to scale the image to, or -1 @error: Return location for a #GError, or #None

Set the image data from an image file, and scale the image during loading. In case of failure, #false is returned and @error is set. The aspect ratio will always be maintained.

Returns: #true if the image was successfully updated

fn set_image_rotation(&self, rotation: f32)[src]

set_image_rotation: @image: A #Image @rotation: Rotation angle in degrees

Set the Image:image-rotation property.

fn set_load_async(&self, load_async: bool)[src]

set_load_async: @image: A #Image @load_async: %true to load images asynchronously

Sets whether to load images asynchronously. Asynchronous image loading requires thread support (see g_thread_init()).

When using asynchronous image loading, all image-loading functions will return immediately as successful. The #Image::image-loaded and #Image::image-load-error signals are used to signal success or failure of asynchronous image loading.

fn set_scale_height_threshold(&self, pixels: u32)[src]

set_scale_height_threshold: @image: A #Image @pixels: Number of pixels

Sets the threshold used to determine whether to scale the height of the image. If a specific height is requested, the image height is allowed to differ by this amount before scaling is employed.

This can be useful to avoid excessive CPU usage when the image differs only slightly to the desired size.

fn set_scale_mode(&self, mode: ImageScaleMode)[src]

set_scale_mode: @image: An #Image @mode: The #ImageScaleMode to set

Set the scale mode on @Image

fn set_scale_width_threshold(&self, pixels: u32)[src]

set_scale_width_threshold: @image: A #Image @pixels: Number of pixels

Sets the threshold used to determine whether to scale the width of the image. If a specific width is requested, the image width is allowed to differ by this amount before scaling is employed.

This can be useful to avoid excessive CPU usage when the image differs only slightly to the desired size.

fn set_transition_duration(&self, duration: u32)[src]

set_transition_duration: @image: A #Image @duration: Transition duration in milliseconds

Set the Image:transition-duration property.

fn set_property_filename(&self, filename: Option<&str>)[src]

fn connect_image_load_error<F: Fn(&Self, &Error) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_image_loaded<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId[src]

fn connect_property_allow_upscale_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_filename_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_image_rotation_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_load_async_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_scale_height_threshold_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_scale_mode_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_scale_width_threshold_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_transition_duration_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...

Implementors

impl<O: Is<Image>> ImageExt for O[src]

fn animate_scale_mode(
    &self,
    mode: u64,
    duration: u32,
    scale_mode: ImageScaleMode
)
[src]

animate_scale_mode: @image: An #Image @mode: a #AnimationMode @duration: duration of the animation in milliseconds @scale_mode: The #ImageScaleMode to set

Sets the value of #Image:scale-mode to @scale_mode and animates the scale factor of the image between the previous value and the new value.

fn clear(&self)[src]

clear: @image: A #Image

Clear the current image and set a blank, transparent image.

Returns: static void

fn get_allow_upscale(&self) -> bool[src]

get_allow_upscale: @image: A #Image

Determines whether image up-scaling is allowed.

Returns: %true if upscaling is allowed, %false otherwise

fn get_image_rotation(&self) -> f32[src]

get_image_rotation: @image: A #Image

Get the value of the Image:image-rotation property.

Returns: The value of the image-rotation property.

fn get_load_async(&self) -> bool[src]

get_load_async: @image: A #Image

Determines whether asynchronous image loading is in use.

Returns: %true if images are set to load asynchronously, %false otherwise

fn get_scale_height_threshold(&self) -> u32[src]

get_scale_height_threshold: @image: A #Image

Retrieves the height scaling threshold.

Returns: The height scaling threshold, in pixels

fn get_scale_mode(&self) -> ImageScaleMode[src]

get_scale_mode: @image: An #Image

Get the current scale mode of @Image.

Returns: The current ImageScaleMode

fn get_scale_width_threshold(&self) -> u32[src]

get_scale_width_threshold: @image: A #Image

Retrieves the width scaling threshold.

Returns: The width scaling threshold, in pixels

fn get_transition_duration(&self) -> u32[src]

get_transition_duration: @image: A #Image

Get the value of the Image:transition-duration property.

Returns: The value of the transition-duration property.

fn set_allow_upscale(&self, allow: bool)[src]

set_allow_upscale: @image: A #Image @allow: %true to allow upscaling, %false otherwise

Sets whether up-scaling of images is allowed. If set to %true and a size larger than the image is requested, the image will be up-scaled in software.

The advantage of this is that software up-scaling is potentially higher quality, but it comes at the expense of video memory.

fn set_from_buffer(&self, buffer: &[u8]) -> Result<(), Error>[src]

set_from_buffer: @image: An #Image @buffer: (array length=buffer_size) (transfer full): A buffer pointing to encoded image data @buffer_size: The size of @buffer, in bytes @buffer_free_func: (allow-none): A function to free @buffer, or %None @error: Return location for a #GError, or #None

Set the image data from unencoded image data, stored in memory. In case of failure, #false is returned and @error is set. It is expected that @buffer will remain accessible for the duration of the load. Once it is finished with, @buffer_free_func will be called.

Returns: #true if the image was successfully updated

fn set_from_buffer_at_size(
    &self,
    buffer: &[u8],
    width: i32,
    height: i32
) -> Result<(), Error>
[src]

set_from_buffer_at_size: @image: An #Image @buffer: (array length=buffer_size) (transfer full): A buffer pointing to encoded image data @buffer_size: The size of @buffer, in bytes @buffer_free_func: (allow-none): A function to free @buffer, or %None @width: Width to scale the image to, or -1 @height: Height to scale the image to, or -1 @error: Return location for a #GError, or #None

Set the image data from unencoded image data, stored in memory, and scales it while loading. In case of failure, #false is returned and @error is set. It is expected that @buffer will remain accessible for the duration of the load. Once it is finished with, @buffer_free_func will be called. The aspect ratio will always be maintained.

Returns: #true if the image was successfully updated

fn set_from_cogl_texture(&self, texture: Handle) -> bool[src]

set_from_cogl_texture: @image: A #Image @texture: A #CoglHandle to a texture

Sets the contents of the image from the given Cogl texture.

Returns: %true on success, %false on failure

fn set_from_data(
    &self,
    data: &[u8],
    pixel_format: PixelFormat,
    width: i32,
    height: i32,
    rowstride: i32
) -> Result<(), Error>
[src]

set_from_data: @image: An #Image @data: (array): Image data @pixel_format: The #CoglPixelFormat of the buffer @width: Width in pixels of image data. @height: Height in pixels of image data @rowstride: Distance in bytes between row starts. @error: Return location for a #GError, or #None

Set the image data from a buffer. In case of failure, #false is returned and @error is set.

Returns: #true if the image was successfully updated

fn set_from_file(&self, filename: &str) -> Result<(), Error>[src]

set_from_file: @image: An #Image @filename: Filename to read the file from @error: Return location for a #GError, or #None

Set the image data from an image file. In case of failure, #false is returned and @error is set.

Returns: #true if the image was successfully updated

fn set_from_file_at_size(
    &self,
    filename: &str,
    width: i32,
    height: i32
) -> Result<(), Error>
[src]

set_from_file_at_size: @image: An #Image @filename: Filename to read the file from @width: Width to scale the image to, or -1 @height: Height to scale the image to, or -1 @error: Return location for a #GError, or #None

Set the image data from an image file, and scale the image during loading. In case of failure, #false is returned and @error is set. The aspect ratio will always be maintained.

Returns: #true if the image was successfully updated

fn set_image_rotation(&self, rotation: f32)[src]

set_image_rotation: @image: A #Image @rotation: Rotation angle in degrees

Set the Image:image-rotation property.

fn set_load_async(&self, load_async: bool)[src]

set_load_async: @image: A #Image @load_async: %true to load images asynchronously

Sets whether to load images asynchronously. Asynchronous image loading requires thread support (see g_thread_init()).

When using asynchronous image loading, all image-loading functions will return immediately as successful. The #Image::image-loaded and #Image::image-load-error signals are used to signal success or failure of asynchronous image loading.

fn set_scale_height_threshold(&self, pixels: u32)[src]

set_scale_height_threshold: @image: A #Image @pixels: Number of pixels

Sets the threshold used to determine whether to scale the height of the image. If a specific height is requested, the image height is allowed to differ by this amount before scaling is employed.

This can be useful to avoid excessive CPU usage when the image differs only slightly to the desired size.

fn set_scale_mode(&self, mode: ImageScaleMode)[src]

set_scale_mode: @image: An #Image @mode: The #ImageScaleMode to set

Set the scale mode on @Image

fn set_scale_width_threshold(&self, pixels: u32)[src]

set_scale_width_threshold: @image: A #Image @pixels: Number of pixels

Sets the threshold used to determine whether to scale the width of the image. If a specific width is requested, the image width is allowed to differ by this amount before scaling is employed.

This can be useful to avoid excessive CPU usage when the image differs only slightly to the desired size.

fn set_transition_duration(&self, duration: u32)[src]

set_transition_duration: @image: A #Image @duration: Transition duration in milliseconds

Set the Image:transition-duration property.

Loading content...