Numworks Epsilon  1.4.1
Graphing Calculator Operating System
sum_layout.cpp
Go to the documentation of this file.
1 #include "sum_layout.h"
2 #include <string.h>
3 #include <assert.h>
4 
5 namespace Poincare {
6 
8  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
9  {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
10  {0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
11  {0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
12  {0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
13  {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF},
14  {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF},
15  {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF},
16  {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF},
17  {0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF},
18  {0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
19  {0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
20  {0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
21  {0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},
22  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
23 };
24 
25 void SumLayout::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor) {
26  KDSize upperBoundSize = m_upperBoundLayout->size();
27  KDSize lowerBoundSize = m_lowerBoundLayout->size();
28  KDColor workingBuffer[k_symbolWidth*k_symbolHeight];
29  KDRect symbolFrame(p.x() + max(max(0, (upperBoundSize.width()-k_symbolWidth)/2), (lowerBoundSize.width()-k_symbolWidth)/2),
30  p.y() + max(upperBoundSize.height()+k_boundHeightMargin, m_argumentLayout->baseline()-(k_symbolHeight+1)/2),
32  ctx->blendRectWithMask(symbolFrame, expressionColor, (const uint8_t *)symbolPixel, (KDColor *)workingBuffer);
33 }
34 
35 }
static constexpr KDCoordinate k_symbolWidth
KDCoordinate y() const
Definition: point.h:11
constexpr KDCoordinate width() const
Definition: size.h:10
static constexpr KDCoordinate k_boundHeightMargin
void blendRectWithMask(KDRect rect, KDColor color, const uint8_t *mask, KDColor *workingBuffer)
unsigned char uint8_t
Definition: stdint.h:4
const uint8_t symbolPixel[SumLayout::k_symbolHeight][SumLayout::k_symbolWidth]
Definition: sum_layout.cpp:7
Definition: point.h:6
Definition: size.h:6
ExpressionLayout * m_lowerBoundLayout
ExpressionLayout * m_upperBoundLayout
static constexpr KDCoordinate k_symbolHeight
Definition: rect.h:26
Definition: color.h:6
KDCoordinate x() const
Definition: point.h:10
constexpr KDCoordinate height() const
Definition: size.h:11
ExpressionLayout * m_argumentLayout