Embedded SDK
Embedded SDK
Classes | Macros | Enumerations | Functions
nbgl_draw.c File Reference

Implementation of middle-level API to draw rich forms like rounded rectangle. More...

#include <string.h>
#include "nbgl_front.h"
#include "nbgl_draw.h"
#include "nbgl_fonts.h"
#include "nbgl_debug.h"
#include "nbgl_side.h"
#include "qrcodegen.h"
#include "glyphs.h"
#include "os_pic.h"
#include "os_utils.h"
Include dependency graph for nbgl_draw.c:

Go to the source code of this file.

Classes

struct  QrCodeBuffer_t
 

Macros

#define QR_PIXEL_WIDTH_HEIGHT   4
 
#define qrcode   ((QrCodeBuffer_t *) ramBuffer)->qrcode
 
#define tempBuffer   ((QrCodeBuffer_t *) ramBuffer)->tempBuffer
 
#define QrDrawBuffer   ((QrCodeBuffer_t *) ramBuffer)->QrDrawBuffer
 

Enumerations

enum  quarter_t { BAGL_FILL_CIRCLE_0_PI2 , BAGL_FILL_CIRCLE_PI2_PI , BAGL_FILL_CIRCLE_PI_3PI2 , BAGL_FILL_CIRCLE_3PI2_2PI }
 

Functions

 CCASSERT (qr_code_buffer, sizeof(QrCodeBuffer_t)<=GZLIB_UNCOMPRESSED_CHUNK)
 
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. More...
 
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. More...
 
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. More...
 
nbgl_font_id_e nbgl_drawText (const nbgl_area_t *area, const char *text, uint16_t textLen, nbgl_font_id_e fontId, color_t fontColor)
 This function draws the given single-line text, with the given parameters. More...
 
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/qrcodegen_VERSION_MAX in qrcodegen.h) More...
 

Detailed Description

Implementation of middle-level API to draw rich forms like rounded rectangle.

Definition in file nbgl_draw.c.

Macro Definition Documentation

◆ QR_PIXEL_WIDTH_HEIGHT

#define QR_PIXEL_WIDTH_HEIGHT   4

Definition at line 34 of file nbgl_draw.c.

◆ qrcode

#define qrcode   ((QrCodeBuffer_t *) ramBuffer)->qrcode

Definition at line 46 of file nbgl_draw.c.

◆ QrDrawBuffer

#define QrDrawBuffer   ((QrCodeBuffer_t *) ramBuffer)->QrDrawBuffer

Definition at line 48 of file nbgl_draw.c.

◆ tempBuffer

#define tempBuffer   ((QrCodeBuffer_t *) ramBuffer)->tempBuffer

Definition at line 47 of file nbgl_draw.c.

Enumeration Type Documentation

◆ quarter_t

enum quarter_t
Enumerator
BAGL_FILL_CIRCLE_0_PI2 
BAGL_FILL_CIRCLE_PI2_PI 
BAGL_FILL_CIRCLE_PI_3PI2 
BAGL_FILL_CIRCLE_3PI2_2PI 

Definition at line 27 of file nbgl_draw.c.

Function Documentation

◆ CCASSERT()

CCASSERT ( qr_code_buffer  ,
sizeof(QrCodeBuffer_t)<=  GZLIB_UNCOMPRESSED_CHUNK 
)

◆ nbgl_drawIcon()

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.

The icon is rendered whether it's an image file or not. No transformation is applied to the icon.

Parameters
areaArea of drawing
transformationTransformation to apply to this icon (only available for raw image, not image file)
color_mapColor map applied to icon
iconIcon details structure to draw

Definition at line 489 of file nbgl_draw.c.

◆ nbgl_drawQrCode()

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/qrcodegen_VERSION_MAX in qrcodegen.h)

Note
y0 and height must be multiple 4 pixels, and background color is applied to 0's in 1BPP bitmap.
Parameters
areaposition, size and color of the QR code to draw
versionversion of QR Code
texttext to encode
foregroundColorcolor to be applied to the 1's in QR code

Definition at line 764 of file nbgl_draw.c.

◆ nbgl_drawRoundedBorderedRect()

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.

Parameters
areaposition, size and background color (outside of the rectangle) to use for the rectangle
radiusIndexradius size
strokethickness of border (fixed to 2)
innerColorcolor to use for inside the rectangle
borderColorcolor to use for the border

Definition at line 331 of file nbgl_draw.c.

◆ nbgl_drawRoundedRect()

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.

Parameters
areaposition, size and background color (outside of the rectangle) to use for the rectangle
radiusIndexradius size
innerColorcolor to use for inside the rectangle

Definition at line 237 of file nbgl_draw.c.

◆ nbgl_drawText()

nbgl_font_id_e nbgl_drawText ( const nbgl_area_t area,
const char *  text,
uint16_t  textLen,
nbgl_font_id_e  fontId,
color_t  fontColor 
)

This function draws the given single-line text, with the given parameters.

Parameters
areaposition, size and background color to use for text
textarray of characters (UTF-8)
textLennumber of chars to draw
fontIdfont to be used
fontColorcolor to use for font

Definition at line 538 of file nbgl_draw.c.