--- /dev/null
+/* \r
+ *************************************************************************\r
+ *\r
+ * PCX_INT.H - PCX_LIB Library Internal Definitions Include File\r
+ *\r
+ * Version: 1.00B\r
+ *\r
+ * History: 91/02/14 - Created\r
+ * 91/04/01 - Release 1.00A\r
+ * 91/04/07 - Release 1.00B\r
+ *\r
+ * Compiler: Microsoft C V6.0\r
+ *\r
+ * Author: Ian Ashdown, P.Eng.\r
+ * byHeart Software\r
+ * 620 Ballantree Road\r
+ * West Vancouver, B.C.\r
+ * Canada V7S 1W3\r
+ * Tel. (604) 922-6148\r
+ * Fax. (604) 987-7621\r
+ *\r
+ * Copyright: Public Domain\r
+ *\r
+ *************************************************************************\r
+ */\r
+\f\r
+/* DEFINITIONS */\r
+\r
+#define _PCX_INT_H 1\r
+\r
+#ifndef _PCX_EXT_H\r
+#include "PCX_EXT.H" /* Get external PCX definitions, etc. */\r
+#endif\r
+\r
+#define PCX_HERC 0xff /* Hercules 720 x 348 monochrome mode */\r
+\r
+#define PCX_COMP_FLAG 0xc0 /* Compressed data flag mask */\r
+#define PCX_COMP_MASK 0x3f /* Data repeat count mask */\r
+\r
+#define PCX_PAL_MASK 0x03 /* Palette interpretation mask */\r
+#define PCX_EPAL_FLAG 0x0c /* Extended palette flag */\r
+\r
+#define PCX_PAL_SIZE 16 /* File header palette size */\r
+#define PCX_EPAL_SIZE 256 /* Extended palette size */\r
+\r
+#define PCX_MAXLINESZ 640 /* Maximum PCX line buffer size */\r
+\r
+/* Color graphics adapter color palette macros */\r
+\r
+#define PCX_CGA_BKGND(x) (x[0].red >> 4) /* Background color */\r
+#define PCX_CGA_BURST(x) (x[1].red & 0x80) /* Color burst */\r
+#define PCX_CGA_SELECT(x) (x[1].red & 0x40) /* Palette selector */\r
+#define PCX_CGA_INTENSITY(x) (x[1].red & 0x20) /* Intensity */\r
+\r
+typedef unsigned char BYTE; /* 8-bit data type */\r
+typedef unsigned int WORD; /* 16-bit data type */\r
+\f\r
+/* STRUCTURE DECLARATIONS */\r
+\r
+typedef struct pcx_pal /* PCX palette array element */\r
+{\r
+ BYTE red; /* Red intensity */\r
+ BYTE green; /* Green intensity */\r
+ BYTE blue; /* Blue intensity */\r
+}\r
+PCX_PAL;\r
+\r
+typedef struct pcx_hdr /* PCX file header (Version 5) */\r
+{\r
+ BYTE pcx_id; /* Always 0x0a for PCX files */\r
+ BYTE version; /* Version number */\r
+ BYTE encoding; /* 1 = PCX run length encoding */\r
+ BYTE bppixel; /* Number of bits/pixel per color plane */\r
+ WORD xul; /* X-position of upper left corner */\r
+ WORD yul; /* Y-position of upper left corner */\r
+ WORD xlr; /* X-position of lower right corner */\r
+ WORD ylr; /* Y-position of lower right corner */\r
+ WORD horz_res; /* Horizontal resolution */\r
+ WORD vert_res; /* Vertical resolution */\r
+ PCX_PAL palette[PCX_PAL_SIZE]; /* Hardware R-G-B palette */\r
+ BYTE reserved; /* Unused in Version 5 */\r
+ BYTE nplanes; /* Number of color planes */\r
+ WORD bppscan; /* Number of bytes per plane scan line */\r
+ WORD palette_type; /* Palette interpretation */\r
+ WORD scrn_width; /* Horizontal screen size in pixels */\r
+ WORD scrn_height; /* Vertical screen size in pixels */\r
+ BYTE filler[54]; /* Padding to fill out 128-byte header */\r
+\r
+ /* Notes: */\r
+ /* */\r
+ /* 1. The "version" member may be one of the following: */\r
+ /* */\r
+ /* 0 - PC Paintbrush Version 2.5 */\r
+ /* 2 - PC Paintbrush Version 2.8 (with palette information) */\r
+ /* 3 - PC Paintbrush Version 2.8 (w/o palette information) */\r
+ /* 4 - PC Paintbrush for Windows (PC Paintbrush Plus for */\r
+ /* Windows and Windows 3.0 Paintbrush use Version 5) */\r
+ /* 5 - PC Paintbrush 3.0 and greater (including PC Paintbrush */\r
+ /* Plus and Publisher's Paintbrush) */\r
+ /* */\r
+ /* 2. ZSoft Corporation has reserved the right to change the */\r
+ /* encoding method in future versions for better image */\r
+ /* compression performance. The "encoding" member value may */\r
+ /* change accordingly. */\r
+ /* */\r
+ /* 3. The value of the "bppixel" member depends on the type of */\r
+ /* video display adapter and its video mode. Typical values */\r
+ /* are 1, 2, 4 and 8. */\r
+ /* */\r
+ /* 4. The "xul", "yul", "xlr" and "ylr" members are zero-based and */\r
+ /* and inclusive values indicating the position of the image on */\r
+ /* the screen. The display functions can ignore this */\r
+ /* information if desired. */\r
+ /* */\r
+ /* 5. The "horz_res" and "vert_res" members refer to the "dots per */\r
+ /* inch" resolution of the scanning device used to create the */\r
+ /* image. For images created on video display adapters, these */\r
+ /* values typically refer to the horizontal and vertical */\r
+ /* resolutions in pixels (e.g. - 640 x 350 for an EGA display). */\r
+ /* */\r
+ /* The display function ignore these members, as some programs */\r
+ /* programs do not bother to initialize them when creating PCX */\r
+ /* image files. */\r
+ /* */\r
+ /* 6. The "palette" member is typically left uninitialized if an */\r
+ /* extended 256-color palette is appended to the PCX image */\r
+ /* file. */\r
+ /* */\r
+ /* 7. The "reserved" member used to contain the MS-DOS video mode */\r
+ /* that the PCX image was intended to be displayed under. This */\r
+ /* member is ignored in Version 5. ZSoft recommends that it be */\r
+ /* set to zero. */\r
+ /* */\r
+ /* 8. The value of the "nplanes" member depends on the type of */\r
+ /* video display adapter and its video mode. Typical values */\r
+ /* are 1, 2, 3 and 4. */\r
+ /* */\r
+ /* 9. The value of the "bppscan" member should be an even number */\r
+ /* (for compatibility with some existing commercial programs.) */\r
+ /* It indicates the number of bytes required to buffer a */\r
+ /* decoded scan line for one color plane. */\r
+ /* */\r
+ /* 10. The "palette_type" member indicates whether the palette */\r
+ /* represents a color or grayscale palette. It is a bit-mapped */\r
+ /* variable (only the lowest two bits are significant; the */\r
+ /* others are ignored) with two possible values: */\r
+ /* */\r
+ /* 0x01 - color or black & white */\r
+ /* 0x02 - grayscale */\r
+ /* */\r
+ /* If "grayscale" is indicated, the file color palette must be */\r
+ /* set to shades of gray. The file decoding functions can then */\r
+ /* either use this palette or assume a default grayscale */\r
+ /* palette if necessary. */\r
+ /* */\r
+ /* PC Paintbrush IV and IV Plus ignore this member. */\r
+ /* */\r
+ /* 11. The "scrn_width" and "scrn_height" members were added for */\r
+ /* PC Paintbrush IV Version 1.02 and IV Plus Version 1.0. They */\r
+ /* may not be initialized in some older Version 5 PCX files, or */\r
+ /* the "scrn_width" member may be initialized with the screen */\r
+ /* height and the "scrn_height" member uninitialized. ZSoft */\r
+ /* recommends that this information be ignored. */\r
+ /* */\r
+ /* 12. ZSoft recommends that the "filler" bytes be set to zero. */\r
+}\r
+PCX_HDR;\r
+\r
+typedef struct pcx_workblk /* PCX image file workblock */\r
+{\r
+ /* File header */\r
+\r
+ FILE *fp; /* PCX image file pointer */\r
+ PCX_HDR header; /* PCX image file header */\r
+ PCX_PAL *palettep; /* Color palette pointer */\r
+ BOOL epal_flag; /* Extended color palette flag */\r
+\r
+ /* Image manipulation variables */\r
+\r
+ int num_bytes; /* Number of bytes to display */\r
+ int mask; /* Unseen pixels mask */\r
+ unsigned long page_offset; /* Display page address offset */\r
+\r
+ /* Image manipulation function pointer */\r
+\r
+ void (*pcx_funcp)(struct pcx_workblk *, unsigned char _far *, int);\r
+}\r
+PCX_WORKBLK;\r
+\f\r
+/* FUNCTIONS PROTOTYPES */\r
+\r
+extern BOOL pcx_close(PCX_WORKBLK *);\r
+\r
+extern PCX_WORKBLK *pcx_open(char *, BOOL);\r
+\r