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