Main Page | Class Hierarchy | Class List | File List | Class Members

# tiffWriter.h

    00001 /*
    00002     tiffWriter.h
    00003     Header file for tiff image writers.
    00004
    00005     George J. Grevera, Ph.D., ggrevera@sju.edu, grevera@mipg.upenn.edu
    00006
    00007     Copyright (C) 2002, George J. Grevera
    00008
    00009     This program is free software; you can redistribute it and/or modify
    00010     it under the terms of the GNU General Public License as published by
    00011     the Free Software Foundation.
    00012
    00013     This program is distributed in the hope that it will be useful,
    00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00016     GNU General Public License for more details.
    00017
    00018     You should have received a copy of the GNU General Public License
    00019     along with this program; if not, write to the Free Software
    00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
    00021     USA or from http://www.gnu.org/licenses/gpl.txt.
    00022
    00023     This General Public License does not permit incorporating this
    00024     code into proprietary programs.  (So a hypothetical company such
    00025     as GH (Generally Hectic) should NOT incorporate this code into
    00026     their proprietary programs.)
    00027 */
    00028 #ifndef tiffWriter_h
    00029 #define tiffWriter_h
    00030 //----------------------------------------------------------------------
    00031 #ifndef uint8
    00032     #define uint8   unsigned char
    00033     #define uint16  unsigned short
    00034     #define uint32  unsigned int
    00035 #endif
    00036 //----------------------------------------------------------------------
    00038 class CLUT {
    00039 public:
    00040     int r_entries;
    00041     int r_first_value;
    00042     int r_num_bits;
    00043     int r_bytes;
    00044     union {
    00045         uint8*  r_table8;
    00046         uint16* r_table16;
    00047     };
    00048
    00049     int g_entries, g_first_value, g_num_bits, g_bytes;
    00050     union {
    00051         uint8*  g_table8;
    00052         uint16* g_table16;
    00053     };
    00054
    00055     int b_entries, b_first_value, b_num_bits, b_bytes;
    00056     union {
    00057         uint8*  b_table8;
    00058         uint16* b_table16;
    00059     };
    00060
    00061     CLUT ( ) {
    00062         this->r_entries = this->g_entries = this->b_entries = 0;
    00063         this->r_first_value = this->g_first_value = this->b_first_value = 0;
    00064         this->r_num_bits = this->g_num_bits = this->b_num_bits = 0;
    00065         this->r_bytes = this->g_bytes = this->b_bytes = 0;
    00066         this->r_table8 = this->g_table8 = this->b_table8 = NULL;
    00067     };
    00068 };
    00069
    00070 extern CLUT clut;
    00071 //----------------------------------------------------------------------
    00072 //note: either specify use_clut or samples_per_pixel (1=grey, 3=rgb)
    00074 void write_tiff_data8_rgb ( uint8* buff, int width, int height, FILE* fp,
    00075                             const bool use_clut, const int samples_per_pixel );
    00076
    00077 void write_tiff_float_grey ( const float* const buff, const int width, const int height,
    00078                              const char* const fname );
    00079
    00080 void write_tiff_double_grey ( const double* const buff, const int width, const int height,
    00081                              const char* const fname );
    00082
    00083 void write_tiff_data8_grey ( uint8* buff, int width, int height, FILE* fp,
    00084                              const int samples_per_pixel );
    00085
    00086 void write_tiff_data16 ( uint16* buff, int width, int height, FILE* fp );
    00087
    00088 #endif
    00089 //----------------------------------------------------------------------