dear-imgui-1.3.0: Haskell bindings for Dear ImGui.
Safe HaskellNone
LanguageHaskell2010

DearImGui.Raw.DrawList

Description

Draw command list

This is the low-level list of polygons that ImGui functions are filling.

At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.

Each dear imgui window contains its own ImDrawList.

You can use getWindowDrawList to access the current window draw list and draw custom primitives.

You can interleave normal ImGui calls and adding primitives to the current draw list.

In single viewport mode, top-left is == GetMainViewport()->Pos (generally 0,0), bottom-right is == GetMainViewport()->Pos+Size (generally io.DisplaySize).

You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!).

Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui functions), if you use this API a lot consider coarse culling your drawn objects.

Synopsis

Documentation

newtype DrawList Source #

A single draw command list. Generally one per window, conceptually you may see this as a dynamic "mesh" builder.

Constructors

DrawList (Ptr ImDrawList) 

destroy :: MonadIO m => DrawList -> m () Source #

Primitives

  • For rectangular primitives, p_min and p_max represent the upper-left and lower-right corners.
  • For circle primitives, use num_segments == 0 to automatically calculate tessellation (preferred). In older versions (until Dear ImGui 1.77) the addCircle functions defaulted to num_segments == 12. In future versions we will use textures to provide cheaper and higher-quality circles. Use addNgon and addNgonFilled functions if you need to guaranteed a specific number of sides.

addCircle :: MonadIO m => DrawList -> Ptr ImVec2 -> CFloat -> ImU32 -> CInt -> CFloat -> m () Source #

addNgon :: MonadIO m => DrawList -> Ptr ImVec2 -> CFloat -> ImU32 -> CInt -> CFloat -> m () Source #

Image primitives

  • Read FAQ to understand what ImTextureID is.
  • p_min and p_max represent the upper-left and lower-right corners of the rectangle.
  • uv_min and uv_max represent the normalized texture coordinates to use for those corners. Using (0,0)->(1,1) texture coordinates will generally display the entire texture.

addImage :: MonadIO m => DrawList -> Ptr () -> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec2 -> Ptr ImVec2 -> ImU32 -> m () Source #

Stateful path API

Add points then finish with pathFillConvex or pathStroke.

pathFillConvex :: MonadIO m => DrawList -> ImU32 -> m () Source #

Note: Anti-aliased filling requires points to be in clockwise order.

pathArcToFast :: MonadIO m => DrawList -> Ptr ImVec2 -> CFloat -> CInt -> CInt -> m () Source #

Use precomputed angles for a 12 steps circle.

Advanced

addDrawCmd :: MonadIO m => DrawList -> m () Source #

This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible.

cloneOutput :: MonadIO m => DrawList -> m DrawList Source #

Create a clone of the CmdBufferIdxBufferVtxBuffer.

Internal state

pushTextureID :: MonadIO m => DrawList -> Ptr () -> m () Source #