"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /* Copyright (C) 2002-2003 Ghostgum Software Pty Ltd. All rights reserved.
2
3 This software is provided AS-IS with no warranty, either express or
4 implied.
5
6 This software is distributed under licence and may not be copied,
7 modified or distributed except as expressly authorised under the terms
8 of the licence contained in the file LICENCE in this distribution.
9
10 For more information about licensing, please refer to
11 http://www.ghostgum.com.au/ or contact Ghostsgum Software Pty Ltd,
12 218 Gallaghers Rd, Glen Waverley VIC 3150, AUSTRALIA,
13 Fax +61 3 9886 6616.
14 */
15
16 /* $Id: cbmp.h,v 1.5 2003/08/08 23:58:14 ghostgum Exp $ */
17 /* BMP structures */
18
19 typedef struct tagBITMAP2
20 {
21 DWORD biSize;
22 LONG biWidth;
23 LONG biHeight;
24 WORD biPlanes;
25 WORD biBitCount;
26 DWORD biCompression;
27 DWORD biSizeImage;
28 LONG biXPelsPerMeter;
29 LONG biYPelsPerMeter;
30 DWORD biClrUsed;
31 DWORD biClrImportant;
32 } BITMAP2;
33 typedef BITMAP2 * LPBITMAP2;
34 #define BITMAP2_LENGTH 40
35
36 typedef struct tagBITMAPFILE
37 {
38 WORD bfType;
39 DWORD bfSize;
40 WORD bfReserved1;
41 WORD bfReserved2;
42 DWORD bfOffBits;
43 } BITMAPFILE;
44 typedef BITMAPFILE * LPBITMAPFILE;
45 #define BITMAPFILE_LENGTH 14
46
47 typedef struct tagRGB4
48 {
49 BYTE rgbBlue;
50 BYTE rgbGreen;
51 BYTE rgbRed;
52 BYTE rgbReserved;
53 } RGB4;
54 typedef RGB4 * LPRGB4;
55
56 #define RGB4_BLUE 0
57 #define RGB4_GREEN 1
58 #define RGB4_RED 2
59 #define RGB4_EXTRA 3
60 #define RGB4_LENGTH 4
61
62 typedef enum PNM_FORMAT_s {
63 PBMRAW=4,
64 PGMRAW=5,
65 PPMRAW=6,
66 PNMANY=99 /* use any */
67 } PNM_FORMAT;
68
69 /* Prototypes */
70
71 IMAGE * bmpfile_to_image(LPCTSTR filename);
72 IMAGE * bmp_to_image(unsigned char *pbitmap, unsigned int length);
73 IMAGE * pnmfile_to_image(LPCTSTR filename);
74 void bitmap_image_free(IMAGE *img);
75 int image_to_bmpfile(IMAGE*img, LPCTSTR filename, float xdpi, float ydpi);
76 int image_to_pnmfile(IMAGE* img, LPCTSTR filename, PNM_FORMAT pnm_format);
77 int image_to_tifffile(IMAGE* img, LPCTSTR filename, float xdpi, float ydpi);
78 int image_to_pngfile(IMAGE* img, LPCTSTR filename);
79 int image_to_pictfile(IMAGE* img, LPCTSTR filename, float xdpi, float ydpi);
80 IMAGE * pngfile_to_image(LPCTSTR filename);
81 int image_to_tifffile(IMAGE* img, LPCTSTR filename, float xdpi, float ydpi);
82 int image_to_tiff(GFile *f, IMAGE *img,
83 int xoffset, int yoffset, int width, int height,
84 float xdpi, float ydpi,
85 BOOL tiff4, BOOL use_packbits);
86
87 void write_dword(DWORD val, GFile *f);
88 void write_word_as_dword(WORD val, GFile *f);
89 void write_word(WORD val, GFile *f);
90 DWORD get_dword(const unsigned char *buf);
91 WORD get_word(const unsigned char *buf);