File: ipdbP.h

package info (click to toggle)
imgvtopgm 1.2-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 636 kB
  • ctags: 268
  • sloc: ansic: 1,557; makefile: 100; sh: 95
file content (81 lines) | stat: -rw-r--r-- 2,101 bytes parent folder | download
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
/*
 * ipdbP.h
 *	Private things for ipdb*.c.
 *
 * Copyright (C) 1997 Eric A. Howe
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *   Authors: Eric A. Howe (mu@trends.net)
 */
#ifndef	IMGVTOPGM_IPDBP_H
#define	IMGVTOPGM_IPDBP_H
MU_HID(imgvtopgm_ipdbP_h, "$Mu: imgvtopgm/ipdbP.h 1.8 1998/03/27 06:20:53 $")

#include "sex.h"

/*
 * Pixel setting macros.
 */
#define	setgpixel(b,v,o)	((b) |= ((v) << (6 - 2*(o))))
#define	getgpixel(b,o)		(((b) >> (6 - 2*(o))) & 0x03)
#define	setmpixel(b,v,o)	((b) |= ((v) << (7 - (o))))
#define	getmpixel(b,o)		(((b) >> (7 - (o))) & 0x01)

/*
 * Pixels/byte.
 */
#define	img_ppb(i)	((i)->type == IMG_GRAY ? 4 : 8)

/*
 * Size (in bytes) of an image's data.
 */
#define	img_size(i)	(size_t)((i)->width/img_ppb(i)*(i)->height)

/*
 * Return the start of row `r'.
 */
#define	img_row(i, r)	(&(i)->data[(r)*(i)->width/img_ppb(i)])

/*
 * Only use four bytes of these.
 */
#define	IPDB_vIMG	"vIMG"
#define	IPDB_View	"View"

/*
 * Only use three bytes of this.
 */
#define	IPDB_MYST	"\x40\x6f\x80"

CDECLS_BEGIN

extern	IPDB	*ipdb_clear(IPDB *);

extern	PDBHEAD	*pdbhead_alloc(const char *);
extern	PDBHEAD	*pdbhead_free(PDBHEAD *);

extern	RECHDR	*rechdr_alloc(int, u4);
extern	RECHDR	*rechdr_free(RECHDR *);

extern	IMAGE	*image_alloc(const char *, int, int, int);
extern	IMAGE	*image_free(IMAGE *);

extern	TEXT	*text_alloc(const char *);
extern	TEXT	*text_free(TEXT *);

CDECLS_END

#endif