34 #include "../api_display.h"
36 #include "../../Core/Math/rect.h"
37 #include "texture_format.h"
38 #include "buffer_usage.h"
51 class PixelBuffer_Impl;
55 class PixelBufferProvider;
85 PixelBuffer(
int width,
int height,
TextureFormat texture_format,
const void *data = 0,
bool only_reference_data =
false);
90 PixelBuffer(
const std::string &fullname,
bool srgb =
false);
120 void throw_if_null()
const;
129 int get_width()
const;
132 int get_height()
const;
135 Size get_size()
const;
138 int get_pitch()
const;
143 const void *get_data()
const;
149 template<
typename Type>
const Type *
get_data()
const {
return reinterpret_cast<Type*
>(
get_data()); }
152 unsigned char *
get_data_uint8() {
return reinterpret_cast<unsigned char*
>(get_data()); }
153 const unsigned char *
get_data_uint8()
const {
return reinterpret_cast<const unsigned char*
>(get_data()); }
156 unsigned short *
get_data_uint16() {
return reinterpret_cast<unsigned short*
>(get_data()); }
157 const unsigned short *
get_data_uint16()
const {
return reinterpret_cast<const unsigned short*
>(get_data()); }
160 unsigned int *
get_data_uint32() {
return reinterpret_cast<unsigned int*
>(get_data()); }
161 const unsigned int *
get_data_uint32()
const {
return reinterpret_cast<const unsigned int*
>(get_data()); }
164 void *
get_line(
int line) {
unsigned char *d = get_data_uint8();
return d + line * get_pitch(); }
165 const void *
get_line(
int line)
const {
const unsigned char *d = get_data_uint8();
return d + line * get_pitch(); }
168 unsigned char *
get_line_uint8(
int line) {
return reinterpret_cast<unsigned char*
>(get_line(line)); }
169 const unsigned char *
get_line_uint8(
int line)
const {
return reinterpret_cast<const unsigned char*
>(get_line(line)); }
172 unsigned short *
get_line_uint16(
int line) {
return reinterpret_cast<unsigned short*
>(get_line(line)); }
173 const unsigned short *
get_line_uint16(
int line)
const {
return reinterpret_cast<const unsigned short*
>(get_line(line)); }
176 unsigned int *
get_line_uint32(
int line) {
return reinterpret_cast<unsigned int*
>(get_line(line)); }
177 const unsigned int *
get_line_uint32(
int line)
const {
return reinterpret_cast<const unsigned int*
>(get_line(line)); }
180 bool has_transparency()
const;
185 unsigned int get_bytes_per_pixel()
const;
190 unsigned int get_bytes_per_block()
const;
195 unsigned int get_data_size()
const;
200 static unsigned int get_data_size(
const Size &size,
TextureFormat texture_format);
205 static unsigned int get_bytes_per_pixel(
TextureFormat texture_format);
210 static unsigned int get_bytes_per_block(
TextureFormat texture_format);
213 bool is_compressed()
const;
227 Colorf get_pixel(
int x,
int y);
245 operator bool ()
const;
288 void flip_vertical();
293 void premultiply_alpha();
299 void premultiply_gamma(
float gamma);
306 std::shared_ptr<PixelBuffer_Impl> impl;
307 friend class PixelBuffer_Impl;
const Type * get_data() const
Definition: pixel_buffer.h:149
unsigned short * get_data_uint16()
Returns a pointer to the beginning of the pixel buffer as 16 bit data.
Definition: pixel_buffer.h:156
Floating point color description class (for float).
Definition: color.h:661
bool is_null() const
Returns true if this object is invalid.
Definition: pixel_buffer.h:117
I/O Device interface.
Definition: iodevice.h:51
Pixel data container.
Definition: pixel_buffer.h:69
Use of the pixel buffer is to send data to the gpu.
Definition: pixel_buffer.h:62
Element Array Buffer provider.
Definition: pixel_buffer_provider.h:42
const unsigned int * get_data_uint32() const
Definition: pixel_buffer.h:161
const unsigned int * get_line_uint32(int line) const
Definition: pixel_buffer.h:177
PixelBufferDirection
Pixel buffer prefered direction.
Definition: pixel_buffer.h:59
const unsigned char * get_data_uint8() const
Definition: pixel_buffer.h:153
const unsigned short * get_data_uint16() const
Definition: pixel_buffer.h:157
const unsigned short * get_line_uint16(int line) const
Definition: pixel_buffer.h:173
2D (left,top,right,bottom) rectangle structure - Integer
Definition: rect.h:453
unsigned short * get_line_uint16(int line)
Returns a pointer to the beginning of a specific line as 16 bit data.
Definition: pixel_buffer.h:172
Type * get_data()
Definition: pixel_buffer.h:148
void * get_line(int line)
Returns a pointer to the beginning of a specific line.
Definition: pixel_buffer.h:164
Virtual File System (VFS).
Definition: file_system.h:48
TextureFormat
Texture format.
Definition: texture_format.h:41
Use of the pixel buffer is to retrieve data from the gpu.
Definition: pixel_buffer.h:65
Low level pixel format converter class.
Definition: pixel_converter.h:46
unsigned int * get_data_uint32()
Returns a pointer to the beginning of the pixel buffer as 32 bit data.
Definition: pixel_buffer.h:160
unsigned char * get_line_uint8(int line)
Returns a pointer to the beginning of a specific line as 8 bit data.
Definition: pixel_buffer.h:168
Interface to drawing graphics.
Definition: graphic_context.h:257
2D (x,y) point structure - Integer
Definition: point.h:63
const unsigned char * get_line_uint8(int line) const
Definition: pixel_buffer.h:169
const void * get_line(int line) const
Definition: pixel_buffer.h:165
unsigned int * get_line_uint32(int line)
Returns a pointer to the beginning of a specific line as 32 bit data.
Definition: pixel_buffer.h:176
BufferAccess
Array Buffer access enum.
Definition: buffer_usage.h:55
2D (width,height) size structure - Integer
Definition: size.h:157
unsigned char * get_data_uint8()
Returns a pointer to the beginning of the pixel buffer as 8 bit data.
Definition: pixel_buffer.h:152