eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_imgdec_bmp.h
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
46 #ifndef __D4D_IMGDEC_BMP_H
47 #define __D4D_IMGDEC_BMP_H
48 
49 /******************************************************************************
50 * Types
51 ******************************************************************************/
52 
53 #pragma pack (push)
54 #pragma pack (1)
55 typedef struct {
56  Word magic; // the magic must be "BM" 66 77 0x424D
57  LWord size; // Size of the BMP file
58  Word reserved0; // Application specific
59  Word reserved1; // Application specific
60  LWord dataOff; // Offset where the Pixel Array (bitmap data) can be found
62 
63 
64 typedef struct {
65  Word header_sz; // 12 Bytes
71 
72 typedef struct {
73  LWord headerSz; // 40 Bytes Number of bytes in the DIB header (from this point)
74  sLWord width; // Width of the bitmap in pixels
75  sLWord height; // Height of the bitmap in pixels
76  Word nplanes; // Number of color planes being used
77  Word bitspp; // Number of bits per pixel
78  LWord compressType; // Pixel Array compression used
79  LWord bmpBytesz; // Size of the raw data in the Pixel Array (including padding)
80  sLWord hres; // Horizontal resolution of the image
81  sLWord vres; // Vertical resolution of the image
82  LWord ncolors; // Number of colors in the palette
83  LWord nimpcolors; // Important colors 0 means all colors are important
85 
86 #pragma pack (pop)
87 
88 typedef enum {
92  D4D_BC_BITFIELDS, //Also Huffman 1D compression for BITMAPCOREHEADER2
93  D4D_BC_JPEG, //Also RLE-24 compression for BITMAPCOREHEADER2
96 
97 typedef struct D4D_RGBA_S
98 {
103 } D4D_RGBA;
104 
105 typedef struct D4D_BGRA_S
106 {
111 } D4D_BGRA;
112 
113 typedef union D4D_LONG_S
114 {
116  struct
117  {
120  }Words;
121  struct
122  {
127  }Bytes;
128 }D4D_LONG;
129 /******************************************************************************
130 * Constants
131 ******************************************************************************/
132 
133 #if D4D_ENDIAN == D4D_ENDIAN_LITTLE
134  #define D4D_BITMAP_SIGNATURE 0x4d42
135 #else
136  #define D4D_BITMAP_SIGNATURE 0x424d
137 #endif
138 
139 #define D4D_BITMAPHEADER_SIZE sizeof(D4D_BITMAPHEADER)
140 
141 #define D4D_BITMAPINFOHEADER_SIZE sizeof(D4D_BITMAPINFOHEADER)
142 
143 #define D4D_TMP_PBITMAPHEADER ((D4D_BITMAPHEADER*)d4d_extsrcBuffer)
144 
145 #define D4D_TMP_PBITMAPINFOHEADER ((D4D_BITMAPINFOHEADER*)d4d_extsrcBuffer)
146 
147 /******************************************************************************
148 * External source constants
149 ******************************************************************************/
150 
151 
152 
153 
154 /******************************************************************************
155 * Global D4D bitmap drawing level functions
156 ******************************************************************************/
157 #if (D4D_BMP_EXTSRC_SUPPORT_BMP == D4D_TRUE) && (D4D_EXTSRC_FILE_ENABLE == D4D_TRUE)
158 
159  void D4D_ImgDecBmpDraw(D4D_COOR x, D4D_COOR y, D4D_CHAR* pFileName, D4D_BOOL greyScale, D4D_COOR radius);
163  int D4D_ImgDecBmpGetHeader(D4D_CHAR* pFileName, void* pBuff, int max_size);
165 
166 #else
167  #define D4D_ImgDecBmpDraw NULL
168  #define D4D_ImgDecBmpGetWidth NULL
169  #define D4D_ImgDecBmpGetHeight NULL
170  #define D4D_ImgDecBmpGetSize NULL
171  #define D4D_ImgDecBmpGetHeader NULL
172  #define D4D_PrintScreenToBMP(x) (D4D_FALSE)
173 #endif
174 
175 #endif /* __D4D_IMGDEC_BMP_H */
struct D4D_LONG_S::@2 Bytes
signed long sLWord
Type definition of sLWord (signed 32-bit).
Definition: d4d_types.h:171
D4D_BITMAPCOMPRESSION
D4D_COOR D4D_ImgDecBmpGetWidth(D4D_CHAR *pFileName)
void D4D_ImgDecBmpDraw(D4D_COOR x, D4D_COOR y, D4D_CHAR *pFileName, D4D_BOOL greyScale, D4D_COOR radius)
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
D4D_COOR D4D_ImgDecBmpGetHeight(D4D_CHAR *pFileName)
D4D_SIZE D4D_ImgDecBmpGetSize(D4D_CHAR *pFileName)
unsigned long LWord
Type definition of LWord (unsigned 32-bit).
Definition: d4d_types.h:167
int D4D_ImgDecBmpGetHeader(D4D_CHAR *pFileName, void *pBuff, int max_size)
struct D4D_LONG_S::@1 Words
struct D4D_RGBA_S D4D_RGBA
union D4D_LONG_S D4D_LONG
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
char D4D_CHAR
Type definition of eGUI ASCII character.
Definition: d4d_types.h:280
Type definition of eGUI size structure.
Definition: d4d_types.h:230
struct D4D_BGRA_S D4D_BGRA
D4D_BOOL D4D_PrintScreenToBMP(D4D_CHAR *pFileName)
The function convert screen into BMP file.
unsigned short Word
Type definition of Word (unsigned 16-bit).
Definition: d4d_types.h:159