Panel Graphics Primitives

These routines draw 2-D vector primitives: lines, line strips, line loops, filled polygons, and quad strips. Each primitive type has up to four variants:

Line-based primitives (Lines, LineStrip, LineLoop) also have a Stipple variant that draws dashed lines with a caller-specified dash length and line width.


XPLMVertex_t

struct

A 2-D vertex with an x and y position in panel coordinates.

typedef struct {
     float                     x;
     float                     y;
} XPLMVertex_t;

XPLMVertexColor_t

struct

A 2-D vertex with an x and y position in panel coordinates and a per-vertex color. Use this struct with the "c" drawing variants to assign a different color to each vertex; colors are interpolated across the primitive.

typedef struct {
     float                     x;
     float                     y;
     uint32_t                  color;
} XPLMVertexColor_t;

XPLMMakeColor

function

This function packs four floating-point color components into a single uint32_t suitable for use with all panel graphics drawing routines. Each component is in the range 0.0 to 1.0 and is clamped before packing. The returned value is in ABGR byte order (alpha in the high byte, red in the low byte).

XPLM_API uint32_t   XPLMMakeColor(
                         float                red,
                         float                green,
                         float                blue,
                         float                alpha
                    );

XPLMLines

function

This function draws disconnected line segments. Every pair of vertices defines one segment: the first segment runs from vertices[0] to vertices[1], the second from vertices[2] to vertices[3], and so on.

