// dvx_draw.h — Layer 2: Drawing primitives for DV/X GUI #ifndef DVX_DRAW_H #define DVX_DRAW_H #include "dvxTypes.h" // Initialize blit operations based on pixel format void drawInit(BlitOpsT *ops, const DisplayT *d); // Solid color rectangle fill (clips to display clip rect) void rectFill(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color); // Copy rectangle from source buffer to backbuffer (clips to display clip rect) void rectCopy(DisplayT *d, const BlitOpsT *ops, int32_t dstX, int32_t dstY, const uint8_t *srcBuf, int32_t srcPitch, int32_t srcX, int32_t srcY, int32_t w, int32_t h); // Draw a beveled frame void drawBevel(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, const BevelStyleT *style); // Draw a single character, returns advance width int32_t drawChar(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, char ch, uint32_t fg, uint32_t bg, bool opaque); // Draw a null-terminated string void drawText(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, const char *text, uint32_t fg, uint32_t bg, bool opaque); // Measure text width in pixels int32_t textWidth(const BitmapFontT *font, const char *text); // Parse accelerator key from text with & markers (e.g. "E&xit" -> 'x') // Returns the lowercase accelerator character, or 0 if none found. char accelParse(const char *text); // Draw text with & accelerator processing (underlines the accelerator character) void drawTextAccel(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, const char *text, uint32_t fg, uint32_t bg, bool opaque); // Measure text width in pixels, skipping & markers int32_t textWidthAccel(const BitmapFontT *font, const char *text); // Draw a 1-bit bitmap with mask (for cursors, icons) // andMask/xorData are arrays of uint16_t, one per row void drawMaskedBitmap(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, const uint16_t *andMask, const uint16_t *xorData, uint32_t fgColor, uint32_t bgColor); // Draw a row of terminal character cells (ch/attr pairs with a 16-color palette). // Renders 'cols' cells starting at (x,y). Much faster than calling drawChar per cell. // cursorCol: column index to draw inverted (cursor), or -1 for no cursor. void drawTermRow(DisplayT *d, const BlitOpsT *ops, const BitmapFontT *font, int32_t x, int32_t y, int32_t cols, const uint8_t *lineData, const uint32_t *palette, bool blinkVisible, int32_t cursorCol); // Dotted focus rectangle (every other pixel) void drawFocusRect(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color); // Horizontal line void drawHLine(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t w, uint32_t color); // Vertical line void drawVLine(DisplayT *d, const BlitOpsT *ops, int32_t x, int32_t y, int32_t h, uint32_t color); #endif // DVX_DRAW_H