-
Notifications
You must be signed in to change notification settings - Fork 8
/
PCX.bt
45 lines (42 loc) · 2.2 KB
/
PCX.bt
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
//------------------------------------------------
//--- 010 Editor v1.2 Binary Template
//
// File: PCX.bt
// Authors: James Newton
// Version: 0.2
// Purpose: Parse a PCX bitmap header.
// Category: Image
// File Mask: *.pcx
// ID Bytes: 0A [+1] 01
// History:
// 0.2 2016-01-28 SweetScape: Updated header for repository submission.
// 0.1 JN: Initial release.
//------------------------------------------------
enum <ubyte> PCX_TYPE {
v25 =0, //Version 2.5 of PC Paintbrush
v28Pal =2, //Version 2.8 w/palette information
v28 =3, //Version 2.8 w/o palette information
v5Win =4, //PC Paintbrush for Windows(Plus for Windows uses Ver 5)
v3up =5 //Version 3.0 and > of PC Paintbrush and PC Paintbrush +, includes Publisher's Paintbrush. Includes 24-bit .PCX files.
} ;
struct PCX {
ubyte Manufacturer; //Constant Flag, 10 = ZSoft .pcx
PCX_TYPE version; //Version information
ubyte encoding; //1 = .PCX run length encoding
ubyte BitsPerPixel; //Number of bits to represent a pixel (per Plane) - 1, 2, 4, or 8
ushort Xmin; //Window. Image Dimensions: Xmin,Ymin,Xmax,Ymax
ushort Ymin; //
ushort Xmax; //
ushort Ymax; //
ushort HDpi; //Horizontal Resolution of image in DPI*
ushort VDpi; //Vertical Resolution of image in DPI*
ubyte Colormap[48]; //Color palette setting, see text
ubyte Reserved; //Should be set to 0.
ubyte NPlanes; //Number of color planes
ushort BytesPerLine; //Number of bytes to allocate for a scanline plane. MUST be an EVEN number. Do NOT calculate from Xmax-Xmin.
ushort PaletteInfo; //How to interpret palette- 1 = Color/BW, 2 = Grayscale (ignored in PB IV/ IV +)
ushort HscreenSize; //Horizontal screen size in pixels. New field found only in PB IV/IV Plus
ushort VscreenSize; //Vertical screen size in pixels. New field found only in PB IV/IV Plus
ubyte Filler[54]; //Blank to fill out 128 byte header. Set all bytes to 0
};
PCX file;