Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_draw.c
Go to the documentation of this file.
1
8/*********************
9 * INCLUDES
10 *********************/
11#include <string.h>
12#include "nbgl_front.h"
13#include "nbgl_draw.h"
14#include "nbgl_debug.h"
15#include "nbgl_side.h"
16#ifdef NBGL_QRCODE
17#include "qrcodegen.h"
18#endif // NBGL_QRCODE
19#include "glyphs.h"
20#include "os_pic.h"
21#include "os_utils.h"
22#include "os_helpers.h"
23
24/*********************
25 * DEFINES
26 *********************/
27#ifdef SCREEN_SIZE_WALLET
28typedef enum {
32#else // SCREEN_SIZE_WALLET
33typedef enum {
34 BAGL_FILL_CIRCLE_0_PI2,
35 BAGL_FILL_CIRCLE_PI2_PI,
36 BAGL_FILL_CIRCLE_PI_3PI2,
37 BAGL_FILL_CIRCLE_3PI2_2PI
38} quarter_t;
39#endif // SCREEN_SIZE_WALLET
40
41#define QR_PIXEL_WIDTH_HEIGHT 4
42
43/**********************
44 * TYPEDEFS
45 **********************/
46#ifdef NBGL_QRCODE
47typedef struct {
48 uint8_t qrcode[qrcodegen_BUFFER_LEN_MAX];
49 uint8_t tempBuffer[qrcodegen_BUFFER_LEN_MAX];
52
53#define qrcode ((QrCodeBuffer_t *) ramBuffer)->qrcode
54#define tempBuffer ((QrCodeBuffer_t *) ramBuffer)->tempBuffer
55#define QrDrawBuffer ((QrCodeBuffer_t *) ramBuffer)->QrDrawBuffer
56#endif // NBGL_QRCODE
57
58// icons to be used to draw circles or discs for a given radius
59#ifdef SCREEN_SIZE_WALLET
64#else // SCREEN_SIZE_WALLET
65typedef struct {
66 const uint8_t *topLeftDisc;
67 const uint8_t *bottomLeftDisc;
68 const uint8_t *topLeftCircle;
69 const uint8_t *bottomLeftCircle;
71#endif // SCREEN_SIZE_WALLET
72
73/****************
74 * STRUCTURES
75 ****************/
76
77/**********************
78 * STATIC PROTOTYPES
79 **********************/
80
81/**********************
82 * STATIC VARIABLES
83 **********************/
84#ifndef SCREEN_SIZE_WALLET
85static const uint8_t quarter_disc_3px_1bpp[] = {0xEC, 0xFF};
86static const uint8_t quarter_disc_3px_90_1bpp[] = {0x2F, 0xFF};
87static const uint8_t quarter_disc_3px_180_1bpp[] = {0x9B, 0xFF};
88static const uint8_t quarter_disc_3px_270_1bpp[] = {0xFA, 0x00};
89
90static const uint8_t quarter_circle_3px_1bpp[] = {0x4C, 0x00};
91static const uint8_t quarter_circle_3px_90_1bpp[] = {0x0D, 0x00};
92static const uint8_t quarter_circle_3px_180_1bpp[] = {0x19, 0x00};
93static const uint8_t quarter_circle_3px_270_1bpp[] = {0x58, 0x00};
94#endif // SCREEN_SIZE_WALLET
95
96// indexed by nbgl_radius_t (except RADIUS_0_PIXELS)
97static const uint8_t radiusValues[RADIUS_MAX + 1] = {
98#ifdef SCREEN_SIZE_WALLET
99 20,
100 28,
101 32,
102 40,
103 44
104#else // SCREEN_SIZE_WALLET
105 1,
106 3
107#endif // SCREEN_SIZE_WALLET
108};
109
110#ifdef SCREEN_SIZE_WALLET
111
112#if COMMON_RADIUS == 28
113static const radiusIcons_t radiusIcons28px
114 = {&C_half_disc_left_56px_1bpp, &C_half_circle_left_56px_1bpp};
115#elif COMMON_RADIUS == 40
116static const radiusIcons_t radiusIcons40px
117 = {&C_half_disc_left_80px_1bpp, &C_half_circle_left_80px_1bpp};
118#elif COMMON_RADIUS == 44
119static const radiusIcons_t radiusIcons44px
120 = {&C_half_disc_left_88px_1bpp, &C_half_circle_left_88px_1bpp};
121#endif
122#if SMALL_BUTTON_RADIUS == 20
123static const radiusIcons_t radiusIcons20px
124 = {&C_half_disc_left_40px_1bpp, &C_half_circle_left_40px_1bpp};
125#elif SMALL_BUTTON_RADIUS == 32
126static const radiusIcons_t radiusIcons32px
127 = {&C_half_disc_left_64px_1bpp, &C_half_circle_left_64px_1bpp};
128#endif
129
130// indexed by nbgl_radius_t (except RADIUS_0_PIXELS)
131static const radiusIcons_t *radiusIcons[RADIUS_MAX + 1] = {
132#if SMALL_BUTTON_RADIUS == 20
133 &radiusIcons20px,
134#else
135 NULL,
136#endif
137#if COMMON_RADIUS == 28
138 &radiusIcons28px,
139#else
140 NULL,
141#endif
142#if SMALL_BUTTON_RADIUS == 32
143 &radiusIcons32px,
144#else
145 NULL,
146#endif
147#if COMMON_RADIUS == 40
148 &radiusIcons40px,
149#else
150 NULL,
151#endif
152#if COMMON_RADIUS == 44
153 &radiusIcons44px
154#else
155 NULL
156#endif // COMMON_RADIUS
157};
158#endif // SCREEN_SIZE_WALLET
159
160#ifdef NBGL_QRCODE
161// ensure that the ramBuffer also used for image file decompression is big enough for QR code
163#endif // NBGL_QRCODE
164
165/**********************
166 * VARIABLES
167 **********************/
168
169/**********************
170 * STATIC PROTOTYPES
171 **********************/
172
173#ifdef SCREEN_SIZE_WALLET
174static void draw_circle_helper(int x0,
175 int y0,
176 nbgl_radius_t radiusIndex,
177 half_t half,
178 color_t borderColor,
179 color_t innerColor,
180 color_t backgroundColor)
181{
182 const nbgl_icon_details_t *half_icon = NULL;
183 nbgl_area_t area = {.bpp = NBGL_BPP_1, .backgroundColor = backgroundColor};
184
185 // radius is not supported
186 if (radiusIndex > RADIUS_MAX) {
187 return;
188 }
189 if (borderColor == innerColor) {
190 half_icon = PIC(radiusIcons[radiusIndex]->leftDisc);
191 }
192 else {
193#if NB_COLOR_BITS == 1
194 borderColor = BLACK;
195#endif
196 half_icon = PIC(radiusIcons[radiusIndex]->leftCircle);
197 }
198 area.width = half_icon->width;
199 area.height = half_icon->height;
200 switch (half) {
201 case LEFT_HALF: // left
202 area.x0 = x0;
203 area.y0 = y0;
204 nbgl_frontDrawImage(&area, half_icon->bitmap, NO_TRANSFORMATION, borderColor);
205 break;
206 case RIGHT_HALF: // right
207 area.x0 = x0 - half_icon->width;
208 area.y0 = y0;
209 nbgl_frontDrawImage(&area, half_icon->bitmap, VERTICAL_MIRROR, borderColor);
210 break;
211 }
212}
213#else // SCREEN_SIZE_WALLET
214static void draw_circle_helper(int x_center,
215 int y_center,
216 nbgl_radius_t radiusIndex,
217 quarter_t quarter,
218 color_t borderColor,
219 color_t innerColor,
220 color_t backgroundColor)
221{
222 const uint8_t *quarter_buffer = NULL;
223 nbgl_area_t area = {.bpp = NBGL_BPP_1, .backgroundColor = backgroundColor};
224
225 // radius is not supported
226 if (radiusIndex > RADIUS_MAX) {
227 return;
228 }
229 area.width = area.height = radiusValues[radiusIndex];
230 switch (quarter) {
231 case BAGL_FILL_CIRCLE_3PI2_2PI: // bottom right
232 area.x0 = x_center;
233 area.y0 = y_center;
234 quarter_buffer = (borderColor == innerColor) ? quarter_disc_3px_180_1bpp
235 : quarter_circle_3px_180_1bpp;
236 break;
237 case BAGL_FILL_CIRCLE_PI_3PI2: // bottom left
238 area.x0 = x_center - area.width;
239 area.y0 = y_center;
240 quarter_buffer = (borderColor == innerColor) ? quarter_disc_3px_270_1bpp
241 : quarter_circle_3px_270_1bpp;
242 break;
243 case BAGL_FILL_CIRCLE_0_PI2: // top right
244 area.x0 = x_center;
245 area.y0 = y_center - area.width;
246 quarter_buffer = (borderColor == innerColor) ? quarter_disc_3px_90_1bpp
247 : quarter_circle_3px_90_1bpp;
248 break;
249 case BAGL_FILL_CIRCLE_PI2_PI: // top left
250 area.x0 = x_center - area.width;
251 area.y0 = y_center - area.width;
252 quarter_buffer
253 = (borderColor == innerColor) ? quarter_disc_3px_1bpp : quarter_circle_3px_1bpp;
254 break;
255 }
256 nbgl_frontDrawImage(&area, quarter_buffer, NO_TRANSFORMATION, borderColor);
257}
258#endif // SCREEN_SIZE_WALLET
259
260/**********************
261 * GLOBAL FUNCTIONS
262 **********************/
263
273void nbgl_drawRoundedRect(const nbgl_area_t *area, nbgl_radius_t radiusIndex, color_t innerColor)
274{
275 nbgl_area_t rectArea;
276 uint8_t radius;
277
279 "nbgl_drawRoundedRect x0 = %d, y0 = %d, width =%d, height =%d\n",
280 area->x0,
281 area->y0,
282 area->width,
283 area->height);
284
285 if (radiusIndex <= RADIUS_MAX) {
286 radius = radiusValues[radiusIndex];
287 }
288 else if (radiusIndex == RADIUS_0_PIXELS) {
289 radius = 0;
290 }
291 else {
292 // radius not supported
293 LOG_WARN(DRAW_LOGGER, "nbgl_drawRoundedRect forbidden radius index =%d\n", radiusIndex);
294 return;
295 }
296
297 // Draw full rectangle
298 rectArea.x0 = area->x0;
299 rectArea.y0 = area->y0;
300 rectArea.width = area->width;
301 rectArea.height = area->height;
302 rectArea.backgroundColor = innerColor;
303 nbgl_frontDrawRect(&rectArea);
304 // special case when radius is null, just draw a rectangle
305 if (radiusIndex == RADIUS_0_PIXELS) {
306 return;
307 }
308
309#ifdef SCREEN_SIZE_WALLET
310 UNUSED(radius);
311 // Draw 2 halves of disc
312 draw_circle_helper(area->x0,
313 area->y0,
314 radiusIndex,
315 LEFT_HALF,
316 innerColor, // unused
317 innerColor,
318 area->backgroundColor);
319 draw_circle_helper(area->x0 + area->width,
320 area->y0,
321 radiusIndex,
323 innerColor, // unused
324 innerColor,
325 area->backgroundColor);
326#else // SCREEN_SIZE_WALLET
327 if (radiusIndex == RADIUS_1_PIXEL) {
328 return;
329 }
330 // Draw 4 quarters of disc
331 draw_circle_helper(area->x0 + radius,
332 area->y0 + radius,
333 radiusIndex,
334 BAGL_FILL_CIRCLE_PI2_PI,
335 innerColor, // unused
336 innerColor,
337 area->backgroundColor);
338 draw_circle_helper(area->x0 + area->width - radius,
339 area->y0 + radius,
340 radiusIndex,
341 BAGL_FILL_CIRCLE_0_PI2,
342 innerColor, // unused
343 innerColor,
344 area->backgroundColor);
345 draw_circle_helper(area->x0 + radius,
346 area->y0 + area->height - radius,
347 radiusIndex,
348 BAGL_FILL_CIRCLE_PI_3PI2,
349 innerColor, // unused
350 innerColor,
351 area->backgroundColor);
352 draw_circle_helper(area->x0 + area->width - radius,
353 area->y0 + area->height - radius,
354 radiusIndex,
355 BAGL_FILL_CIRCLE_3PI2_2PI,
356 innerColor, // unused
357 innerColor,
358 area->backgroundColor);
359#endif // SCREEN_SIZE_WALLET
360}
361
373 nbgl_radius_t radiusIndex,
374 uint8_t stroke,
375 color_t innerColor,
376 color_t borderColor)
377{
378 uint8_t radius;
379 nbgl_area_t rectArea;
380
381 LOG_DEBUG(
383 "nbgl_drawRoundedBorderedRect: innerColor = %d, borderColor = %d, backgroundColor=%d\n",
384 innerColor,
385 borderColor,
386 area->backgroundColor);
387
388 if (radiusIndex <= RADIUS_MAX) {
389 radius = radiusValues[radiusIndex];
390 }
391 else if (radiusIndex == RADIUS_0_PIXELS) {
392 radius = 0;
393 }
394 else {
395 // radius not supported
396 LOG_WARN(
397 DRAW_LOGGER, "nbgl_drawRoundedBorderedRect forbidden radius index =%d\n", radiusIndex);
398 return;
399 }
400 rectArea.backgroundColor = innerColor;
401
402 // Draw 1 rectangle in inner rectangle
403 rectArea.x0 = area->x0;
404 rectArea.y0 = area->y0;
405 rectArea.width = area->width;
406 rectArea.height = area->height;
407 nbgl_frontDrawRect(&rectArea);
408 // special case, when border_color == inner_color == background_color, return
409 if ((innerColor == borderColor) && (borderColor == area->backgroundColor)) {
410 return;
411 }
412 // border
413 // 4 rectangles (with last pixel of each corner not set)
414#ifdef SCREEN_SIZE_WALLET
415 uint16_t circle_width = 0;
416 if (radiusIndex <= RADIUS_MAX) {
417 const nbgl_icon_details_t *half_icon = PIC(radiusIcons[radiusIndex]->leftDisc);
418 circle_width = half_icon->width;
419 }
420 if ((2 * circle_width) < area->width) {
421 if ((area->height - stroke) > VERTICAL_ALIGNMENT) {
422 // draw the 2 horizontal lines
423 rectArea.height = stroke;
424 rectArea.width = area->width - 2 * circle_width;
425 rectArea.x0 += circle_width;
426 nbgl_frontDrawLine(&rectArea, 1, borderColor); // top
427 rectArea.y0 = area->y0 + area->height - stroke;
428 nbgl_frontDrawLine(&rectArea, 1, borderColor); // bottom
429 }
430 else {
431 uint8_t pattern = 0;
432 uint32_t i;
433 for (i = 0; i < stroke; i++) {
434 pattern |= 1 << (7 - i);
435 }
436 for (i = area->height - stroke; i < area->height; i++) {
437 pattern |= 1 << (7 - i);
438 }
439 memset(ramBuffer, pattern, area->width);
440 rectArea.height = 8;
441 rectArea.bpp = NBGL_BPP_1;
442 nbgl_frontDrawImage(&rectArea, ramBuffer, NO_TRANSFORMATION, borderColor);
443 }
444 }
445 if ((2 * radius) < area->height) {
446 rectArea.x0 = area->x0;
447 rectArea.y0 = area->y0;
448 rectArea.width = stroke;
449 rectArea.height = area->height;
450 rectArea.backgroundColor = area->backgroundColor;
451 nbgl_frontDrawLine(&rectArea, 0, borderColor); // left
452 rectArea.x0 = area->x0 + area->width - stroke;
453 nbgl_frontDrawLine(&rectArea, 0, borderColor); // right
454 }
455 if (radiusIndex <= RADIUS_MAX) {
456 // Draw 4 quarters of circles
457 draw_circle_helper(area->x0,
458 area->y0,
459 radiusIndex,
460 LEFT_HALF,
461 borderColor,
462 innerColor,
463 area->backgroundColor);
464 draw_circle_helper(area->x0 + area->width,
465 area->y0,
466 radiusIndex,
468 borderColor,
469 innerColor,
470 area->backgroundColor);
471 }
472#else // SCREEN_SIZE_WALLET
473 rectArea.x0 = area->x0 + radius;
474 rectArea.y0 = area->y0;
475 rectArea.width = area->width - 2 * radius;
476 rectArea.height = stroke;
477 rectArea.backgroundColor = borderColor;
478 nbgl_frontDrawRect(&rectArea); // top
479 rectArea.y0 = area->y0 + area->height - stroke;
480 nbgl_frontDrawRect(&rectArea); // bottom
481 if ((2 * radius) < area->height) {
482 rectArea.x0 = area->x0;
483 rectArea.y0 = area->y0 + radius;
484 rectArea.width = stroke;
485 rectArea.height = area->height - 2 * radius;
486 rectArea.backgroundColor = area->backgroundColor;
487 nbgl_frontDrawLine(&rectArea, 0, borderColor); // left
488 rectArea.x0 = area->x0 + area->width - stroke;
489 nbgl_frontDrawLine(&rectArea, 0, borderColor); // right
490 }
491
492 if (radiusIndex <= RADIUS_MAX) {
493 // Draw 4 quarters of circles
494 draw_circle_helper(area->x0 + radius,
495 area->y0 + radius,
496 radiusIndex,
497 BAGL_FILL_CIRCLE_PI2_PI,
498 borderColor,
499 innerColor,
500 area->backgroundColor);
501 draw_circle_helper(area->x0 + area->width - radius,
502 area->y0 + radius,
503 radiusIndex,
504 BAGL_FILL_CIRCLE_0_PI2,
505 borderColor,
506 innerColor,
507 area->backgroundColor);
508 draw_circle_helper(area->x0 + radius,
509 area->y0 + area->height - radius,
510 radiusIndex,
511 BAGL_FILL_CIRCLE_PI_3PI2,
512 borderColor,
513 innerColor,
514 area->backgroundColor);
515 draw_circle_helper(area->x0 + area->width - radius,
516 area->y0 + area->height - radius,
517 radiusIndex,
518 BAGL_FILL_CIRCLE_3PI2_2PI,
519 borderColor,
520 innerColor,
521 area->backgroundColor);
522 }
523#endif // SCREEN_SIZE_WALLET
524}
525
539 nbgl_transformation_t transformation,
540 nbgl_color_map_t color_map,
541 const nbgl_icon_details_t *icon)
542{
543 if (icon->isFile) {
544 nbgl_frontDrawImageFile(area, icon->bitmap, color_map, ramBuffer);
545 }
546 else {
547 nbgl_frontDrawImage(area, icon->bitmap, transformation, color_map);
548 }
549}
550
551#ifdef NBGL_QRCODE
552#ifdef TARGET_APEX
553static void push_bits(uint8_t *buffer, uint16_t current_bits, uint8_t bits, uint8_t nb_bits)
554{
555 uint8_t byte = current_bits / 8;
556 uint8_t remaining_bits = 8 - current_bits % 8;
557
558 if (remaining_bits >= nb_bits) {
559 // put bits in possible MSB
560 buffer[byte] |= bits << (remaining_bits - nb_bits);
561 }
562 else {
563 // manage MSB
564 buffer[byte] |= bits >> (nb_bits - remaining_bits);
565 nb_bits -= remaining_bits;
566 // then LSB
567 buffer[byte + 1] |= bits << (8 - nb_bits);
568 }
569}
570#endif // TARGET_APEX
571
572static void nbgl_frontDrawQrInternal(const nbgl_area_t *area,
573 color_t foregroundColor,
574 nbgl_qrcode_version_t version)
575{
576 int size = qrcodegen_getSize(qrcode);
577 uint16_t idx = 0;
578
579 nbgl_area_t qrArea = {.x0 = area->x0,
580 .y0 = area->y0,
581 .backgroundColor = area->backgroundColor,
582 // QR codes are 1 BPP only
583 .bpp = NBGL_BPP_1};
584 if (version == QRCODE_V4) {
585#ifndef TARGET_APEX
586 // for each point of the V4 QR code, paint 64 pixels in image (8 in width, 8 in height)
587 qrArea.width = 2;
588 qrArea.height = QR_PIXEL_WIDTH_HEIGHT * 2 * size;
589 // paint a column of 2*size pixels in width by 8 pixels in height
590 for (int x = 0; x < size; x++) {
591 idx = 0;
592 for (int y = 0; y < size; y++) {
593 // draw 2 columns at once
594 QrDrawBuffer[idx] = qrcodegen_getModule(qrcode, x, y) ? 0xFF : 0x00;
596 idx += 1;
597 }
598 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
599 qrArea.x0 += 2;
600 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
601 qrArea.x0 += 2;
602 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
603 qrArea.x0 += 2;
604 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
605 qrArea.x0 += 2;
606 }
607#else // TARGET_APEX
608 // for each point of the V4 QR code, paint 5*5 pixels in image
609 qrArea.width = 1;
610 qrArea.height = 5 * size;
611 for (int x = 0; x < size; x++) {
612 idx = 0;
613 memset(QrDrawBuffer, 0, (size * 5 + 7) / 8);
614 // paint a column of 5*size pixels in width by 5 pixels in height
615 for (int y = 0; y < size; y++) {
616 push_bits(QrDrawBuffer, 5 * y, qrcodegen_getModule(qrcode, x, y) ? 0x1F : 0x00, 5);
617 }
618 for (int z = 0; z < 5; z++) {
619 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
620 qrArea.x0 += 1;
621 }
622 }
623#endif // TARGET_APEX
624 }
625 else { // V4 small or V10
626 // for each point of the V10 QR code, paint 16 pixels in image (4 in width, 4 in height)
627 qrArea.width = 1;
628 qrArea.height = QR_PIXEL_WIDTH_HEIGHT * size;
629 // paint a line of 4*size pixels in width by 4 pixels in height
630 for (int x = 0; x < size; x++) {
631 idx = 0;
632 memset(QrDrawBuffer, 0, (size + 1) / 2);
633 for (int y = 0; y < size; y++) {
634 QrDrawBuffer[idx] |= qrcodegen_getModule(qrcode, x, y) ? 0xF0 >> ((y & 1) * 4) : 0;
635 if (y & 1) {
636 idx++;
637 }
638 }
639 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
640 qrArea.x0++;
641 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
642 qrArea.x0++;
643 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
644 qrArea.x0++;
645 nbgl_frontDrawImage(&qrArea, QrDrawBuffer, NO_TRANSFORMATION, foregroundColor);
646 qrArea.x0++;
647 }
648 }
649}
650
664 nbgl_qrcode_version_t version,
665 const char *text,
666 color_t foregroundColor)
667{
668 uint8_t versionNum = (version == QRCODE_V10) ? 10 : 4;
669 bool ok = qrcodegen_encodeText(text,
671 qrcode,
672 qrcodegen_Ecc_LOW,
673 versionNum,
674 versionNum,
675 qrcodegen_Mask_AUTO,
676 true);
677
678 if (ok) {
679 nbgl_frontDrawQrInternal(area, foregroundColor, version);
680 }
681 else {
682 LOG_WARN(
683 DRAW_LOGGER, "Impossible to draw QRCode text %s with version %d\n", text, versionNum);
684 }
685}
686#endif // NBGL_QRCODE
debug traces management
#define LOG_WARN(__logger,...)
Definition nbgl_debug.h:87
#define LOG_DEBUG(__logger,...)
Definition nbgl_debug.h:86
@ DRAW_LOGGER
Definition nbgl_debug.h:29
#define QrDrawBuffer
Definition nbgl_draw.c:55
void nbgl_drawIcon(nbgl_area_t *area, nbgl_transformation_t transformation, nbgl_color_map_t color_map, const nbgl_icon_details_t *icon)
Helper function to render an icon directly from its nbgl_icon_details_t structure.
Definition nbgl_draw.c:538
#define QR_PIXEL_WIDTH_HEIGHT
Definition nbgl_draw.c:41
#define tempBuffer
Definition nbgl_draw.c:54
#define qrcode
Definition nbgl_draw.c:53
void nbgl_drawRoundedBorderedRect(const nbgl_area_t *area, nbgl_radius_t radiusIndex, uint8_t stroke, color_t innerColor, color_t borderColor)
This functions draws a rounded corners rectangle with a border, with the given parameters.
Definition nbgl_draw.c:372
CCASSERT(qr_code_buffer, sizeof(QrCodeBuffer_t)<=GZLIB_UNCOMPRESSED_CHUNK)
void nbgl_drawQrCode(const nbgl_area_t *area, nbgl_qrcode_version_t version, const char *text, color_t foregroundColor)
Draws the given text into a V10 QR code (QR code version is fixed using qrcodegen_VERSION_MIN/qrcodeg...
Definition nbgl_draw.c:663
void nbgl_drawRoundedRect(const nbgl_area_t *area, nbgl_radius_t radiusIndex, color_t innerColor)
This functions draws a rounded corners rectangle (without border), with the given parameters.
Definition nbgl_draw.c:273
half_t
Definition nbgl_draw.c:28
@ RIGHT_HALF
Definition nbgl_draw.c:30
@ LEFT_HALF
Definition nbgl_draw.c:29
Middle Level API of the new BOLOS Graphical Library.
#define QR_MAX_PIX_SIZE
Definition nbgl_draw.h:25
#define QR_V4_NB_PIX_SIZE
Definition nbgl_draw.h:23
Font screen low-Level driver API, to draw elementary forms.
void nbgl_frontDrawLine(const nbgl_area_t *area, uint8_t dotStartIdx, color_t lineColor)
void nbgl_frontDrawImage(const nbgl_area_t *area, const uint8_t *buffer, nbgl_transformation_t transformation, nbgl_color_map_t colorMap)
void nbgl_frontDrawImageFile(const nbgl_area_t *area, const uint8_t *buffer, nbgl_color_map_t colorMap, const uint8_t *uzlib_chunk_buffer)
void nbgl_frontDrawRect(const nbgl_area_t *area)
Side screen low-Level driver API, to draw elementary forms.
uint8_t ramBuffer[]
Definition nbgl_obj.c:146
color_t
Definition nbgl_types.h:140
@ BLACK
Definition nbgl_types.h:141
uint8_t nbgl_transformation_t
Represents the transformation to be applied on the bitmap before rendering This is a bitfield using m...
Definition nbgl_types.h:383
#define VERTICAL_MIRROR
Definition nbgl_types.h:97
uint8_t nbgl_color_map_t
Represents the color_map to be used for 2BPP image, or the foreground color for 1BPP image.
Definition nbgl_types.h:390
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:363
@ RADIUS_MAX
Definition nbgl_types.h:370
@ RADIUS_0_PIXELS
no radius (square angle)
Definition nbgl_types.h:376
nbgl_qrcode_version_t
possible modes for QR Code
Definition nbgl_types.h:229
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
Definition nbgl_types.h:231
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
Definition nbgl_types.h:230
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
#define GZLIB_UNCOMPRESSED_CHUNK
size of gzlib uncompression buffer in bytes
Definition nbgl_types.h:305
#define NO_TRANSFORMATION
Definition nbgl_types.h:91
@ NBGL_BPP_1
1 bit per pixel
Definition nbgl_types.h:284
struct PACKED__ nbgl_area_s nbgl_area_t
Represents a rectangle area of the screen.
const nbgl_icon_details_t * leftCircle
Definition nbgl_draw.c:62
const nbgl_icon_details_t * leftDisc
Definition nbgl_draw.c:61