pub struct TextureRef(/* private fields */);Expand description
A convenient, typed wrapper around ImGui’s ImTextureRef (v1.92+)
Can reference either a plain TextureId (legacy path) or a managed TextureData.
Examples
- With a plain GPU handle (legacy path):
let tex_id = TextureId::new(12345);
ui.image(tex_id, [64.0, 64.0]);- With a managed texture (ImGui 1.92 texture system):
let mut tex = TextureData::new();
tex.create(TextureFormat::RGBA32, 256, 256);
// Fill pixels or schedule updates...
ui.image(&mut *tex, [256.0, 256.0]);
// The renderer backend will honor WantCreate/WantUpdates/WantDestroy
// via DrawData::textures() when rendering this frame.Implementations§
Source§impl TextureRef
impl TextureRef
Sourcepub fn from_raw(raw: ImTextureRef) -> Self
pub fn from_raw(raw: ImTextureRef) -> Self
Create a texture reference from a raw ImGui texture ref
Sourcepub fn raw(self) -> ImTextureRef
pub fn raw(self) -> ImTextureRef
Get the underlying ImGui texture ref (by value)
Trait Implementations§
Source§impl Clone for TextureRef
impl Clone for TextureRef
Source§fn clone(&self) -> TextureRef
fn clone(&self) -> TextureRef
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextureRef
impl Debug for TextureRef
Source§impl From<&TextureData> for TextureRef
impl From<&TextureData> for TextureRef
Source§fn from(td: &TextureData) -> Self
fn from(td: &TextureData) -> Self
Converts to this type from the input type.
Source§impl From<&mut TextureData> for TextureRef
impl From<&mut TextureData> for TextureRef
Source§fn from(td: &mut TextureData) -> Self
fn from(td: &mut TextureData) -> Self
Converts to this type from the input type.
Source§impl From<TextureId> for TextureRef
impl From<TextureId> for TextureRef
Source§impl From<u64> for TextureRef
impl From<u64> for TextureRef
impl Copy for TextureRef
Auto Trait Implementations§
impl Freeze for TextureRef
impl RefUnwindSafe for TextureRef
impl !Send for TextureRef
impl !Sync for TextureRef
impl Unpin for TextureRef
impl UnwindSafe for TextureRef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more