]>
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
;
62 * Test two special cases: image consisting from single line and image
63 * consisting from single column.
66 compression
= COMPRESSION_NONE
;
69 photometric
= PHOTOMETRIC_MINISBLACK
;
70 sampleformat
= SAMPLEFORMAT_UINT
;
71 planarconfig
= PLANARCONFIG_CONTIG
;
73 if (create_image_striped(filename
, XSIZE
* YSIZE
, 1, rowsperstrip
,
74 compression
, spp
, bps
, photometric
,
75 sampleformat
, planarconfig
,
76 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
77 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
80 if (read_image_striped(filename
, XSIZE
* YSIZE
, 1, rowsperstrip
,
81 compression
, spp
, bps
, photometric
,
82 sampleformat
, planarconfig
,
83 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
84 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
89 if (create_image_striped(filename
, 1, XSIZE
* YSIZE
, rowsperstrip
,
90 compression
, spp
, bps
, photometric
,
91 sampleformat
, planarconfig
,
92 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
93 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
96 if (read_image_striped(filename
, 1, XSIZE
* YSIZE
, rowsperstrip
,
97 compression
, spp
, bps
, photometric
,
98 sampleformat
, planarconfig
,
99 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
100 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
106 * Test one-channel image with different parameters.
111 photometric
= PHOTOMETRIC_MINISBLACK
;
112 sampleformat
= SAMPLEFORMAT_UINT
;
113 planarconfig
= PLANARCONFIG_CONTIG
;
115 if (create_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
116 compression
, spp
, bps
, photometric
,
117 sampleformat
, planarconfig
,
118 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
119 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
122 if (read_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
123 compression
, spp
, bps
, photometric
,
124 sampleformat
, planarconfig
,
125 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
126 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
131 rowsperstrip
= YSIZE
;
132 if (create_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
133 compression
, spp
, bps
, photometric
,
134 sampleformat
, planarconfig
,
135 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
136 fprintf (stderr
, "Can't create TIFF file %s.\n", filename
);
139 if (read_image_striped(filename
, XSIZE
, YSIZE
, rowsperstrip
,
140 compression
, spp
, bps
, photometric
,
141 sampleformat
, planarconfig
,
142 (const tdata_t
) byte_array1
, byte_array1_size
) < 0) {
143 fprintf (stderr
, "Can't read TIFF file %s.\n", filename
);
155 /* vim: set ts=8 sts=8 sw=8 noet: */