Tue, 01 Jan 2002 05:02:44 +0000
create temporary TIFF file.
eric@2 | 1 | #include <stdio.h> |
eric@2 | 2 | |
eric@11 | 3 | #include "type.h" |
eric@2 | 4 | #include "bitblt.h" |
eric@2 | 5 | |
eric@2 | 6 | |
eric@2 | 7 | #define WIDTH 20 |
eric@2 | 8 | #define HEIGHT 9 |
eric@2 | 9 | |
eric@2 | 10 | char test_data [HEIGHT][WIDTH] = |
eric@2 | 11 | { |
eric@2 | 12 | ".....XXXXXXXXXX.....", |
eric@2 | 13 | ".....XX.......X.....", |
eric@2 | 14 | "XXXXXX.X......XXXXXX", |
eric@2 | 15 | ".....X..X.....X.....", |
eric@2 | 16 | ".....X...X....X.....", |
eric@2 | 17 | ".....X....X...X.....", |
eric@2 | 18 | ".....X.....X..X.....", |
eric@2 | 19 | ".....XXXXXXXXXX.....", |
eric@3 | 20 | ".....X.X.X.X.X......" |
eric@2 | 21 | }; |
eric@2 | 22 | |
eric@2 | 23 | Bitmap *setup (void) |
eric@2 | 24 | { |
eric@2 | 25 | Bitmap *b; |
eric@2 | 26 | Point p; |
eric@2 | 27 | |
eric@2 | 28 | b = create_bitmap (WIDTH, HEIGHT); |
eric@2 | 29 | if (! b) |
eric@2 | 30 | return (NULL); |
eric@2 | 31 | |
eric@2 | 32 | for (p.y = 0; p.y < HEIGHT; p.y++) |
eric@2 | 33 | for (p.x = 0; p.x < WIDTH; p.x++) |
eric@2 | 34 | set_pixel (b, p, test_data [p.y][p.x] == 'X'); |
eric@2 | 35 | |
eric@2 | 36 | return (b); |
eric@2 | 37 | } |
eric@2 | 38 | |
eric@2 | 39 | void print_bitmap (FILE *o, Bitmap *b) |
eric@2 | 40 | { |
eric@2 | 41 | Point p; |
eric@2 | 42 | printf ("rowbytes: %d\n", b->rowbytes); |
eric@2 | 43 | for (p.y = 0; p.y < b->height; p.y++) |
eric@2 | 44 | { |
eric@2 | 45 | for (p.x = 0; p.x < b->width; p.x++) |
eric@2 | 46 | fputc (".X" [get_pixel (b, p)], o); |
eric@2 | 47 | fprintf (o, "\n"); |
eric@2 | 48 | } |
eric@2 | 49 | } |
eric@2 | 50 | |
eric@2 | 51 | |
eric@2 | 52 | int main (int argc, char *argv[]) |
eric@2 | 53 | { |
eric@2 | 54 | Bitmap *b; |
eric@2 | 55 | Bitmap *b2; |
eric@2 | 56 | Rect r; |
eric@2 | 57 | Point p; |
eric@2 | 58 | |
eric@2 | 59 | b = setup (); |
eric@2 | 60 | if (! b) |
eric@2 | 61 | { |
eric@2 | 62 | fprintf (stderr, "setup failed\n"); |
eric@2 | 63 | exit (2); |
eric@2 | 64 | } |
eric@2 | 65 | |
eric@2 | 66 | print_bitmap (stdout, b); |
eric@2 | 67 | |
eric@2 | 68 | printf ("\n"); |
eric@2 | 69 | |
eric@2 | 70 | #if 0 |
eric@2 | 71 | b2 = create_bitmap (b->height, b->width); |
eric@2 | 72 | if (! b2) |
eric@2 | 73 | { |
eric@2 | 74 | fprintf (stderr, "create_bitmap failed\n"); |
eric@2 | 75 | exit (2); |
eric@2 | 76 | } |
eric@2 | 77 | #endif |
eric@2 | 78 | |
eric@2 | 79 | r.upper_left.x = r.upper_left.y = 0; |
eric@2 | 80 | r.lower_right.x = b->width; |
eric@2 | 81 | r.lower_right.y = b->height; |
eric@2 | 82 | p.x = p.y = 0; |
eric@2 | 83 | |
eric@2 | 84 | b2 = bitblt (b, r, |
eric@2 | 85 | NULL, p, |
eric@3 | 86 | ROT_90, |
eric@2 | 87 | TF_SRC); |
eric@2 | 88 | if (! b2) |
eric@2 | 89 | { |
eric@2 | 90 | fprintf (stderr, "bitblt failed\n"); |
eric@2 | 91 | exit (2); |
eric@2 | 92 | } |
eric@2 | 93 | |
eric@2 | 94 | print_bitmap (stdout, b2); |
eric@2 | 95 | |
eric@2 | 96 | exit (0); |
eric@2 | 97 | } |
eric@2 | 98 | |
eric@2 | 99 |