DVX_GUI/dvx/dvxDraw.h
2026-03-09 20:55:12 -05:00

46 lines
1.9 KiB
C

// 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);
// 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);
// 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