claw 1.9.0
 
Loading...
Searching...
No Matches
targa_file_structure.cpp
Go to the documentation of this file.
1/*
2 CLAW - a C++ Library Absolutely Wonderful
3
4 CLAW is a free library without any particular aim but being useful to
5 anyone.
6
7 Copyright (C) 2005-2011 Julien Jorge
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23 contact: julien.jorge@stuff-o-matic.com
24*/
31
32//************************ targa::file_structure::header
33//***********************
34
40
47 unsigned int h)
48{
49 id_length = 0;
50 color_map = 0;
51
52 image_type = true_color;
53
54 color_map_specification.first_entry_index = 0;
55 color_map_specification.length = 0;
56 color_map_specification.entry_size = 0;
57
58 image_specification.x_origin = 0;
59 image_specification.y_origin = 0;
60 image_specification.width = w;
61 image_specification.height = h;
62
63 image_specification.bpp = 32; // pixel32
64
65 image_specification.descriptor = 8; // unsigned char
66 image_specification.descriptor |= 0x20; // origin is top-left
67}
68
69//************** targa::file_structure::header::specification
70//******************
71
80
89
93unsigned char
98
99//********************* targa::file_structure::footer
100//**************************
101
102const std::string claw::graphic::targa::file_structure::footer::s_signature(
103 "TRUEVISION-XFILE.");
104
111{
112 std::copy(s_signature.begin(), s_signature.end(), signature);
113 signature[s_signature.length()] = '\0';
114}
115
120{
121 return std::equal(s_signature.begin(), s_signature.end(), signature)
122 && signature[s_signature.length()] == '\0';
123}
char signature[18]
Footer identier. Must be as long as std::string("TRUEVISION-XFILE.") + 1 (for the last '\0').
Definition targa.hpp:165
bool is_valid() const
Tell if the data of this footer is valid.
unsigned int developer_offset
Offset of the developer directory.
Definition targa.hpp:161
unsigned int extension_offset
Offset of the extension area.
Definition targa.hpp:158
specification image_specification
The specification of the image.
Definition targa.hpp:123
struct claw::graphic::targa::file_structure::header::@244140121240111107105021326247270144031175023050 color_map_specification
Color map specification.
char id_length
Image identifier length.
Definition targa.hpp:84
char color_map
1 if there is a color map, 0 otherwise.
Definition targa.hpp:86
unsigned char alpha() const
Number of bits per pixel assigned to alpha chanel.
bool left_right_oriented() const
Is image stored left to right ?
A class for targa pictures.