Embedded SDK
Embedded SDK
nbgl_image_utils.h
Go to the documentation of this file.
1 
7 #ifndef NBGL_IMAGE_UTILS_H
8 #define NBGL_IMAGE_UTILS_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /*********************
15  * INCLUDES
16  *********************/
17 #include "nbgl_types.h"
18 
19 /*********************
20  * DEFINES
21  *********************/
25 #define WIDTH_OFFSET 0
26 
30 #define HEIGHT_OFFSET 2
31 
35 #define BPP_COMPRESS_OFFSET 4
36 
41 #define BUFFER_LEN_OFFSET 5
42 
47 #define BUFFER_OFFSET 8
48 
52 #define IMAGE_FILE_HEADER_SIZE 8
53 
54 /**********************
55  * MACROS
56  **********************/
57 
62 #define GET_IMAGE_FILE_WIDTH(image_file) \
63  (image_file[WIDTH_OFFSET] | (image_file[WIDTH_OFFSET + 1] << 8))
64 
69 #define GET_IMAGE_FILE_HEIGHT(image_file) \
70  (image_file[HEIGHT_OFFSET] | (image_file[HEIGHT_OFFSET + 1] << 8))
71 
76 #define GET_IMAGE_FILE_BPP(image_file) (image_file[BPP_COMPRESS_OFFSET] >> 4)
77 
82 #define GET_IMAGE_FILE_COMPRESSION(image_file) (image_file[BPP_COMPRESS_OFFSET] & 0xF)
83 
88 #define GET_IMAGE_FILE_BUFFER_LEN(image_file) \
89  (image_file[BUFFER_LEN_OFFSET] | (image_file[BUFFER_LEN_OFFSET + 1] << 8) \
90  | (image_file[BUFFER_LEN_OFFSET + 2] << 16))
91 
96 #define GET_IMAGE_FILE_BUFFER(image_file) (&image_file[BUFFER_OFFSET])
97 
98 #ifdef __cplusplus
99 } /* extern "C" */
100 #endif
101 
102 #endif /* NBGL_IMAGE_UTILS_H */
common types for Graphical Library