| 1 | /* |
| 2 | Copyright (C) 2000 Marco Ziech |
| 3 | Copyright (C) 2000 Ross Combs ([email protected]) |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 2 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program; if not, write to the Free Software |
| 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | */ |
| 19 | #ifndef INCLUDED_TGA_H |
| 20 | #define INCLUDED_TGA_Hcxx . . $ `src/bniutils/tga.h:20:9`! |
| 21 | |
| 22 | #include <cstdint> |
| 23 | #include <cstdio> |
| 24 | |
| 25 | |
| 26 | namespace pvpgncxx . . $ pvpgn/ |
| 27 | { |
| 28 | |
| 29 | namespace bnicxx . . $ pvpgn/bni/ |
| 30 | { |
| 31 | |
| 32 | typedef structcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0# |
| 33 | { |
| 34 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# idlencxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#idlen.; /* number of bytes in Field 6: 0==no id */ |
| 35 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# cmaptypecxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#cmaptype.; /* colormap: 0==none, 1==included, <128==TrueVision, >=128==developer */ |
| 36 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# imgtypecxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#imgtype.; /* pixel format: <128==TrueVision, >=128==developer */ |
| 37 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# cmapfirstcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#cmapfirst.; /* first entry offset */ |
| 38 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# cmaplencxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#cmaplen.; /* number of colormap entries */ |
| 39 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# cmapescxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#cmapes.; /* size of a single colormap entry in bits, 15 forces 1 attribute bit, 32 forces 8 */ |
| 40 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# xorigincxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#xorigin.; /* x coordinate of lower left hand corner with origin at left of screen */ |
| 41 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# yorigincxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#yorigin.; /* y coordinate of lower left hand corner with origin at bottom of screen */ |
| 42 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# widthcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#width.; /* width in pixels */ |
| 43 | stdcxx . . $ std/::uint16_tcxx . . $ std/uint16_t# heightcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#height.; /* height in pixels */ |
| 44 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# bppcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#bpp.; /* bits per pixel, including attributes and alpha channel */ |
| 45 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t# desccxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#desc.; /* image descriptor: bits 0,1,2,3==num attribute bits per pixel, bit 4==horizontal order, bit 5==vertical order, bits 6,7==interleaving */ |
| 46 | /* field 6, optional */ |
| 47 | /* field 7, colormap data in ARGB, optional, entries are (min(cmapes/3,8)*3+7)/8 bits wide */ |
| 48 | stdcxx . . $ std/::uint8_tcxx . . $ std/uint8_t#* datacxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#data.; |
| 49 | /* field 9, developer area, optional */ |
| 50 | /* field 10, extension area, optional */ |
| 51 | stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# extareaoffcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#extareaoff.; /* extension area offset, 0==none */ |
| 52 | stdcxx . . $ std/::uint32_tcxx . . $ std/uint32_t# devareaoffcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_0#devareaoff.; /* developer area offset, 0==none */ |
| 53 | /* magic, null terminated */ |
| 54 | } t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg#; |
| 55 | |
| 56 | typedef enumcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_1# |
| 57 | { |
| 58 | tgaimgtype_emptycxx . . $ pvpgn/bni/tgaimgtype_empty. = 0, |
| 59 | tgaimgtype_uncompressed_mappedcxx . . $ pvpgn/bni/tgaimgtype_uncompressed_mapped. = 1, |
| 60 | tgaimgtype_uncompressed_truecolorcxx . . $ pvpgn/bni/tgaimgtype_uncompressed_truecolor. = 2, |
| 61 | tgaimgtype_uncompressed_monochromecxx . . $ pvpgn/bni/tgaimgtype_uncompressed_monochrome. = 3, |
| 62 | tgaimgtype_rlecompressed_mappedcxx . . $ pvpgn/bni/tgaimgtype_rlecompressed_mapped. = 9, |
| 63 | tgaimgtype_rlecompressed_truecolorcxx . . $ pvpgn/bni/tgaimgtype_rlecompressed_truecolor. = 10, |
| 64 | tgaimgtype_rlecompressed_monochromecxx . . $ pvpgn/bni/tgaimgtype_rlecompressed_monochrome. = 11, |
| 65 | tgaimgtype_huffman_mappedcxx . . $ pvpgn/bni/tgaimgtype_huffman_mapped. = 32, |
| 66 | tgaimgtype_huffman_4pass_mappedcxx . . $ pvpgn/bni/tgaimgtype_huffman_4pass_mapped. = 33 |
| 67 | } t_tgaimgtypecxx . . $ pvpgn/bni/t_tgaimgtype#; |
| 68 | |
| 69 | typedef enumcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_2# { |
| 70 | tgadesc_attrbits0cxx . . $ pvpgn/bni/tgadesc_attrbits0. = 1, |
| 71 | tgadesc_attrbits1cxx . . $ pvpgn/bni/tgadesc_attrbits1. = 2, |
| 72 | tgadesc_attrbits2cxx . . $ pvpgn/bni/tgadesc_attrbits2. = 4, |
| 73 | tgadesc_attrbits3cxx . . $ pvpgn/bni/tgadesc_attrbits3. = 8, |
| 74 | tgadesc_horzcxx . . $ pvpgn/bni/tgadesc_horz. = 16, |
| 75 | tgadesc_vertcxx . . $ pvpgn/bni/tgadesc_vert. = 32, |
| 76 | tgadesc_interleave1cxx . . $ pvpgn/bni/tgadesc_interleave1. = 64, |
| 77 | tgadesc_interleave2cxx . . $ pvpgn/bni/tgadesc_interleave2. = 128 |
| 78 | } t_tgadesccxx . . $ pvpgn/bni/t_tgadesc#; |
| 79 | |
| 80 | typedef enumcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_3# { |
| 81 | tgacmap_nonecxx . . $ pvpgn/bni/tgacmap_none. = 0, |
| 82 | tgacmap_includedcxx . . $ pvpgn/bni/tgacmap_included. = 1 |
| 83 | } t_tgacmapcxx . . $ pvpgn/bni/t_tgacmap#; |
| 84 | |
| 85 | typedef enumcxx . . $ pvpgn/bni/$anonymous_type_5814204c52cb45dd_4# { |
| 86 | RLEcxx . . $ pvpgn/bni/RLE., |
| 87 | RAWcxx . . $ pvpgn/bni/RAW. |
| 88 | } t_tgapkttypecxx . . $ pvpgn/bni/t_tgapkttype#; |
| 89 | |
| 90 | /* "new" style TGA allowing for developer and extension areas must have this magic at |
| 91 | the end of the file */ |
| 92 | #define TGAMAGICcxx . . $ `src/bniutils/tga.h:92:9`! "TRUEVISION-XFILE." |
| 93 | |
| 94 | extern t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * new_tgaimgcxx . . $ pvpgn/bni/new_tgaimg(c336b9b97445332).(unsigned int width, unsigned int height, unsigned int bpp, t_tgaimgtypecxx . . $ pvpgn/bni/t_tgaimgtype# imgtype); |
| 95 | extern int getpixelsizecxx . . $ pvpgn/bni/getpixelsize(5314f7cd3df64b7e).(t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# const *img); |
| 96 | extern t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * load_tgaheadercxx . . $ pvpgn/bni/load_tgaheader(bf631a1f9eee4486).(void); |
| 97 | extern t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * load_tgacxx . . $ pvpgn/bni/load_tga(d209b58585032934).(stdcxx . . $ std/::FILEcxx . . $ std/FILE# *f); |
| 98 | extern int write_tgacxx . . $ pvpgn/bni/write_tga(790b6d97a440dd74).(stdcxx . . $ std/::FILEcxx . . $ std/FILE# *f, t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# *img); |
| 99 | extern void destroy_imgcxx . . $ pvpgn/bni/destroy_img(537e23c0c2dd1c71).(t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# * img); |
| 100 | extern void print_tga_infocxx . . $ pvpgn/bni/print_tga_info(bced1c5b17084774).(t_tgaimgcxx . . $ pvpgn/bni/t_tgaimg# const * img, stdcxx . . $ std/::FILEcxx . . $ std/FILE# * fp); |
| 101 | |
| 102 | } |
| 103 | |
| 104 | } |
| 105 | #endif |
| 106 |