RTEMS 6.1-rc2
Loading...
Searching...
No Matches
bmp.h
Go to the documentation of this file.
1/* ---------------------------------------------------------------------------- */
2/* Atmel Microcontroller Software Support */
3/* SAM Software Package License */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation */
6/* */
7/* All rights reserved. */
8/* */
9/* Redistribution and use in source and binary forms, with or without */
10/* modification, are permitted provided that the following condition is met: */
11/* */
12/* - Redistributions of source code must retain the above copyright notice, */
13/* this list of conditions and the disclaimer below. */
14/* */
15/* Atmel's name may not be used to endorse or promote products derived from */
16/* this software without specific prior written permission. */
17/* */
18/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28/* ---------------------------------------------------------------------------- */
29
38#ifndef BMP_H
39#define BMP_H
40
42#define BMP_TYPE 0x4D42
43
45#define BITMAPINFOHEADER 40
46
47/*------------------------------------------------------------------------------
48 * Exported types
49 *------------------------------------------------------------------------------*/
50
51#pragma pack(1)
52
54typedef struct _BMPHeader {
55 /* signature, must be 4D42 hex */
56 uint16_t type;
57 /* size of BMP file in bytes (unreliable) */
58 uint32_t fileSize;
59 /* reserved, must be zero */
60 uint16_t reserved1;
61 /* reserved, must be zero */
62 uint16_t reserved2;
63 /* offset to start of image data in bytes */
64 uint32_t offset;
65 /* size of BITMAPINFOHEADER structure, must be 40 */
66 uint32_t headerSize;
67 /* image width in pixels */
68 uint32_t width;
69 /* image height in pixels */
70 uint32_t height;
71 /* number of planes in the image, must be 1 */
72 uint16_t planes;
73 /* number of bits per pixel (1, 4, 8, 16, 24, 32) */
74 uint16_t bits;
75 /* compression type (0=none, 1=RLE-8, 2=RLE-4) */
76 uint32_t compression;
77 /* size of image data in bytes (including padding) */
78 uint32_t imageSize;
79 /* horizontal resolution in pixels per meter (unreliable) */
80 uint32_t xresolution;
81 /* vertical resolution in pixels per meter (unreliable) */
82 uint32_t yresolution;
83 /* number of colors in image, or zero */
84 uint32_t ncolours;
85 /* number of important colors, or zero */
86 uint32_t importantcolours;
88
89#pragma pack()
90
91/*------------------------------------------------------------------------------
92 * Exported functions
93 *------------------------------------------------------------------------------*/
94extern uint8_t BMP_IsValid(void *file);
95extern uint32_t BMP_GetFileSize(void *file);
96
97extern uint8_t BMP_Decode(
98 void *file,
99 uint8_t *buffer,
100 uint32_t width,
101 uint32_t height,
102 uint8_t bpp);
103
104extern void WriteBMPheader(
105 uint32_t *pAddressHeader,
106 uint32_t bmpHSize,
107 uint32_t bmpVSize,
108 uint8_t nbByte_Pixels);
109
110extern void BMP_displayHeader(uint32_t *pAddressHeader);
111extern void RGB565toBGR555(
112 uint8_t *fileSource,
113 uint8_t *fileDestination,
114 uint32_t width,
115 uint32_t height,
116 uint8_t bpp);
117
118#endif //#ifndef BMP_H
119
struct _BMPHeader BMPHeader
Definition: bmp.h:54
Definition: mongoose.c:448