summaryrefslogtreecommitdiff
path: root/utility/demo-fw/pc-tools/CreateDemoBin/include/CreateDemoBin.h
blob: d6d28834665a02dab5bbbdcc27ee81222a7d58eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef __CREATEDEMOBIN_H
#define __CREATEDEMOBIN_H

////////////////////////////////////////////////////////////
//type definition
///////////////////////////////////////////////////////////
// BMP (Windows) Header Format
typedef struct  __attribute__ ((packed)) {
    /// signature, must be 4D42 hex
    unsigned short type;
    /// size of BMP file in bytes (unreliable)
    unsigned int fileSize;
    /// reserved, must be zero
    unsigned short reserved1;
    /// reserved, must be zero
    unsigned short reserved2;
    /// offset to start of image data in bytes
    unsigned int offset;
    /// size of BITMAPINFOHEADER structure
    unsigned int headerSize;
    /// image width in pixels
    unsigned int width;
    /// image height in pixels
    unsigned int height;
    /// number of planes in the image, must be 1
    unsigned short planes;
    /// number of bits per pixel (1, 4, 8, 16, 24, 32)
    unsigned short bits;
    /// compression type (0=none, 1=RLE-8, 2=RLE-4)
    unsigned int compression;
    /// size of image data in bytes (including padding)
    unsigned int imageSize;
    /// horizontal resolution in pixels per meter (unreliable)
    unsigned int xresolution;
    /// vertical resolution in pixels per meter (unreliable)
    unsigned int yresolution;
    /// number of colors in image, or zero
    unsigned int ncolours;
    /// number of important colors, or zero
    unsigned int importantcolours;
} BMPHeader;

//option structure for image conversion
typedef struct _BMPConvOptions {
	//bitdepth of bmp file stored in demo bin file
	unsigned int bitdepth;
	//IMPORTANT NOTES: following width and height means
	//                 resized image without any rotation
	//resized bmp width
	unsigned int width;
	//resized bmp height
	unsigned int height;
	//anti-clockwise rotate angle
	unsigned int rotateangle;
	//reverse bmp bitmap data order
	//some lcd controller needs to get BMP bitmap data from bottom to top
	//this is used to indicate conversion
	unsigned int reversebitmaporder;
    #if defined(MOVIE_MERGE_on)
    //slide number for movie binary
    unsigned int mvSlideNumber;
    #endif
    #if defined(SLIDESHOW_MERGE_on)
    unsigned int ssPageNumber;
    unsigned int ssBitdepth;
    unsigned int ssWidth;
    unsigned int ssHeight;
    unsigned int ssRotateangle;
    unsigned int ssReverseBmpOrder;
    #endif
} BMPConvOpt;

#define BMP24MAPLEN 320*240*3
#define BMP16MAPLEN 320*240*2

///////////////////////////////////////////////////////////////////////
//export functions, steps of creation of atmel demo bin file
//////////////////////////////////////////////////////////////////////

//Initialize filename variables
void Step1_CreateFileNameVars(char * name);

//Process ppt information txt file
bool Step2_ProcessPPTInfoFile(BMPConvOpt *pOption);

//Resize and Rotate slides
bool Step3_ResizeAndRotateSlideBMP(BMPConvOpt *pOption);

//create demo bin from above variables
bool Step4_GenerateDemoBin(BMPConvOpt *pOption);

//show generated bin contained bmp information
void ShowEachBmpHeader();


#endif
personal git repositories of Harald Welte. Your mileage may vary