]>
git.saurik.com Git - wxWidgets.git/blob - src/tiff/test/strip_rw.c
4 * Copyright (c) 2004, Andrey Kiselev <dron@ak4719.spb.edu>
6 * Permission to use, copy, modify, distribute, and sell this software and
7 * its documentation for any purpose is hereby granted without fee, provided
8 * that (i) the above copyright notices and this permission notice appear in
9 * all copies of the software and related documentation, and (ii) the names of
10 * Sam Leffler and Silicon Graphics may not be used in any advertising or
11 * publicity relating to the software without the specific, prior written
12 * permission of Sam Leffler and Silicon Graphics.
14 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18 * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
19 * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20 * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21 * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22 * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
29 * Test libtiff input/output routines.
32 #include "tif_config.h"
41 #include "test_arrays.h"
44 create_image_striped(const char *, uint32
, uint32
, uint32
, uint16
, uint16
,
45 uint16
, uint16
, uint16
, uint16
, const tdata_t
,
48 read_image_striped(const char *, uint32
, uint32
, uint32
, uint16
, uint16
,
49 uint16
, uint16
, uint16
, uint16
, const tdata_t
,
52 const char *filename
= "strip_test.tiff";
55 main(int argc
, char **argv
)
59 uint16 spp
, bps
, photometric
, sampleformat
, planarconfig
;
64 * Test two special cases: image consisting from single line and image
65 * consisting from single column.
68 compression
= COMPRESSION_NONE
;
71 photometric
= PHOTOMETRIC_MINISBLACK
;
72 sampleformat
= SAMPLEFORMAT_UINT
;
73 planarconfig
= PLANARCONFIG_CONTIG
;
75 if (create_image_striped(filename
, XSIZE
* YSIZE
, 1, rowsperstrip
,
76 compression
, spp
, bps
, photometric
,
77 sampleformat
, planarconfig
,
78 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
79 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
82 if (read_image_striped(filename
, XSIZE
* YSIZE
, 1, rowsperstrip
,
83 compression
, spp
, bps
, photometric
,
84 sampleformat
, planarconfig
,
85 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
86 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
91 if (create_image_striped(filename
, 1, XSIZE
* YSIZE
, rowsperstrip
,
92 compression
, spp
, bps
, photometric
,
93 sampleformat
, planarconfig
,
94 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
95 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
98 if (read_image_striped(filename
, 1, XSIZE
* YSIZE
, rowsperstrip
,
99 compression
, spp
, bps
, photometric
,
100 sampleformat
, planarconfig
,
101 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
102 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
108 * Test one-channel image with different parameters.
113 photometric
= PHOTOMETRIC_MINISBLACK
;
114 sampleformat
= SAMPLEFORMAT_UINT
;
115 planarconfig
= PLANARCONFIG_CONTIG
;
117 if (create_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
118 compression
, spp
, bps
, photometric
,
119 sampleformat
, planarconfig
,
120 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
121 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
124 if (read_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
125 compression
, spp
, bps
, photometric
,
126 sampleformat
, planarconfig
,
127 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
128 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
133 rowsperstrip
= YSIZE
;
134 if (create_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
135 compression
, spp
, bps
, photometric
,
136 sampleformat
, planarconfig
,
137 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
138 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
141 if (read_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
142 compression
, spp
, bps
, photometric
,
143 sampleformat
, planarconfig
,
144 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
145 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
157 /* vim: set ts=8 sts=8 sw=8 noet: */