| 1 |
/* RCSid: $Id$ */
|
| 2 |
/*
|
| 3 |
* tardev.h - header file for reading and writing Targa format files.
|
| 4 |
*/
|
| 5 |
/* ====================================================================
|
| 6 |
* The Radiance Software License, Version 1.0
|
| 7 |
*
|
| 8 |
* Copyright (c) 1990 - 2002 The Regents of the University of California,
|
| 9 |
* through Lawrence Berkeley National Laboratory. All rights reserved.
|
| 10 |
*
|
| 11 |
* Redistribution and use in source and binary forms, with or without
|
| 12 |
* modification, are permitted provided that the following conditions
|
| 13 |
* are met:
|
| 14 |
*
|
| 15 |
* 1. Redistributions of source code must retain the above copyright
|
| 16 |
* notice, this list of conditions and the following disclaimer.
|
| 17 |
*
|
| 18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
| 19 |
* notice, this list of conditions and the following disclaimer in
|
| 20 |
* the documentation and/or other materials provided with the
|
| 21 |
* distribution.
|
| 22 |
*
|
| 23 |
* 3. The end-user documentation included with the redistribution,
|
| 24 |
* if any, must include the following acknowledgment:
|
| 25 |
* "This product includes Radiance software
|
| 26 |
* (http://radsite.lbl.gov/)
|
| 27 |
* developed by the Lawrence Berkeley National Laboratory
|
| 28 |
* (http://www.lbl.gov/)."
|
| 29 |
* Alternately, this acknowledgment may appear in the software itself,
|
| 30 |
* if and wherever such third-party acknowledgments normally appear.
|
| 31 |
*
|
| 32 |
* 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
|
| 33 |
* and "The Regents of the University of California" must
|
| 34 |
* not be used to endorse or promote products derived from this
|
| 35 |
* software without prior written permission. For written
|
| 36 |
* permission, please contact [email protected].
|
| 37 |
*
|
| 38 |
* 5. Products derived from this software may not be called "Radiance",
|
| 39 |
* nor may "Radiance" appear in their name, without prior written
|
| 40 |
* permission of Lawrence Berkeley National Laboratory.
|
| 41 |
*
|
| 42 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
| 43 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
| 44 |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
| 45 |
* DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
|
| 46 |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 47 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 48 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
| 49 |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
| 50 |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
| 51 |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
| 52 |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
| 53 |
* SUCH DAMAGE.
|
| 54 |
* ====================================================================
|
| 55 |
*
|
| 56 |
* This software consists of voluntary contributions made by many
|
| 57 |
* individuals on behalf of Lawrence Berkeley National Laboratory. For more
|
| 58 |
* information on Lawrence Berkeley National Laboratory, please see
|
| 59 |
* <http://www.lbl.gov/>.
|
| 60 |
*/
|
| 61 |
|
| 62 |
/* header structure adapted from tardev.h */
|
| 63 |
struct hdStruct {
|
| 64 |
char textSize; /* size of info. line ( < 256) */
|
| 65 |
char mapType; /* color map type */
|
| 66 |
char dataType; /* data type */
|
| 67 |
int mapOrig; /* first color index */
|
| 68 |
int mapLength; /* length of file map */
|
| 69 |
char CMapBits; /* bits per map entry */
|
| 70 |
int XOffset; /* picture offset */
|
| 71 |
int YOffset;
|
| 72 |
int x; /* picture size */
|
| 73 |
int y;
|
| 74 |
int dataBits; /* bits per pixel */
|
| 75 |
int imType; /* image descriptor byte */
|
| 76 |
};
|
| 77 |
|
| 78 |
#define IM_NODATA 0 /* no data included */
|
| 79 |
#define IM_CMAP 1 /* color-mapped */
|
| 80 |
#define IM_RGB 2 /* straight RGB */
|
| 81 |
#define IM_MONO 3 /* straight monochrome */
|
| 82 |
#define IM_CCMAP 9 /* compressed color-mapped */
|
| 83 |
#define IM_CRGB 10 /* compressed RGB */
|
| 84 |
#define IM_CMONO 11 /* compressed monochrome */
|
| 85 |
|
| 86 |
/* color map types */
|
| 87 |
#define CM_NOMAP 0 /* no color map */
|
| 88 |
#define CM_HASMAP 1 /* has color map */
|
| 89 |
|
| 90 |
#define bits_bytes(n) (((n)+7)>>3) /* number of bits to number of bytes */
|