Wed, 12 Mar 2003 07:43:56 +0000
moved pdf_new_XObject() from pdf_g4.c to pdf_prim.c.
1 /*
2 * t2p: Create a PDF file from the contents of one or more TIFF
3 * bilevel image files. The images in the resulting PDF file
4 * will be compressed using ITU-T T.6 (G4) fax encoding.
5 *
6 * bitblt routines
7 * $Id: bitblt.h,v 1.15 2003/03/11 22:02:46 eric Exp $
8 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. Note that permission is
13 * not granted to redistribute this program under the terms of any
14 * other version of the General Public License.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
24 */
27 typedef struct Point
28 {
29 int32_t x;
30 int32_t y;
31 } Point;
33 typedef struct Rect
34 {
35 Point min;
36 Point max;
37 } Rect;
39 static inline int32_t rect_width (Rect *r)
40 {
41 return (r->max.x - r->min.x);
42 }
44 static inline int32_t rect_height (Rect *r)
45 {
46 return (r->max.y - r->min.y);
47 }
50 /* word_type should be the largest native type that can be handled
51 efficiently, so it shouldn't be a 64-bit type on a processor that
52 doesn't have native 64-bit operations. */
53 typedef uint32_t word_type;
54 #define BITS_PER_WORD (8 * sizeof (word_type))
55 #define ALL_ONES (~ 0UL)
58 typedef struct Bitmap
59 {
60 word_type *bits;
61 Rect rect;
62 uint32_t row_words;
63 } Bitmap;
66 #define TF_SRC 0xc
67 #define TF_AND 0x8
68 #define TF_OR 0xe
69 #define TF_XOR 0x6
72 void bitblt_init (void);
75 Bitmap *create_bitmap (Rect *rect);
76 void free_bitmap (Bitmap *bitmap);
78 bool get_pixel (Bitmap *bitmap, Point coord);
79 void set_pixel (Bitmap *bitmap, Point coord, bool value);
82 Bitmap *bitblt (Bitmap *src_bitmap,
83 Rect *src_rect,
84 Bitmap *dest_bitmap,
85 Point *dest_min,
86 int tfn,
87 int background);
90 /* in-place transformations */
91 void flip_h (Bitmap *src);
92 void flip_v (Bitmap *src);
94 void rot_180 (Bitmap *src); /* combination of flip_h and flip_v */
96 /* "in-place" transformations - will allocate new memory and free old */
97 void transpose (Bitmap *src);
99 void rot_90 (Bitmap *src); /* transpose + flip_h */
100 void rot_270 (Bitmap *src); /* transpose + flip_v */
103 void reverse_bits (uint8_t *p, int byte_count);
106 void bitblt_write_g4 (Bitmap *bitmap, FILE *f);