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

261 lines
9 KiB
C

// dvxCursor.h — Embedded mouse cursor bitmaps for DV/X GUI
#ifndef DVX_CURSOR_H
#define DVX_CURSOR_H
#include "dvxTypes.h"
// ============================================================
// Cursor shape IDs
// ============================================================
#define CURSOR_ARROW 0
#define CURSOR_RESIZE_H 1 // left/right (horizontal)
#define CURSOR_RESIZE_V 2 // up/down (vertical)
#define CURSOR_RESIZE_DIAG_NWSE 3 // NW-SE diagonal (top-left / bottom-right)
#define CURSOR_RESIZE_DIAG_NESW 4 // NE-SW diagonal (top-right / bottom-left)
#define CURSOR_COUNT 5
// ============================================================
// Standard arrow cursor, 16x16
// ============================================================
// AND mask: 0 = draw cursor pixel, 1 = transparent
// XOR data: 0 = black, 1 = white (where AND = 0)
//
// The cursor is a left-pointing arrow with black outline and white fill.
// Hot spot is at (0, 0) — top-left corner of the arrow tip.
static const uint16_t cursorArrowAnd[16] = {
0x3FFF, // 0011111111111111 row 0
0x1FFF, // 0001111111111111 row 1
0x0FFF, // 0000111111111111 row 2
0x07FF, // 0000011111111111 row 3
0x03FF, // 0000001111111111 row 4
0x01FF, // 0000000111111111 row 5
0x00FF, // 0000000011111111 row 6
0x007F, // 0000000001111111 row 7
0x003F, // 0000000000111111 row 8
0x001F, // 0000000000011111 row 9
0x01FF, // 0000000111111111 row 10
0x10FF, // 0001000011111111 row 11
0x30FF, // 0011000011111111 row 12
0xF87F, // 1111100001111111 row 13
0xF87F, // 1111100001111111 row 14
0xFC3F // 1111110000111111 row 15
};
static const uint16_t cursorArrowXor[16] = {
0x0000, // 0000000000000000 row 0
0x4000, // 0100000000000000 row 1
0x6000, // 0110000000000000 row 2
0x7000, // 0111000000000000 row 3
0x7800, // 0111100000000000 row 4
0x7C00, // 0111110000000000 row 5
0x7E00, // 0111111000000000 row 6
0x7F00, // 0111111100000000 row 7
0x7F80, // 0111111110000000 row 8
0x7C00, // 0111110000000000 row 9
0x6C00, // 0110110000000000 row 10
0x4600, // 0100011000000000 row 11
0x0600, // 0000011000000000 row 12
0x0300, // 0000001100000000 row 13
0x0300, // 0000001100000000 row 14
0x0000 // 0000000000000000 row 15
};
// ============================================================
// Horizontal resize cursor (left/right arrows), 16x16
// ============================================================
// Hot spot at center (7, 7)
//
// <-->
// ..XX..XX..
// .X..XX..X.
// X..XXXX..X
// ..XXXXXX..
// X..XXXX..X
// .X..XX..X.
// ..XX..XX..
static const uint16_t cursorResizeHAnd[16] = {
0xFFFF, // row 0 (transparent)
0xFFFF, // row 1
0xFFFF, // row 2
0xF7EF, // 1111011111101111 row 3 arrows start
0xE3C7, // 1110001111000111 row 4
0xC1A3, // 1100000110100011 row 5
0x8081, // 1000000010000001 row 6
0x0000, // 0000000000000000 row 7 center row
0x8081, // 1000000010000001 row 8
0xC1A3, // 1100000110100011 row 9
0xE3C7, // 1110001111000111 row 10
0xF7EF, // 1111011111101111 row 11
0xFFFF, // row 12
0xFFFF, // row 13
0xFFFF, // row 14
0xFFFF // row 15
};
static const uint16_t cursorResizeHXor[16] = {
0x0000, // row 0
0x0000, // row 1
0x0000, // row 2
0x0000, // row 3
0x0810, // 0000100000010000 row 4
0x1C38, // 0001110000111000 row 5
0x3E7C, // 0011111001111100 row 6
0x7FFE, // 0111111111111110 row 7
0x3E7C, // 0011111001111100 row 8
0x1C38, // 0001110000111000 row 9
0x0810, // 0000100000010000 row 10
0x0000, // row 11
0x0000, // row 12
0x0000, // row 13
0x0000, // row 14
0x0000 // row 15
};
// ============================================================
// Vertical resize cursor (up/down arrows), 16x16
// ============================================================
// Hot spot at center (7, 7)
static const uint16_t cursorResizeVAnd[16] = {
0xFFFF, // row 0 (transparent)
0xFFFF, // row 1
0xFE7F, // 1111111001111111 row 2 top arrow
0xFC3F, // 1111110000111111 row 3
0xF81F, // 1111100000011111 row 4
0xF00F, // 1111000000001111 row 5
0xFE7F, // 1111111001111111 row 6
0xFE7F, // 1111111001111111 row 7 stem
0xFE7F, // 1111111001111111 row 8 stem
0xFE7F, // 1111111001111111 row 9
0xF00F, // 1111000000001111 row 10
0xF81F, // 1111100000011111 row 11
0xFC3F, // 1111110000111111 row 12
0xFE7F, // 1111111001111111 row 13 bottom arrow
0xFFFF, // row 14
0xFFFF // row 15
};
static const uint16_t cursorResizeVXor[16] = {
0x0000, // row 0
0x0000, // row 1
0x0100, // 0000000100000000 row 2
0x0380, // 0000001110000000 row 3
0x07C0, // 0000011111000000 row 4
0x0FE0, // 0000111111100000 row 5 full width
0x0100, // 0000000100000000 row 6 stem
0x0100, // 0000000100000000 row 7
0x0100, // 0000000100000000 row 8
0x0100, // 0000000100000000 row 9 stem
0x0FE0, // 0000111111100000 row 10 full width
0x07C0, // 0000011111000000 row 11
0x0380, // 0000001110000000 row 12
0x0100, // 0000000100000000 row 13
0x0000, // row 14
0x0000 // row 15
};
// ============================================================
// Diagonal resize cursor NW-SE (top-left / bottom-right), 16x16
// ============================================================
// Hot spot at center (7, 7)
static const uint16_t cursorResizeDiagNWSEAnd[16] = {
0xFFFF, // row 0
0xFFFF, // row 1
0xE0FF, // 1110000011111111 row 2 top-left arrow
0xE0FF, // 1110000011111111 row 3
0xE4FF, // 1110010011111111 row 4
0xECFF, // 1110110011111111 row 5
0xF4FF, // 1111010011111111 row 6
0xFCFF, // 1111110011111111 row 7
0xFF3F, // 1111111100111111 row 8
0xFF2F, // 1111111100101111 row 9
0xFF37, // 1111111100110111 row 10
0xFF27, // 1111111100100111 row 11
0xFF07, // 1111111100000111 row 12
0xFF07, // 1111111100000111 row 13 bottom-right arrow
0xFFFF, // row 14
0xFFFF // row 15
};
static const uint16_t cursorResizeDiagNWSEXor[16] = {
0x0000, // row 0
0x0000, // row 1
0x1F00, // 0001111100000000 row 2
0x0E00, // 0000111000000000 row 3
0x0E00, // 0000111000000000 row 4
0x0700, // 0000011100000000 row 5
0x0B00, // 0000101100000000 row 6
0x0100, // 0000000100000000 row 7
0x0080, // 0000000010000000 row 8
0x00D0, // 0000000011010000 row 9
0x00E0, // 0000000011100000 row 10
0x0070, // 0000000001110000 row 11
0x0070, // 0000000001110000 row 12
0x00F8, // 0000000011111000 row 13
0x0000, // row 14
0x0000 // row 15
};
// ============================================================
// Diagonal resize cursor NE-SW (top-right / bottom-left), 16x16
// ============================================================
// Hot spot at center (7, 7)
static const uint16_t cursorResizeDiagNESWAnd[16] = {
0xFFFF, // row 0
0xFFFF, // row 1
0xFF07, // 1111111100000111 row 2 top-right arrow
0xFF07, // 1111111100000111 row 3
0xFF27, // 1111111100100111 row 4
0xFF37, // 1111111100110111 row 5
0xFF2F, // 1111111100101111 row 6
0xFF3F, // 1111111100111111 row 7
0xFCFF, // 1111110011111111 row 8
0xF4FF, // 1111010011111111 row 9
0xECFF, // 1110110011111111 row 10
0xE4FF, // 1110010011111111 row 11
0xE0FF, // 1110000011111111 row 12
0xE0FF, // 1110000011111111 row 13 bottom-left arrow
0xFFFF, // row 14
0xFFFF // row 15
};
static const uint16_t cursorResizeDiagNESWXor[16] = {
0x0000, // row 0
0x0000, // row 1
0x00F8, // 0000000011111000 row 2
0x0070, // 0000000001110000 row 3
0x0070, // 0000000001110000 row 4
0x00E0, // 0000000011100000 row 5
0x00D0, // 0000000011010000 row 6
0x0080, // 0000000010000000 row 7
0x0100, // 0000000100000000 row 8
0x0B00, // 0000101100000000 row 9
0x0700, // 0000011100000000 row 10
0x0E00, // 0000111000000000 row 11
0x0E00, // 0000111000000000 row 12
0x1F00, // 0001111100000000 row 13
0x0000, // row 14
0x0000 // row 15
};
// ============================================================
// Cursor table
// ============================================================
static const CursorT dvxCursors[CURSOR_COUNT] = {
{ 16, 16, 0, 0, cursorArrowAnd, cursorArrowXor }, // CURSOR_ARROW
{ 16, 16, 7, 7, cursorResizeHAnd, cursorResizeHXor }, // CURSOR_RESIZE_H
{ 16, 16, 7, 7, cursorResizeVAnd, cursorResizeVXor }, // CURSOR_RESIZE_V
{ 16, 16, 7, 7, cursorResizeDiagNWSEAnd, cursorResizeDiagNWSEXor }, // CURSOR_RESIZE_DIAG_NWSE
{ 16, 16, 7, 7, cursorResizeDiagNESWAnd, cursorResizeDiagNESWXor }, // CURSOR_RESIZE_DIAG_NESW
};
// Legacy alias for backward compatibility
static const CursorT dvxCursor = { 16, 16, 0, 0, cursorArrowAnd, cursorArrowXor };
#endif // DVX_CURSOR_H