Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

imgui_tex_inspect (C++)

ImGui Tex Inspect: a texture inspector: zoom into a texture down to its pixels, read their values, and draw annotations over them.

The C++ API of ImGui Tex Inspect as it is bound to Python: the entries of the module imgui_bundle.imgui_tex_inspect, in the same order, with their C++ signatures and the headers’ comments. From the stubs: the functions excluded from the bindings, the typedefs and the macros are absent.

imgui_tex_inspect.h

INIT & SHUTDOWN

ImGuiTexInspect::Init

void Init();

ImGuiTexInspect::Shutdown

void Shutdown();

BASIC USAGE

InspectorAlphaMode (enum)

MemberValue
InspectorAlphaMode_ImGui0Alpha is transparency so you see the ImGui panel background behind image
InspectorAlphaMode_Black1Alpha is used to blend over a black background
InspectorAlphaMode_White2Alpha is used to blend over a white background
InspectorAlphaMode_CustomColor3Alpha is used to blend over a custom colour.

InspectorFlags_ (enum)

MemberValue
InspectorFlags_ShowWrap = 1 << 01 << 0Draw beyong the [0,1] uv range. What you see will depend on API
InspectorFlags_NoForceFilterNearest = 1 << 11 << 1Normally we force nearest neighbour sampling when zoomed in. Set to disable this.
InspectorFlags_NoGrid = 1 << 21 << 2By default a grid is shown at high zoom levels
InspectorFlags_NoTooltip = 1 << 31 << 3Disable tooltip on hover
InspectorFlags_FillHorizontal = 1 << 41 << 4Scale to fill available space horizontally
InspectorFlags_FillVertical = 1 << 51 << 5Scale to fill available space vertically
InspectorFlags_NoAutoReadTexture = 1 << 61 << 6By default texture data is read to CPU every frame for tooltip and annotations
InspectorFlags_FlipX = 1 << 71 << 7Horizontally flip the way the texture is displayed
InspectorFlags_FlipY = 1 << 81 << 8Vertically flip the way the texture is displayed

SizeIncludingBorder (struct)

Member
ImVec2 Size;
SizeIncludingBorder::SizeIncludingBorder
SizeIncludingBorder(ImVec2 size):Size(size);

SizeExcludingBorder (struct)

Member
ImVec2 size;
SizeExcludingBorder::SizeExcludingBorder
SizeExcludingBorder(ImVec2 size):size(size);

BeginInspectorPanel

ImGuiTexInspect::BeginInspectorPanel

bool BeginInspectorPanel(const char *name, ImTextureID, ImVec2 textureSize, InspectorFlags flags = 0);
bool BeginInspectorPanel(const char *name, ImTextureID, ImVec2 textureSize, InspectorFlags flags, SizeIncludingBorder size);
bool BeginInspectorPanel(const char *name, ImTextureID, ImVec2 textureSize, InspectorFlags flags, SizeExcludingBorder size);

ImGuiTexInspect::EndInspectorPanel

void EndInspectorPanel();

EndInspectorPanel

ImGuiTexInspect::ReleaseInspectorData

void ReleaseInspectorData(ImGuiID id);

ReleaseInspectorData

ImGuiTexInspect::CurrentInspector_SetAlphaMode

void CurrentInspector_SetAlphaMode(InspectorAlphaMode);

CurrentInspector_SetAlphaMode - see enum comments for details

ImGuiTexInspect::CurrentInspector_SetFlags

void CurrentInspector_SetFlags(InspectorFlags toSet, InspectorFlags toClear = 0);

ImGuiTexInspect::CurrentInspector_ClearFlags

inline void CurrentInspector_ClearFlags(InspectorFlags toClear);

ImGuiTexInspect::CurrentInspector_SetGridColor

void CurrentInspector_SetGridColor(ImU32 color);

ImGuiTexInspect::CurrentInspector_SetMaxAnnotations

void CurrentInspector_SetMaxAnnotations(int maxAnnotations);

ImGuiTexInspect::CurrentInspector_InvalidateTextureCache

void CurrentInspector_InvalidateTextureCache();

CurrentInspector_InvalidateTextureCache

CurrentInspector_SetCustomBackgroundColor

ImGuiTexInspect::CurrentInspector_SetCustomBackgroundColor

void CurrentInspector_SetCustomBackgroundColor(ImVec4 color);
void CurrentInspector_SetCustomBackgroundColor(ImU32 color);

ImGuiTexInspect::CurrentInspector_GetID

ImGuiID CurrentInspector_GetID();

CurrentInspector_GetID

ImGuiTexInspect::DrawColorMatrixEditor

void DrawColorMatrixEditor();

ColorMatrix editor. See comments on ColorMatrix below.

Some convenience functions for drawing ImGui controls for the current Inspector

ImGuiTexInspect::DrawGridEditor

void DrawGridEditor();

Grid editor. Enable/Disable grid. Set Grid Color.

ImGuiTexInspect::DrawColorChannelSelector

void DrawColorChannelSelector();

For toggling R,G,B channels

ImGuiTexInspect::DrawAlphaModeSelector

void DrawAlphaModeSelector();

A combo box for selecting the alpha mode

ImGuiTexInspect::SetZoomRate

void SetZoomRate(float factor);

CONTEXT-WIDE SETTINGS
/* SetZoomRate

ANNOTATION TOOLS

ImGuiTexInspect::DrawAnnotationLine

void DrawAnnotationLine(ImDrawList *drawList, ImVec2 fromTexel, ImVec2 toTexel, Transform2D texelsToPixels, ImU32 color);

DrawAnnotationLine

ValueText (struct)

ValueText

ValueText::Format (enum)
MemberValue
HexString0E.g. #EF97B9FF
BytesHex1E.g. R:#EF G:#97 B:#B9 A:#FF (split over 4 lines)
BytesDec2E.g. R:239 G: 151 B:185 A:255 (split over 4 lines)
Floats3E.g. 0.937 0.592 0.725 1.000 (split over 4 lines)
ValueText::ValueText
ValueText(Format format = HexString);
ValueText::DrawAnnotation
void DrawAnnotation(ImDrawList *drawList, ImVec2 texel, Transform2D texelsToPixels, ImVec4 value);

Arrow (struct)

Arrow

Member
int VectorIndex_x;
int VectorIndex_y;
ImVec2 LineScale;
ImVec2 ZeroPoint = {0, 0};
Arrow::Preset (enum)
MemberValue
NormalMap0For normal maps. I.e. Arrow is in (R,G) channels. 128, 128 is zero point
NormalizedFloat1Arrow in (R,G) channels. 0,0 is zero point, (1,0) will draw an arrow exactly to
Arrow::Arrow
Arrow(int xVectorIndex = 0, int yVectorIndex = 1, ImVec2 lineScale = ImVec2(1, 1));

right edge of texture. (0,-1) will draw exactly to the bottom etc.

Arrow::UsePreset
Arrow &UsePreset(Preset);
Arrow::DrawAnnotation
void DrawAnnotation(ImDrawList *drawList, ImVec2 texel, Transform2D texelsToPixels, ImVec4 value);

INTERNAL

Transform2D (struct)

Member
ImVec2 Scale;
ImVec2 Translate;
Transform2D::Inverse
Transform2D Inverse() const;

Return an inverse transform such that transform.Inverse() * transform * vector == vector

imgui_tex_inspect_demo.h

Texture (struct)

Member
ImTextureID texture;
ImVec2 size;

ImGuiTexInspect::ShowDemoWindow

void ShowDemoWindow();
}