brutal/Brutal.ImGui/Generated/Structs/ImTextureRef.gen.cs
Rian Drake b578433e37 first
2026-10-15 17:10:50 +13:00

152 lines
7.9 KiB
C#

// <auto-generated/>
// Generated by Brutal.ImGui.Generator; do not edit by hand.
#nullable enable
using System.Runtime.CompilerServices;
namespace Brutal.ImGuiApi
{
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L369">imgui.h:369</see>
/// <br/><c>struct ImTextureRef</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
/// The identifier is valid even before the texture has been uploaded to the GPU/graphics system.
/// This is what gets passed to functions such as `ImGui::Image()`, `ImDrawList::AddImage()`.
/// This is what gets stored in draw commands (`ImDrawCmd`) to identify a texture during rendering.
/// - When a texture is created by user code (e.g. custom images), we directly stores the low-level ImTextureID.
/// Because of this, when displaying your own texture you are likely to ever only manage ImTextureID values on your side.
/// - When a texture is created by the backend, we stores a ImTextureData* which becomes an indirection
/// to extract the ImTextureID value during rendering, after texture upload has happened.
/// - To create a ImTextureRef from a ImTextureData you can use ImTextureData::GetTexRef().
/// We intentionally do not provide an ImTextureRef constructor for this: we don't expect this
/// to be frequently useful to the end-user, and it would be erroneously called by many legacy code.
/// - If you want to bind the current atlas when using custom rectangle, you can use io.Fonts-&gt;TexRef.
/// - Binding generators for languages such as C (which don't have constructors), should provide a helper, e.g.
/// inline ImTextureRef ImTextureRefFromID(ImTextureID tex_id) { ImTextureRef tex_ref = { ._TexData = NULL, .TexID = tex_id }; return tex_ref; }
/// In 1.92 we changed most drawing functions using ImTextureID to use ImTextureRef.
/// We intentionally do not provide an implicit ImTextureRef -&gt; ImTextureID cast operator because it is technically lossy to convert ImTextureRef to ImTextureID before rendering.
/// </code>
/// </remarks>
[StructLayout(LayoutKind.Explicit, Size = 16)]
public partial struct ImTextureRef
{
/// <summary>
/// <para>
/// A texture, generally owned by a ImFontAtlas. Will convert to ImTextureID during render loop, after
/// texture has been uploaded.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L380">imgui.h:380</see>
/// <br/><c>ImTextureData* _TexData</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Members (either are set, never both!)
/// </para>
/// </remarks>
[FieldOffset(0)]
public ImTextureDataPtr _TexData;
/// <summary>
/// <para>
/// _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally
/// provided to e.g. ImGui::Image() calls.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L381">imgui.h:381</see>
/// <br/><c>ImTextureID _TexID</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Members (either are set, never both!)
/// </para>
/// </remarks>
[FieldOffset(8)]
public ImTextureID _TexID;
}
/// <summary>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L369">imgui.h:369</see>
/// <br/><c>struct ImTextureRef</c>
/// </para>
/// </summary>
/// <remarks>
/// <code>
/// ImTextureRef = higher-level identifier for a texture. Store a ImTextureID _or_ a ImTextureData*.
/// The identifier is valid even before the texture has been uploaded to the GPU/graphics system.
/// This is what gets passed to functions such as `ImGui::Image()`, `ImDrawList::AddImage()`.
/// This is what gets stored in draw commands (`ImDrawCmd`) to identify a texture during rendering.
/// - When a texture is created by user code (e.g. custom images), we directly stores the low-level ImTextureID.
/// Because of this, when displaying your own texture you are likely to ever only manage ImTextureID values on your side.
/// - When a texture is created by the backend, we stores a ImTextureData* which becomes an indirection
/// to extract the ImTextureID value during rendering, after texture upload has happened.
/// - To create a ImTextureRef from a ImTextureData you can use ImTextureData::GetTexRef().
/// We intentionally do not provide an ImTextureRef constructor for this: we don't expect this
/// to be frequently useful to the end-user, and it would be erroneously called by many legacy code.
/// - If you want to bind the current atlas when using custom rectangle, you can use io.Fonts-&gt;TexRef.
/// - Binding generators for languages such as C (which don't have constructors), should provide a helper, e.g.
/// inline ImTextureRef ImTextureRefFromID(ImTextureID tex_id) { ImTextureRef tex_ref = { ._TexData = NULL, .TexID = tex_id }; return tex_ref; }
/// In 1.92 we changed most drawing functions using ImTextureID to use ImTextureRef.
/// We intentionally do not provide an implicit ImTextureRef -&gt; ImTextureID cast operator because it is technically lossy to convert ImTextureRef to ImTextureID before rendering.
/// </code>
/// </remarks>
public unsafe partial struct ImTextureRefPtr(ImTextureRef* ptr) : INullable
{
private ImTextureRef* _ptr = ptr;
public ImTextureRef* Ptr => _ptr;
public bool IsNull() => _ptr is null;
public static implicit operator ImTextureRefPtr(ImTextureRef* ptr) => new(ptr);
public static implicit operator ImTextureRef*(ImTextureRefPtr wrapper) => wrapper.Ptr;
/// <summary>
/// <para>
/// A texture, generally owned by a ImFontAtlas. Will convert to ImTextureID during render loop, after
/// texture has been uploaded.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L380">imgui.h:380</see>
/// <br/><c>ImTextureData* _TexData</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Members (either are set, never both!)
/// </para>
/// </remarks>
public ref ImTextureDataPtr _TexData => ref Unsafe.AsRef<ImTextureDataPtr>(&_ptr->_TexData);
/// <summary>
/// <para>
/// _OR_ Low-level backend texture identifier, if already uploaded or created by user/app. Generally
/// provided to e.g. ImGui::Image() calls.
/// </para>
/// <para>
/// C++:
/// <see href="https://github.com/RocketWerkz/imgui/blob/v1.92.2-docking-brutal/imgui.h#L381">imgui.h:381</see>
/// <br/><c>ImTextureID _TexID</c>
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// Members (either are set, never both!)
/// </para>
/// </remarks>
public ref ImTextureID _TexID => ref Unsafe.AsRef<ImTextureID>(&_ptr->_TexID);
}
}