1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2011, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
41 /** BMP magic number ('BM'). */
\r
42 #define BMP_TYPE 0x4D42
\r
44 /** headerSize must be set to 40 */
\r
45 #define BITMAPINFOHEADER 40
\r
47 /*------------------------------------------------------------------------------
\r
49 *------------------------------------------------------------------------------*/
\r
53 /** BMP (Windows) Header Format */
\r
54 typedef struct _BMPHeader
\r
56 /* signature, must be 4D42 hex */
\r
58 /* size of BMP file in bytes (unreliable) */
\r
60 /* reserved, must be zero */
\r
62 /* reserved, must be zero */
\r
64 /* offset to start of image data in bytes */
\r
66 /* size of BITMAPINFOHEADER structure, must be 40 */
\r
67 uint32_t headerSize;
\r
68 /* image width in pixels */
\r
70 /* image height in pixels */
\r
72 /* number of planes in the image, must be 1 */
\r
74 /* number of bits per pixel (1, 4, 8, 16, 24, 32) */
\r
76 /* compression type (0=none, 1=RLE-8, 2=RLE-4) */
\r
77 uint32_t compression;
\r
78 /* size of image data in bytes (including padding) */
\r
80 /* horizontal resolution in pixels per meter (unreliable) */
\r
81 uint32_t xresolution;
\r
82 /* vertical resolution in pixels per meter (unreliable) */
\r
83 uint32_t yresolution;
\r
84 /* number of colors in image, or zero */
\r
86 /* number of important colors, or zero */
\r
87 uint32_t importantcolours;
\r
93 /*------------------------------------------------------------------------------
\r
94 * Exported functions
\r
95 *------------------------------------------------------------------------------*/
\r
96 extern uint8_t BMP_IsValid(void *file);
\r
97 extern uint32_t BMP_GetFileSize(void *file);
\r
98 extern uint8_t BMP_Decode( void *file, uint8_t *buffer, uint32_t width, uint32_t height, uint8_t bpp );
\r
99 extern void WriteBMPheader( uint32_t* pAddressHeader, uint32_t bmpHSize, uint32_t bmpVSize, uint8_t nbByte_Pixels );
\r
100 extern void BMP_displayHeader(uint32_t* pAddressHeader);
\r
101 extern void RGB565toBGR555( uint8_t *fileSource, uint8_t *fileDestination, uint32_t width, uint32_t height, uint8_t bpp );
\r
103 #endif //#ifndef BMP_H
\r