Struct Image

Source
pub struct Image { /* private fields */ }
Expand description

core class Image inherits Resource (reference counted).

§Official documentation

See the documentation of this class in the Godot engine’s official documentation.

§Memory management

The lifetime of this object is automatically managed through reference counting.

§Feature flag

This type is behind the gdnative crate’s common feature flag.

§Class hierarchy

Image inherits methods from:

Implementations§

Source§

impl Image

Source

pub fn new() -> Self

Source

pub fn new_ref(&self) -> Self

Creates a new reference to the same reference-counted object.

Source

pub fn get_width(&self) -> i64

Source

pub fn get_height(&self) -> i64

Source

pub fn get_size(&self) -> Vector2

Source

pub fn has_mipmaps(&self) -> bool

Source

pub fn get_format(&self) -> ImageFormat

Source

pub fn get_data(&self) -> ByteArray

Source

pub fn convert(&mut self, format: i64)

Source

pub fn get_mipmap_offset(&self, mipmap: i64) -> i64

Source

pub fn resize_to_po2(&mut self, square: bool)

Source

pub fn resize(&mut self, width: i64, height: i64, interpolation: i64)

Source

pub fn shrink_x2(&mut self)

Source

pub fn expand_x2_hq2x(&mut self)

Source

pub fn crop(&mut self, width: i64, height: i64)

Source

pub fn flip_x(&mut self)

Source

pub fn flip_y(&mut self)

Source

pub fn generate_mipmaps(&mut self, renormalize: bool) -> GodotResult

Source

pub fn clear_mipmaps(&mut self)

Source

pub fn create( &mut self, width: i64, height: i64, use_mipmaps: bool, format: i64, )

Source

pub fn create_from_data( &mut self, width: i64, height: i64, use_mipmaps: bool, format: i64, data: ByteArray, )

Source

pub fn is_empty(&self) -> bool

Source

pub fn load(&mut self, path: GodotString) -> GodotResult

Source

pub fn save_png(&self, path: GodotString) -> GodotResult

Source

pub fn detect_alpha(&self) -> ImageAlphaMode

Source

pub fn is_invisible(&self) -> bool

Source

pub fn compress( &mut self, mode: i64, source: i64, lossy_quality: f64, ) -> GodotResult

Source

pub fn decompress(&mut self) -> GodotResult

Source

pub fn is_compressed(&self) -> bool

Source

pub fn fix_alpha_edges(&mut self)

Source

pub fn premultiply_alpha(&mut self)

Source

pub fn srgb_to_linear(&mut self)

Source

pub fn normalmap_to_xy(&mut self)

Source

pub fn rgbe_to_srgb(&mut self) -> Option<Image>

Source

pub fn bumpmap_to_normalmap(&mut self, bump_scale: f64)

Source

pub fn blit_rect(&mut self, src: Option<Image>, src_rect: Rect2, dst: Vector2)

Source

pub fn blit_rect_mask( &mut self, src: Option<Image>, mask: Option<Image>, src_rect: Rect2, dst: Vector2, )

Source

pub fn blend_rect(&mut self, src: Option<Image>, src_rect: Rect2, dst: Vector2)

Source

pub fn blend_rect_mask( &mut self, src: Option<Image>, mask: Option<Image>, src_rect: Rect2, dst: Vector2, )

Source

pub fn fill(&mut self, color: Color)

Source

pub fn get_used_rect(&self) -> Rect2

Source

pub fn get_rect(&self, rect: Rect2) -> Option<Image>

Source

pub fn copy_from(&mut self, src: Option<Image>)

Source

pub fn _set_data(&mut self, data: Dictionary)

Source

pub fn _get_data(&self) -> Dictionary

Source

pub fn lock(&mut self)

Source

pub fn unlock(&mut self)

Source

pub fn get_pixelv(&self, src: Vector2) -> Color

Source

pub fn get_pixel(&self, x: i64, y: i64) -> Color

Source

pub fn set_pixelv(&mut self, dst: Vector2, color: Color)

Source

pub fn set_pixel(&mut self, x: i64, y: i64, color: Color)

Source

pub fn load_png_from_buffer(&mut self, buffer: ByteArray) -> GodotResult

Source

pub fn load_jpg_from_buffer(&mut self, buffer: ByteArray) -> GodotResult

Source

pub fn load_webp_from_buffer(&mut self, buffer: ByteArray) -> GodotResult

Source

pub fn _setup_local_to_scene(&mut self)

Inherited from Resource.

Source

pub fn set_path(&mut self, path: GodotString)

Inherited from Resource.

Source

pub fn take_over_path(&mut self, path: GodotString)

Inherited from Resource.

Source

pub fn get_path(&self) -> GodotString

Inherited from Resource.

Source

pub fn set_name(&mut self, name: GodotString)

Inherited from Resource.

Source

pub fn get_name(&self) -> GodotString

Inherited from Resource.

Source

pub fn get_rid(&self) -> Rid

Inherited from Resource.

Source

pub fn set_local_to_scene(&mut self, enable: bool)

Inherited from Resource.

Source

