Beatmup
|
A very basic class for any image. More...
#include <abstract_bitmap.h>
Classes | |
class | ReadLock |
Locks a bitmap for reading on CPU. More... | |
class | WriteLock |
Makes a bitmap writable for a specific target device. More... | |
Public Member Functions | |
virtual const int | getDepth () const |
Depth of the texture in pixels. More... | |
virtual const TextureFormat | getTextureFormat () const |
Returns the texture format specifying how the shader must interpret the data. More... | |
virtual const PixelFormat | getPixelFormat () const =0 |
Pixel format of the bitmap. More... | |
virtual const msize | getMemorySize () const =0 |
Bitmap size in bytes. More... | |
bool | isUpToDate (ProcessingTarget) const |
bool | isDirty () const |
Returns true if the bitmap does not contain any valid content. More... | |
virtual const pixbyte * | getData (int x, int y) const =0 |
Returns a pointer to given pixel. More... | |
virtual pixbyte * | getData (int x, int y)=0 |
int | getPixelInt (int x, int y, int cha=0) const |
Retrieves integer value of given channel at given pixel. More... | |
const unsigned char | getBitsPerPixel () const |
Returns number of bits per pixel stored in each bitmap. More... | |
const unsigned char | getNumberOfChannels () const |
Returns number of bytes per pixel stored in each bitmap. More... | |
const ImageResolution | getSize () const |
Returns the bitmap resolution within ImageResolution object. More... | |
Context & | getContext () const |
void | zero () |
Sets all the pixels to zero. More... | |
bool | isInteger () const |
Returns true if the bitmap contains integer values, false otherwise. More... | |
bool | isFloat () const |
Returns true if the bitmap contains floating point values, false otherwise. More... | |
bool | isMask () const |
Returns true if the bitmap is a mask, false otherwise. More... | |
std::string | toString () const |
Retruns a string describing the bitmap. More... | |
void | saveBmp (const char *filename) |
Saves the bitmap to a BMP file. More... | |
~AbstractBitmap () | |
Public Member Functions inherited from Beatmup::GL::TextureHandler | |
~TextureHandler () | |
virtual const int | getWidth () const =0 |
Width of the texture in pixels. More... | |
virtual const int | getHeight () const =0 |
Height of the texture in pixels. More... | |
float | getAspectRatio () const |
Aspect ratio of the texture. More... | |
float | getInvAspectRatio () const |
Inverse of the aspect ratio of the texture. More... | |
const bool | isFloatingPoint () const |
const int | getNumberOfChannels () const |
Returns number of channels containing in the texture. More... | |
bool | hasValidHandle () const |
Returns true if the texture handle points to a valid texture. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Static Public Member Functions | |
static bool | isInteger (PixelFormat pixelFormat) |
Returns true if a given pixel format corresponds to integer values, false otherwise. More... | |
static bool | isFloat (PixelFormat pixelFormat) |
Returns true if a given pixel format corresponds to floating point values, false otherwise. More... | |
static bool | isMask (PixelFormat pixelFormat) |
Returns true if a given pixel format corresponds to a mask, false otherwise. More... | |
Static Public Member Functions inherited from Beatmup::GL::TextureHandler | |
static const char * | textureFormatToString (const TextureFormat &) |
Static Public Attributes | |
static const int | NUM_PIXEL_FORMATS = 9 |
static const char * | PIXEL_FORMAT_NAMES [NUM_PIXEL_FORMATS] |
pixel format names More... | |
static const unsigned char | CHANNELS_PER_PIXEL [NUM_PIXEL_FORMATS] |
number of channels for each pixel format More... | |
static const unsigned char | BITS_PER_PIXEL [NUM_PIXEL_FORMATS] |
number of bits per pixel for each pixel format More... | |
Static Public Attributes inherited from Beatmup::GL::TextureHandler | |
static const int | TEXTURE_FORMAT_BYTES_PER_PIXEL [] |
size of a texel in bytes for different texture formats More... | |
Protected Member Functions | |
AbstractBitmap (Context &ctx) | |
virtual void | lockPixelData ()=0 |
Locks access to the CPU memory buffer containing pixel data. More... | |
virtual void | unlockPixelData ()=0 |
Unlocks access to the CPU memory buffer containing pixel data. More... | |
virtual void | prepare (GraphicPipeline &gpu) |
Prepares (eventually uploads) texture data on GPU. More... | |
Protected Member Functions inherited from Beatmup::GL::TextureHandler | |
TextureHandler () | |
void | invalidate (RecycleBin &) |
Forces disposing the texture data, e.g. More... | |
Protected Attributes | |
Context & | ctx |
context managing this bitmap More... | |
bool | upToDate [2] |
bitmap up-to-date state on CPU and GPU More... | |
Protected Attributes inherited from Beatmup::GL::TextureHandler | |
handle_t | textureHandle |
Private Member Functions | |
AbstractBitmap (const AbstractBitmap &that)=delete | |
disabling copying constructor More... | |
Friends | |
class | GraphicPipeline |
class | BitmapContentLock |
class | AbstractBitmap::ReadLock |
class | AbstractBitmap::WriteLock< ProcessingTarget::CPU > |
class | AbstractBitmap::WriteLock< ProcessingTarget::GPU > |
Additional Inherited Members | |
Public Types inherited from Beatmup::GL::TextureHandler | |
enum | TextureFormat { Rx8 , RGBx8 , RGBAx8 , Rx32f , RGBx32f , RGBAx32f , OES_Ext } |
Texture format, specifies how the texture should be interpreted on the shader side. More... | |
A very basic class for any image.
Contains interfaces to access the bitmap information and its content.
Definition at line 87 of file abstract_bitmap.h.
|
privatedelete |
disabling copying constructor
|
protected |
Definition at line 208 of file abstract_bitmap.cpp.
AbstractBitmap::~AbstractBitmap | ( | ) |
Definition at line 214 of file abstract_bitmap.cpp.
|
protectedpure virtual |
Locks access to the CPU memory buffer containing pixel data.
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, Beatmup::GDIBitmap, and Beatmup::InternalBitmap.
|
protectedpure virtual |
Unlocks access to the CPU memory buffer containing pixel data.
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, Beatmup::GDIBitmap, and Beatmup::InternalBitmap.
|
protectedvirtual |
Prepares (eventually uploads) texture data on GPU.
Called only by the context managing thread.
[in] | gpu | Graphic pipeline instance |
Reimplemented from Beatmup::GL::TextureHandler.
Reimplemented in Beatmup::Android::ExternalBitmap.
Definition at line 54 of file abstract_bitmap.cpp.
|
inlinevirtual |
Depth of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Reimplemented in Beatmup::Android::ExternalBitmap.
Definition at line 127 of file abstract_bitmap.h.
|
virtual |
Returns the texture format specifying how the shader must interpret the data.
Implements Beatmup::GL::TextureHandler.
Reimplemented in Beatmup::Android::ExternalBitmap.
Definition at line 99 of file abstract_bitmap.cpp.
|
pure virtual |
Pixel format of the bitmap.
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, Beatmup::GDIBitmap, and Beatmup::InternalBitmap.
|
pure virtual |
Bitmap size in bytes.
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, Beatmup::GDIBitmap, and Beatmup::InternalBitmap.
bool AbstractBitmap::isUpToDate | ( | ProcessingTarget | target | ) | const |
Definition at line 106 of file abstract_bitmap.cpp.
bool AbstractBitmap::isDirty | ( | ) | const |
Returns true
if the bitmap does not contain any valid content.
Definition at line 111 of file abstract_bitmap.cpp.
|
pure virtual |
Returns a pointer to given pixel.
x | target pixel horizontal coordinate |
y | target pixel vertical coordinate |
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, Beatmup::GDIBitmap, and Beatmup::InternalBitmap.
|
pure virtual |
Implemented in Beatmup::Python::Bitmap, Beatmup::Android::ExternalBitmap, Beatmup::Android::Bitmap, and Beatmup::InternalBitmap.
int AbstractBitmap::getPixelInt | ( | int | x, |
int | y, | ||
int | cha = 0 |
||
) | const |
Retrieves integer value of given channel at given pixel.
x | target pixel horizontal coordinate |
y | target pixel vertical coordinate |
cha | target channel |
Definition at line 116 of file abstract_bitmap.cpp.
const unsigned char AbstractBitmap::getBitsPerPixel | ( | ) | const |
Returns number of bits per pixel stored in each bitmap.
Definition at line 133 of file abstract_bitmap.cpp.
const unsigned char AbstractBitmap::getNumberOfChannels | ( | ) | const |
Returns number of bytes per pixel stored in each bitmap.
Definition at line 138 of file abstract_bitmap.cpp.
|
inline |
Returns the bitmap resolution within ImageResolution object.
Definition at line 178 of file abstract_bitmap.h.
Context & AbstractBitmap::getContext | ( | ) | const |
Definition at line 221 of file abstract_bitmap.cpp.
void AbstractBitmap::zero | ( | ) |
Sets all the pixels to zero.
Definition at line 226 of file abstract_bitmap.cpp.
bool AbstractBitmap::isInteger | ( | ) | const |
Returns true
if the bitmap contains integer values, false
otherwise.
Definition at line 143 of file abstract_bitmap.cpp.
bool AbstractBitmap::isFloat | ( | ) | const |
Returns true
if the bitmap contains floating point values, false
otherwise.
Definition at line 148 of file abstract_bitmap.cpp.
bool AbstractBitmap::isMask | ( | ) | const |
Returns true
if the bitmap is a mask, false
otherwise.
Definition at line 153 of file abstract_bitmap.cpp.
|
static |
Returns true
if a given pixel format corresponds to integer values, false
otherwise.
Definition at line 158 of file abstract_bitmap.cpp.
|
static |
Returns true
if a given pixel format corresponds to floating point values, false
otherwise.
Definition at line 163 of file abstract_bitmap.cpp.
|
static |
Returns true
if a given pixel format corresponds to a mask, false
otherwise.
Definition at line 168 of file abstract_bitmap.cpp.
std::string AbstractBitmap::toString | ( | ) | const |
Retruns a string describing the bitmap.
Definition at line 173 of file abstract_bitmap.cpp.
void AbstractBitmap::saveBmp | ( | const char * | filename | ) |
Saves the bitmap to a BMP file.
Definition at line 189 of file abstract_bitmap.cpp.
|
friend |
Definition at line 93 of file abstract_bitmap.h.
|
friend |
Definition at line 94 of file abstract_bitmap.h.
|
friend |
Definition at line 95 of file abstract_bitmap.h.
|
friend |
Definition at line 95 of file abstract_bitmap.h.
|
friend |
Definition at line 95 of file abstract_bitmap.h.
|
protected |
context managing this bitmap
Definition at line 102 of file abstract_bitmap.h.
|
protected |
bitmap up-to-date state on CPU and GPU
Definition at line 103 of file abstract_bitmap.h.
|
static |
Definition at line 121 of file abstract_bitmap.h.
|
static |
pixel format names
Definition at line 122 of file abstract_bitmap.h.
|
static |
number of channels for each pixel format
Definition at line 123 of file abstract_bitmap.h.
|
static |
number of bits per pixel for each pixel format
Definition at line 124 of file abstract_bitmap.h.