Path Tracer
include
assimp
Bitmap.h
Go to the documentation of this file.
1
/*
2
---------------------------------------------------------------------------
3
Open Asset Import Library (assimp)
4
---------------------------------------------------------------------------
5
6
Copyright (c) 2006-2020, assimp team
7
8
9
10
All rights reserved.
11
12
Redistribution and use of this software in source and binary forms,
13
with or without modification, are permitted provided that the following
14
conditions are met:
15
16
* Redistributions of source code must retain the above
17
copyright notice, this list of conditions and the
18
following disclaimer.
19
20
* Redistributions in binary form must reproduce the above
21
copyright notice, this list of conditions and the
22
following disclaimer in the documentation and/or other
23
materials provided with the distribution.
24
25
* Neither the name of the assimp team, nor the names of its
26
contributors may be used to endorse or promote products
27
derived from this software without specific prior
28
written permission of the assimp team.
29
30
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41
---------------------------------------------------------------------------
42
*/
43
49
#pragma once
50
#ifndef AI_BITMAP_H_INC
51
#define AI_BITMAP_H_INC
52
53
#ifdef __GNUC__
54
# pragma GCC system_header
55
#endif
56
57
#include "
defs.h
"
58
#include <stdint.h>
59
#include <cstddef>
60
61
struct
aiTexture
;
62
63
namespace
Assimp
{
64
65
class
IOStream;
66
67
class
ASSIMP_API
Bitmap
{
68
protected
:
69
70
struct
Header
{
71
uint16_t type;
72
uint32_t size;
73
uint16_t reserved1;
74
uint16_t reserved2;
75
uint32_t offset;
76
77
// We define the struct size because sizeof(Header) might return a wrong result because of structure padding.
78
// Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field).
79
static
const
std::size_t header_size =
80
sizeof
(uint16_t) +
// type
81
sizeof
(uint32_t) +
// size
82
sizeof
(uint16_t) +
// reserved1
83
sizeof
(uint16_t) +
// reserved2
84
sizeof
(uint32_t);
// offset
85
};
86
87
struct
DIB
{
88
uint32_t size;
89
int32_t width;
90
int32_t height;
91
uint16_t planes;
92
uint16_t bits_per_pixel;
93
uint32_t compression;
94
uint32_t image_size;
95
int32_t x_resolution;
96
int32_t y_resolution;
97
uint32_t nb_colors;
98
uint32_t nb_important_colors;
99
100
// We define the struct size because sizeof(DIB) might return a wrong result because of structure padding.
101
// Moreover, we must use this ugly and error prone syntax because Visual Studio neither support constexpr or sizeof(name_of_field).
102
static
const
std::size_t dib_size =
103
sizeof
(uint32_t) +
// size
104
sizeof
(int32_t) +
// width
105
sizeof
(int32_t) +
// height
106
sizeof
(uint16_t) +
// planes
107
sizeof
(uint16_t) +
// bits_per_pixel
108
sizeof
(uint32_t) +
// compression
109
sizeof
(uint32_t) +
// image_size
110
sizeof
(int32_t) +
// x_resolution
111
sizeof
(int32_t) +
// y_resolution
112
sizeof
(uint32_t) +
// nb_colors
113
sizeof
(uint32_t);
// nb_important_colors
114
};
115
116
static
const
std::size_t mBytesPerPixel = 4;
117
118
public
:
119
static
void
Save(
aiTexture
* texture,
IOStream
* file);
120
121
protected
:
122
static
void
WriteHeader(
Header
& header,
IOStream
* file);
123
static
void
WriteDIB(
DIB
& dib,
IOStream
* file);
124
static
void
WriteData(
aiTexture
* texture,
IOStream
* file);
125
};
126
127
}
128
129
#endif // AI_BITMAP_H_INC
aiTexture
Definition:
texture.h:135
Assimp::Bitmap::Header
Definition:
Bitmap.h:70
Assimp::Bitmap::DIB
Definition:
Bitmap.h:87
defs.h
Assimp build configuration setup. See the notes in the comment blocks to find out how to customize yo...
Assimp::Bitmap
Definition:
Bitmap.h:67
Assimp
Definition:
ai_assert.h:50
Assimp::IOStream
CPP-API: Class to handle file I/O for C++.
Definition:
IOStream.hpp:75
Generated by
1.8.19