#include <texture.hpp>
Definition at line 55 of file texture.hpp.
Public Member Functions | |
void | clear (const color &c) |
int | get_height () const |
unsigned char * | get_pointer () |
int | get_width () const |
rgba_buffer (int width, int height, const color &c=color::WHITE) | |
Creates a blank buffer in memory. | |
rgba_buffer (SDL_Surface *surface) | |
Creates a buffer from an SDL surface. | |
rgba_buffer (const gsgl::string &fname) | |
Creates a memory-mapped buffer from an existing file. | |
void | save (const gsgl::string &fname) |
Saves to a file to be memory-mapped. | |
~rgba_buffer () | |
Private Member Functions | |
void | flip_vertical () |
Private Attributes | |
unsigned char * | buffer |
int | height |
mapped_file * | mf |
int | width |
rgba_buffer | ( | const gsgl::string & | fname | ) |
Creates a memory-mapped buffer from an existing file.
Definition at line 60 of file texture.cpp.
References rgba_buffer::buffer, file::exists(), gsgl::io::FILE_OPEN_READ, gsgl::io::FILE_OPEN_WRITE, file::get_full_path(), rgba_buffer::height, rgba_buffer::mf, string::w_string(), and rgba_buffer::width.
rgba_buffer | ( | SDL_Surface * | surface | ) |
Creates a buffer from an SDL surface.
Definition at line 78 of file texture.cpp.
References rgba_buffer::buffer, and rgba_buffer::flip_vertical().
rgba_buffer | ( | int | width, | |
int | height, | |||
const color & | c = color::WHITE | |||
) |
Creates a blank buffer in memory.
Definition at line 132 of file texture.cpp.
References rgba_buffer::buffer, and rgba_buffer::clear().
~rgba_buffer | ( | ) |
void clear | ( | const color & | c | ) |
Definition at line 169 of file texture.cpp.
References rgba_buffer::buffer, color::COMPONENT_ALPHA, color::COMPONENT_BLUE, color::COMPONENT_GREEN, color::COMPONENT_RED, rgba_buffer::height, and rgba_buffer::width.
Referenced by rgba_buffer::rgba_buffer().
void flip_vertical | ( | ) | [private] |
Definition at line 187 of file texture.cpp.
References rgba_buffer::buffer, rgba_buffer::height, and rgba_buffer::width.
Referenced by rgba_buffer::rgba_buffer().
int get_height | ( | ) | const [inline] |
Definition at line 69 of file texture.hpp.
Referenced by texture_impl::bind(), and texture_impl::update().
unsigned char* get_pointer | ( | ) | [inline] |
Definition at line 70 of file texture.hpp.
Referenced by texture_impl::bind(), and texture_impl::update().
int get_width | ( | ) | const [inline] |
Definition at line 68 of file texture.hpp.
Referenced by texture_impl::bind(), and texture_impl::update().
void save | ( | const gsgl::string & | fname | ) |
Saves to a file to be memory-mapped.
Definition at line 154 of file texture.cpp.
References rgba_buffer::buffer, gsgl::io::FILE_OPEN_BINARY, gsgl::io::FILE_OPEN_WRITE, rgba_buffer::height, rgba_buffer::width, and fd_stream::write().
unsigned char* buffer [private] |
Definition at line 58 of file texture.hpp.
Referenced by rgba_buffer::clear(), rgba_buffer::flip_vertical(), rgba_buffer::rgba_buffer(), rgba_buffer::save(), and rgba_buffer::~rgba_buffer().
int height [private] |
Definition at line 57 of file texture.hpp.
Referenced by rgba_buffer::clear(), rgba_buffer::flip_vertical(), rgba_buffer::rgba_buffer(), and rgba_buffer::save().
mapped_file* mf [private] |
Definition at line 60 of file texture.hpp.
Referenced by rgba_buffer::rgba_buffer(), and rgba_buffer::~rgba_buffer().
int width [private] |
Definition at line 57 of file texture.hpp.
Referenced by rgba_buffer::clear(), rgba_buffer::flip_vertical(), rgba_buffer::rgba_buffer(), and rgba_buffer::save().