pub fn is_local_to_scene(&self) -> bool

Inherited from Resource.

Source

pub fn get_local_scene(&self) -> Option<Node>

Inherited from Resource.

Source

pub fn setup_local_to_scene(&mut self)

Inherited from Resource.

Source

pub fn duplicate(&self, subresources: bool) -> Option<Resource>

Inherited from Resource.

Source

pub fn init_ref(&mut self) -> bool

Inherited from Reference.

Source

pub fn _notification(&mut self, what: i64)

Inherited from Object.

Source

pub fn _set(&mut self, property: GodotString, value: Variant) -> bool

Inherited from Object.

Source

pub fn _get(&mut self, property: GodotString) -> Variant

Inherited from Object.

Source

pub fn _get_property_list(&mut self) -> VariantArray

Inherited from Object.

Source

pub fn _init(&mut self)

Inherited from Object.

Source

pub fn get_class(&self) -> GodotString

Inherited from Object.

Source

pub fn is_class(&self, _type: GodotString) -> bool

Inherited from Object.

Source

pub fn set(&mut self, property: GodotString, value: Variant)

Inherited from Object.

Source

pub fn get(&self, property: GodotString) -> Variant

Inherited from Object.

Source

pub fn set_indexed(&mut self, property: NodePath, value: Variant)

Inherited from Object.

Source

pub fn get_indexed(&self, property: NodePath) -> Variant

Inherited from Object.

Source

pub fn get_property_list(&self) -> VariantArray

Inherited from Object.

Source

pub fn get_method_list(&self) -> VariantArray

Inherited from Object.

Source

pub fn notification(&mut self, what: i64, reversed: bool)

Inherited from Object.

Source

pub fn get_instance_id(&self) -> i64

Inherited from Object.

Source

pub fn set_script(&mut self, script: Option<Reference>)

Inherited from Object.

Source

pub fn get_script(&self) -> Option<Reference>

Inherited from Object.

Source

pub fn set_meta(&mut self, name: GodotString, value: Variant)

Inherited from Object.

Source

pub fn get_meta(&self, name: GodotString) -> Variant

Inherited from Object.

Source

pub fn has_meta(&self, name: GodotString) -> bool

Inherited from Object.

Source

pub fn get_meta_list(&self) -> StringArray

Inherited from Object.

Source

pub fn add_user_signal(&mut self, signal: GodotString, arguments: VariantArray)

Inherited from Object.

Source

pub fn has_user_signal(&self, signal: GodotString) -> bool

Inherited from Object.

Source

pub fn emit_signal( &mut self, signal: GodotString, varargs: &[Variant], ) -> Variant

Inherited from Object.

Source

pub fn call(&mut self, method: GodotString, varargs: &[Variant]) -> Variant

Inherited from Object.

Source

pub fn call_deferred( &mut self, method: GodotString, varargs: &[Variant], ) -> Variant

Inherited from Object.

Source

pub fn callv(&mut self, method: GodotString, arg_array: VariantArray) -> Variant

Inherited from Object.

Source

pub fn has_method(&self, method: GodotString) -> bool

Inherited from Object.

Source

pub fn get_signal_list(&self) -> VariantArray

Inherited from Object.

Source

pub fn get_signal_connection_list(&self, signal: GodotString) -> VariantArray

Inherited from Object.

Source

pub fn get_incoming_connections(&self) -> VariantArray

Inherited from Object.

Source

pub fn connect( &mut self, signal: GodotString, target: Option<Object>, method: GodotString, binds: VariantArray, flags: i64, ) -> GodotResult

Inherited from Object.

Source

pub fn disconnect( &mut self, signal: GodotString, target: Option<Object>, method: GodotString, )

Inherited from Object.

Source

pub fn is_connected( &self, signal: GodotString, target: Option<Object>, method: GodotString, ) -> bool

Inherited from Object.

Source

pub fn set_block_signals(&mut self, enable: bool)

Inherited from Object.

Source

pub fn is_blocking_signals(&self) -> bool

Inherited from Object.

Source

pub fn property_list_changed_notify(&mut self)

Inherited from Object.

Source

pub fn set_message_translation(&mut self, enable: bool)

Inherited from Object.

Source

pub fn can_translate_messages(&self) -> bool

Inherited from Object.

Source

pub fn tr(&self, message: GodotString) -> GodotString

Inherited from Object.

Source

pub fn is_queued_for_deletion(&self) -> bool

Inherited from Object.

Source

pub fn to_resource(&self) -> Resource

Up-cast.

Source

pub fn to_reference(&self) -> Reference

Up-cast.

Source

pub fn to_object(&self) -> Object

Up-cast.

Source

pub fn cast<T: GodotObject>(&self) -> Option<T>

Generic dynamic cast.

Trait Implementations§

Source§

impl Debug for Image

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for Image

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl GodotObject for Image

Source§

fn class_name() -> &'static str

Source§

impl ToVariant for Image

Source§

fn to_variant(&self) -> Variant

Source§

fn from_variant(variant: &Variant) -> Option<Self>

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl !Send for Image

§

impl !Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.