XPLM_API void       XPLMLines(
                         uint32_t             color,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMLinesWithWidth

function

This function draws disconnected line segments with a caller-specified line width. Vertex interpretation is the same as XPLMLines.

XPLM_API void       XPLMLinesWithWidth(
                         uint32_t             color,
                         float                lineWidth,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMLinesc

function

This function draws disconnected line segments with per-vertex colors. Vertex interpretation is the same as XPLMLines; colors are interpolated along each segment.

XPLM_API void       XPLMLinesc(
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );

XPLMLinescWithWidth

function

This function draws disconnected line segments with per-vertex colors and a caller-specified line width.

XPLM_API void       XPLMLinescWithWidth(
                         float                lineWidth,
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );

XPLMLinesStipple

function

This function draws disconnected dashed line segments. Vertex interpretation is the same as XPLMLines. The dash pattern alternates between drawn and undrawn segments of equal length.

XPLM_API void       XPLMLinesStipple(
                         uint32_t             color,
                         const XPLMVertex_t * pts,
                         ArraySize            count,
                         float                dashLength,
                         float                lineWidth
                    );

XPLMLineStrip

function

This function draws a connected line strip. Vertices are connected in order: a segment from vertices[0] to vertices[1], then from vertices[1] to vertices[2], and so on. The last vertex is not connected back to the first.

XPLM_API void       XPLMLineStrip(
                         uint32_t             color,
                         const XPLMVertex_t * pts,
                         ArraySize            count
                    );

XPLMLineStripWithWidth

function

This function draws a connected line strip with a caller-specified line width. Vertex interpretation is the same as XPLMLineStrip.

XPLM_API void       XPLMLineStripWithWidth(
                         uint32_t             color,
                         float                lineWidth,
                         const XPLMVertex_t * pts,
                         ArraySize            count
                    );

XPLMLineStripc

function

This function draws a connected line strip with per-vertex colors. Vertex interpretation is the same as XPLMLineStrip; colors are interpolated along each segment.

XPLM_API void       XPLMLineStripc(
                         const XPLMVertexColor_t * pts,
                         ArraySize            count
                    );

XPLMLineStripcWithWidth

function

This function draws a connected line strip with per-vertex colors and a caller-specified line width.

XPLM_API void       XPLMLineStripcWithWidth(
                         float                lineWidth,
                         const XPLMVertexColor_t * pts,
                         ArraySize            count
                    );

XPLMLineStripStipple

function

This function draws a connected dashed line strip. Vertex interpretation is the same as XPLMLineStrip. The dash pattern alternates between drawn and undrawn segments of equal length.

XPLM_API void       XPLMLineStripStipple(
                         uint32_t             color,
                         const XPLMVertex_t * pts,
                         ArraySize            count,
                         float                dashLength,
                         float                lineWidth
                    );

XPLMLineLoop

function

This function draws a closed line loop. Vertices are connected in order, and the last vertex is automatically connected back to the first, forming a closed shape. The interior is not filled.

XPLM_API void       XPLMLineLoop(
                         uint32_t             color,
                         const XPLMVertex_t * pts,
                         ArraySize            count
                    );

XPLMLineLoopWithWidth

function

This function draws a closed line loop with a caller-specified line width. Vertex interpretation is the same as XPLMLineLoop.

XPLM_API void       XPLMLineLoopWithWidth(
                         uint32_t             color,
                         float                lineWidth,
                         const XPLMVertex_t * pts,
                         ArraySize            count
                    );

XPLMLineLoopc

function

This function draws a closed line loop with per-vertex colors. Vertex interpretation is the same as XPLMLineLoop; colors are interpolated along each segment.

XPLM_API void       XPLMLineLoopc(
                         const XPLMVertexColor_t * pts,
                         ArraySize            count
                    );

XPLMLineLoopcWithWidth

function

This function draws a closed line loop with per-vertex colors and a caller-specified line width.

XPLM_API void       XPLMLineLoopcWithWidth(
                         float                lineWidth,
                         const XPLMVertexColor_t * pts,
                         ArraySize            count
                    );

XPLMLineLoopStipple

function

This function draws a closed dashed line loop. Vertex interpretation is the same as XPLMLineLoop. The dash pattern alternates between drawn and undrawn segments of equal length.

XPLM_API void       XPLMLineLoopStipple(
                         uint32_t             color,
                         const XPLMVertex_t * pts,
                         ArraySize            count,
                         float                dashLength,
                         float                lineWidth
                    );

XPLMPolygon

function

This function draws a filled convex polygon. The vertices define the outline of the polygon, and the interior is filled with the specified color.

XPLM_API void       XPLMPolygon(
                         uint32_t             color,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMPolygonWithWidth

function

This function draws a filled convex polygon with a caller-specified outline width. The interior is filled and an outline is drawn at the given width.

XPLM_API void       XPLMPolygonWithWidth(
                         uint32_t             color,
                         float                lineWidth,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMPolygonc

function

This function draws a filled convex polygon with per-vertex colors. Colors are interpolated across the polygon interior.

XPLM_API void       XPLMPolygonc(
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );

XPLMPolygoncWithWidth

function

This function draws a filled convex polygon with per-vertex colors and a caller-specified outline width.

XPLM_API void       XPLMPolygoncWithWidth(
                         float                lineWidth,
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );

XPLMQuadstrip

function

This function draws a series of connected filled quadrilaterals. Vertices are taken in pairs: the first quad is formed by vertices[0], vertices[1], vertices[2], vertices[3]; the next quad shares its leading edge with the previous one, formed by vertices[2], vertices[3], vertices[4], vertices[5]; and so on.

XPLM_API void       XPLMQuadstrip(
                         uint32_t             color,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMQuadstripWithWidth

function

This function draws a quad strip with a caller-specified outline width. Vertex interpretation is the same as XPLMQuadstrip.

XPLM_API void       XPLMQuadstripWithWidth(
                         uint32_t             color,
                         float                lineWidth,
                         const XPLMVertex_t * vertices,
                         ArraySize            count
                    );

XPLMQuadstripc

function

This function draws a quad strip with per-vertex colors. Vertex interpretation is the same as XPLMQuadstrip; colors are interpolated across each quad.

XPLM_API void       XPLMQuadstripc(
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );

XPLMQuadstripcWithWidth

function

This function draws a quad strip with per-vertex colors and a caller-specified outline width.

XPLM_API void       XPLMQuadstripcWithWidth(
                         float                lineWidth,
                         const XPLMVertexColor_t * vertices,
                         ArraySize            count
                    );