#include #include const uint8_t MediumDotMask[ToggleableDotView::k_dotSize][ToggleableDotView::k_dotSize] = { {0xFF, 0xDB, 0x53, 0x0F, 0x0F, 0x53, 0xDB, 0xFF}, {0xD8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0xD8}, {0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53}, {0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C}, {0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C}, {0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53}, {0xD7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0xD7}, {0xFF, 0xD8, 0x53, 0x0C, 0x0C, 0x53, 0xD8, 0xFF}, }; const uint8_t MediumShallowDotMask[ToggleableDotView::k_dotSize][ToggleableDotView::k_dotSize] = { {0xFF, 0xDB, 0x53, 0x0F, 0x0F, 0x53, 0xDB, 0xFF}, {0xD8, 0x17, 0x90, 0xEC, 0xEC, 0x90, 0x17, 0xD8}, {0x53, 0x90, 0xFF, 0xFF, 0xFF, 0xFF, 0x88, 0x53}, {0x0F, 0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0x0C}, {0x0F, 0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xEC, 0x0C}, {0x53, 0x90, 0xFF, 0xFF, 0xFF, 0xFF, 0x88, 0x53}, {0xD7, 0x17, 0x90, 0xEF, 0xEF, 0x90, 0x17, 0xD7}, {0xFF, 0xD8, 0x53, 0x0C, 0x0C, 0x53, 0xD8, 0xFF}, }; void ToggleableDotView::drawRect(KDContext * ctx, KDRect rect) const { /* Draw the view aligned on the right of the view and vertically centered * The heightCenter is the coordinate of the vertical middle of the view. That * way, (heightCenter-halfHeight) indicates the top of the StateView. */ KDCoordinate width = bounds().width(); KDCoordinate heightCenter = bounds().height() / 2; KDCoordinate halfHeight = k_dotSize / 2; KDColor workingBuffer[k_dotSize * k_dotSize]; KDRect frame(width - k_dotSize, heightCenter - halfHeight, k_dotSize, k_dotSize); ctx->blendRectWithMask( frame, m_state ? Palette::Control : Palette::GrayDark, m_state ? reinterpret_cast(MediumDotMask) : reinterpret_cast(MediumShallowDotMask), workingBuffer); }