File: img.h

package info (click to toggle)
xloadimage 4.1-25
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 4,820 kB
  • sloc: ansic: 36,084; asm: 284; makefile: 282; sh: 280
file content (70 lines) | stat: -rw-r--r-- 2,225 bytes parent folder | download | duplicates (19)
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
/*
** img.h - structures/definitions for GEM Bit Image format conversion
**
**	Tim Northrup <tim@BRS.Com>
**
**	Version 0.1 --  4/25/91 -- Initial cut
**
**  Copyright (C) 1991 Tim Northrup
**	(see file "tgncpyrght.h" for complete copyright information)
*/

#ifndef GEM_H
#define GEM_H

/*
**  Standard IMG Header Structure (8 words long)
**
**  May be followed by implementation-dependent information, so the
**	value of hlen should be checked on input.
*/

typedef struct {
	short	vers,			/* image version number */
		hlen,			/* header length (in words) */
		colors,			/* number of color planes (1=mono) */
		patlen,			/* pattern length (for encoding) */
		pixw, pixh,		/* pixel dimensions (in microns) */
		llen, lines;		/* pixels/line and number of lines */
	} IMG_Header;

/*
**	Header record values used when creating an IMG file
*/

#define DEF_VERSION	1		/* default version number (on output) */
#define DEF_HLEN	8		/* always standard header */
#define DEF_COLORS	1		/* always B/W pics */
#define DEF_PATLEN	1		/* easiest pattern size */
#define DEF_PIXW	85		/* just a guess on this one */
#define DEF_PIXH	85		/* assumed 1:1 aspect ratio */

/*
**	Program limits and other constants
*/

#define MAX_SCANLINE	1024		/* max bytes for 1 scanline */

#define MAX_SLREPEAT	255		/* max repititions of scanline */
#define MAX_PATREPEAT	255		/* max repititions of pattern */
#define MAX_BYTEREPEAT	127		/* max repititions of byte value */
#define MAX_LITERAL	255		/* max literal length allowed */

#define BYTE_FLAG	0x00		/* first byte 0 the ... */
#define  BYTE_SLREPEAT     0x00		   /* second 0 means scanline repeat */
#define   BYTE_SLFLAG	      0xFF	   /* always followed by FF (?) */
#define BYTE_LITERAL	0x80		/* char 80h - flag literal string */

#define BYTE_BLACK	0xFF		/* byte is all 1's */
#define BIT_BLACK	1		/* single black bit */
#define BYTE_WHITE	0x00		/* byte is all 0's */
#define BIT_WHITE	0		/* single white bit */

#define RUN_BLACK	0x80		/* bit flag for run of all 0's or 1's */
#define RUN_WHITE	0x00

#define RUN_LENGTH(X)   ((X) & 0x7F)
#define RUN_COLOR(X)	((((X) & RUN_BLACK) == RUN_BLACK)?BIT_BLACK:BIT_WHITE)
#define PIXEL_COLOR(X)	((((X) & 0x01) == 1)?BIT_BLACK:BIT_WHITE)

#endif /* GEM_H */