bitblt.h

Thu, 13 Mar 2003 06:56:57 +0000

author
eric
date
Thu, 13 Mar 2003 06:56:57 +0000
changeset 118
c22e1c0a64fd
parent 109
663da96ad2bc
child 125
e2ef1c2f9eca
permissions
-rw-r--r--

updated pdf_write_g4_fax_image() to add ImageB to page ProcSet array. Added pdf_add_array_elem_unique() function. Added support for name objects to pdf_compare_obj().

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