TinyTIFF
a lightweight C/C++ library for reading and writing TIFF files
Loading...
Searching...
No Matches
tinytiffreader.h
1/*
2 Copyright (c) 2008-2024 Jan W. Krieger (<jan@jkrieger.de>), German Cancer Research Center (DKFZ) & IWR, University of Heidelberg
3
4 This software is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License (LGPL) as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17
18*/
19
20
21#ifndef TINYTIFFREADER_H
22#define TINYTIFFREADER_H
23
24#include "tinytiff_export.h"
25#include "tinytiff_defs.h"
26#include <stdint.h>
27
28
49typedef struct TinyTIFFReaderFile TinyTIFFReaderFile; // forward
50
51#ifdef __cplusplus
52extern "C" {
53#endif
63 TINYTIFF_EXPORT TinyTIFFReaderFile* TinyTIFFReader_open(const char* filename);
64
65
73 TINYTIFF_EXPORT void TinyTIFFReader_close(TinyTIFFReaderFile* tiff);
74
82 TINYTIFF_EXPORT const char* TinyTIFFReader_getLastError(TinyTIFFReaderFile* tiff);
83
87 TINYTIFF_EXPORT const char* TinyTIFFReader_getVersion();
88
95 TINYTIFF_EXPORT int TinyTIFFReader_wasError(TinyTIFFReaderFile* tiff);
96
103 TINYTIFF_EXPORT int TinyTIFFReader_success(TinyTIFFReaderFile* tiff);
104
111 TINYTIFF_EXPORT int TinyTIFFReader_hasNext(TinyTIFFReaderFile* tiff);
112
120 TINYTIFF_EXPORT int TinyTIFFReader_readNext(TinyTIFFReaderFile* tiff);
121
122
129 TINYTIFF_EXPORT uint32_t TinyTIFFReader_getWidth(TinyTIFFReaderFile* tiff);
130
137 TINYTIFF_EXPORT uint32_t TinyTIFFReader_getHeight(TinyTIFFReaderFile* tiff);
138
145 TINYTIFF_EXPORT const char* TinyTIFFReader_getImageDescription(TinyTIFFReaderFile* tiff);
146
147
148
155 TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSampleFormat(TinyTIFFReaderFile* tiff);
156
164 TINYTIFF_EXPORT uint16_t TinyTIFFReader_getBitsPerSample(TinyTIFFReaderFile* tiff, int sample);
165
172 TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSamplesPerPixel(TinyTIFFReaderFile* tiff);
173
179 TINYTIFF_EXPORT float TinyTIFFReader_getXResolution(TinyTIFFReaderFile* tiff);
180
181
187 TINYTIFF_EXPORT float TinyTIFFReader_getYResolution(TinyTIFFReaderFile* tiff);
188
189
195 TINYTIFF_EXPORT uint16_t TinyTIFFReader_getResolutionUnit(TinyTIFFReaderFile* tiff);
196
197
211 TINYTIFF_EXPORT int TinyTIFFReader_getSampleData(TinyTIFFReaderFile* tiff, void* buffer, uint16_t sample);
226 TINYTIFF_EXPORT int TinyTIFFReader_getSampleData_s(TinyTIFFReaderFile* tiff, void* buffer, unsigned long buffer_size, uint16_t sample);
227
228
229
236 TINYTIFF_EXPORT uint32_t TinyTIFFReader_countFrames(TinyTIFFReaderFile* tiff);
237
238#ifdef __cplusplus
239}
240#endif
241
242#endif // TINYTIFFREADER_H
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSampleFormat(TinyTIFFReaderFile *tiff)
return the sample format of the current frame
Definition tinytiffreader.c:1055
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getBitsPerSample(TinyTIFFReaderFile *tiff, int sample)
return the bits per sample of the current frame
Definition tinytiffreader.c:1062
TINYTIFF_EXPORT int TinyTIFFReader_readNext(TinyTIFFReaderFile *tiff)
reads the next frame from a multi-frame TIFF
Definition tinytiffreader.c:1024
TINYTIFF_EXPORT void TinyTIFFReader_close(TinyTIFFReaderFile *tiff)
close a given TIFF file
Definition tinytiffreader.c:1006
TINYTIFF_EXPORT TinyTIFFReaderFile * TinyTIFFReader_open(const char *filename)
open TIFF file for reading
Definition tinytiffreader.c:945
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getSamplesPerPixel(TinyTIFFReaderFile *tiff)
return the samples per pixel of the current frame
Definition tinytiffreader.c:1069
TINYTIFF_EXPORT uint16_t TinyTIFFReader_getResolutionUnit(TinyTIFFReaderFile *tiff)
return the base unit for resolution
Definition tinytiffreader.c:1120
TINYTIFF_EXPORT int TinyTIFFReader_wasError(TinyTIFFReaderFile *tiff)
returns TINYTIFF_TRUE (non-zero) when there was an error in the last function call,...
Definition tinytiffreader.c:332
TINYTIFF_EXPORT int TinyTIFFReader_getSampleData(TinyTIFFReaderFile *tiff, void *buffer, uint16_t sample)
read the given sample from the current frame into the given buffer, the byteorder is transformed to t...
Definition tinytiffreader.c:924
TINYTIFF_EXPORT uint32_t TinyTIFFReader_getWidth(TinyTIFFReaderFile *tiff)
return the width of the current frame
Definition tinytiffreader.c:1033
TINYTIFF_EXPORT uint32_t TinyTIFFReader_countFrames(TinyTIFFReaderFile *tiff)
return the width of the current frame
Definition tinytiffreader.c:1078
TINYTIFF_EXPORT int TinyTIFFReader_hasNext(TinyTIFFReaderFile *tiff)
returns TINYTIFF_TRUE (non-zero) if another frame exists in the TIFF file
Definition tinytiffreader.c:1015
TINYTIFF_EXPORT int TinyTIFFReader_getSampleData_s(TinyTIFFReaderFile *tiff, void *buffer, unsigned long buffer_size, uint16_t sample)
read the given sample from the current frame into the given buffer, the byteorder is transformed to t...
Definition tinytiffreader.c:928
TINYTIFF_EXPORT const char * TinyTIFFReader_getVersion()
returns the version number of TinyTIFFReader
Definition tinytiffreader.c:1127
TINYTIFF_EXPORT int TinyTIFFReader_success(TinyTIFFReaderFile *tiff)
returns TINYTIFF_TRUE (non-zero) when there was no error in the last function call,...
Definition tinytiffreader.c:337
TINYTIFF_EXPORT float TinyTIFFReader_getYResolution(TinyTIFFReaderFile *tiff)
return the pixels per basic resolution unit in image height direction
Definition tinytiffreader.c:1113
TINYTIFF_EXPORT const char * TinyTIFFReader_getLastError(TinyTIFFReaderFile *tiff)
returns a pointer to the last error message
Definition tinytiffreader.c:327
TINYTIFF_EXPORT const char * TinyTIFFReader_getImageDescription(TinyTIFFReaderFile *tiff)
return the image description of the current frame
Definition tinytiffreader.c:1047
TINYTIFF_EXPORT float TinyTIFFReader_getXResolution(TinyTIFFReaderFile *tiff)
return the pixels per basic resolution unit in image width direction
Definition tinytiffreader.c:1106
TINYTIFF_EXPORT uint32_t TinyTIFFReader_getHeight(TinyTIFFReaderFile *tiff)
return the height of the current frame
Definition tinytiffreader.c:1040
Definition tinytiffreader.c:154