mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[solver] Improve brace rendering
This commit is contained in:
@@ -59,8 +59,58 @@ void EquationListView::layoutSubviews() {
|
||||
|
||||
/* EquationListView::BraceWidth */
|
||||
|
||||
constexpr KDCoordinate braceExtremumHeight = 6;
|
||||
constexpr KDCoordinate braceExtremumWidth = 10;
|
||||
constexpr KDCoordinate braceCenterHeight = 15;
|
||||
constexpr KDCoordinate braceCenterWidth = 4;
|
||||
|
||||
const uint8_t topBrace[braceExtremumHeight][braceExtremumWidth] = {
|
||||
{0xFF, 0xFF, 0xF7, 0x25, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xFF, 0x7B, 0x02, 0x90, 0xC4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x92, 0x18, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x3D, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
};
|
||||
|
||||
const uint8_t middleBrace[braceCenterHeight][braceCenterWidth] = {
|
||||
{0xFF, 0xFF, 0xFF, 0x00},
|
||||
{0xFF, 0xFF, 0xD7, 0x29},
|
||||
{0xFF, 0xFF, 0xB9, 0x33},
|
||||
{0xFF, 0xFF, 0x7B, 0x76},
|
||||
{0xFF, 0xFF, 0x2C, 0xC3},
|
||||
{0xFF, 0xAA, 0x44, 0xFF},
|
||||
{0xFF, 0x38, 0xAB, 0xFF},
|
||||
{0x00, 0x00, 0xFF, 0xFF},
|
||||
{0xFF, 0x38, 0xAB, 0xFF},
|
||||
{0xFF, 0xAA, 0x44, 0xFF},
|
||||
{0xFF, 0xFF, 0x2C, 0xC3},
|
||||
{0xFF, 0xFF, 0x7B, 0x76},
|
||||
{0xFF, 0xFF, 0xB9, 0x33},
|
||||
{0xFF, 0xFF, 0xD7, 0x29},
|
||||
{0xFF, 0xFF, 0xFF, 0x00},
|
||||
};
|
||||
|
||||
const uint8_t bottomBrace[braceExtremumHeight][braceExtremumWidth] = {
|
||||
{0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x3D, 0xAC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0x92, 0x18, 0xD7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0x7B, 0x02, 0x90, 0xC4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
|
||||
{0xFF, 0xFF, 0xF7, 0x25, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
};
|
||||
|
||||
KDColor s_braceWorkingBuffer[60];
|
||||
|
||||
void EquationListView::BraceView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), KDColorRed);
|
||||
ctx->fillRect(bounds(), KDColorWhite);
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate margin = 3;
|
||||
ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), KDColorBlack, (const uint8_t *)topBrace, (KDColor *)(s_braceWorkingBuffer));
|
||||
ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), KDColorBlack, (const uint8_t *)middleBrace, (KDColor *)(s_braceWorkingBuffer));
|
||||
ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), KDColorBlack, (const uint8_t *)bottomBrace, (KDColor *)(s_braceWorkingBuffer));
|
||||
ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), KDColorBlack);
|
||||
ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), KDColorBlack);
|
||||
}
|
||||
|
||||
KDSize EquationListView::BraceView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -14,8 +14,8 @@ public:
|
||||
SelectableTableView * selectableTableView() {
|
||||
return &m_listView;
|
||||
}
|
||||
constexpr static KDCoordinate k_braceTotalWidth = 30;
|
||||
constexpr static KDCoordinate k_margin = 10;
|
||||
constexpr static KDCoordinate k_braceTotalWidth = 30;//2*k_margin+BraceView::k_braceWidth;
|
||||
void layoutSubviews() override;
|
||||
private:
|
||||
int numberOfSubviews() const override;
|
||||
|
||||
Reference in New Issue
Block a user