Numworks Epsilon  1.4.1
Graphing Calculator Operating System
round_cursor_view.cpp
Go to the documentation of this file.
1 #include "round_cursor_view.h"
2 
3 namespace Shared {
4 
6  m_color(color)
7 {
8 }
9 
10 static constexpr KDCoordinate cursorSize = 10;
11 static const uint8_t cursorMask[cursorSize][cursorSize] = {
12  {0xFF, 0xFF, 0xFF, 0xED, 0xB6, 0xB6, 0xED, 0xFF, 0xFF, 0xFF},
13  {0xFF, 0xFF, 0x7C, 0x06, 0x00, 0x00, 0x06, 0x7C, 0xFF, 0xFF},
14  {0xFF, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xFF},
15  {0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5},
16  {0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB6},
17  {0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB6},
18  {0xED, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE5},
19  {0xFF, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xFF},
20  {0xFF, 0xFF, 0x7C, 0x06, 0x00, 0x00, 0x06, 0x7C, 0xFF, 0xFF},
21  {0xFF, 0xFF, 0xFF, 0xED, 0xB6, 0xB6, 0xED, 0xFF, 0xFF, 0xFF},
22 };
23 
24 static KDColor s_cursorWorkingBuffer[cursorSize*cursorSize];
25 
26 void RoundCursorView::drawRect(KDContext * ctx, KDRect rect) const {
27  ctx->blendRectWithMask(bounds(), m_color, (const uint8_t *)cursorMask, s_cursorWorkingBuffer);
28 }
29 
31  return KDSize(cursorSize, cursorSize);
32 }
33 
35  m_color = color;
37 }
38 
39 }
KDSize minimalSizeForOptimalDisplay() const override
int16_t KDCoordinate
Definition: coordinate.h:6
void setColor(KDColor color)
void markRectAsDirty(KDRect rect)
Definition: view.cpp:39
void blendRectWithMask(KDRect rect, KDColor color, const uint8_t *mask, KDColor *workingBuffer)
unsigned char uint8_t
Definition: stdint.h:4
RoundCursorView(KDColor color=KDColorBlack)
Definition: size.h:6
void drawRect(KDContext *ctx, KDRect rect) const override
Definition: rect.h:26
Definition: color.h:6
KDRect bounds() const
Definition: view.cpp:157