Beatmup
|
Image coming from a SurfaceTexture (Camera or video decoder) More...
#include <external_bitmap.h>
Public Member Functions | |
ExternalBitmap (Beatmup::Context &ctx) | |
Instantiates external image. More... | |
~ExternalBitmap () | |
void | bind (JNIEnv *jenv, jobject frontend) |
Attaches the bitmap object to its Java frontend and initializes the surface texture in it. More... | |
const Beatmup::GL::TextureHandler::TextureFormat | getTextureFormat () const |
Returns the texture format specifying how the shader must interpret the data. More... | |
const PixelFormat | getPixelFormat () const |
Pixel format of the bitmap. More... | |
const int | getWidth () const |
Width of the texture in pixels. More... | |
const int | getHeight () const |
Height of the texture in pixels. More... | |
const int | getDepth () const |
Depth of the texture in pixels. More... | |
const msize | getMemorySize () const |
Bitmap size in bytes. More... | |
const pixbyte * | getData (int x, int y) const |
Returns a pointer to given pixel. More... | |
pixbyte * | getData (int x, int y) |
void | notifyUpdate (const int width, const int height) |
Public Member Functions inherited from Beatmup::AbstractBitmap | |
bool | isUpToDate (ProcessingTarget) const |
bool | isDirty () const |
Returns true if the bitmap does not contain any valid content. More... | |
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 () | |
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 () |
Protected Member Functions | |
virtual void | prepare (GraphicPipeline &gpu) |
Prepares (eventually uploads) texture data on GPU. More... | |
void | lockPixelData () |
Locks access to the CPU memory buffer containing pixel data. More... | |
void | unlockPixelData () |
Unlocks access to the CPU memory buffer containing pixel data. More... | |
Protected Member Functions inherited from Beatmup::AbstractBitmap | |
AbstractBitmap (Context &ctx) | |
Protected Member Functions inherited from Beatmup::GL::TextureHandler | |
TextureHandler () | |
void | invalidate (RecycleBin &) |
Forces disposing the texture data, e.g. More... | |
Private Attributes | |
int | width |
int | height |
JavaVM * | jvm |
JNIEnv * | persistentJEnv |
jmethodID | updateTexImageMethodId |
jobject | surfaceTexture |
bool | textureUpdated |
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... | |
Static Public Member Functions inherited from Beatmup::AbstractBitmap | |
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 inherited from Beatmup::AbstractBitmap | |
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 Attributes inherited from Beatmup::AbstractBitmap | |
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 |
Image coming from a SurfaceTexture (Camera or video decoder)
Definition at line 30 of file external_bitmap.h.
ExternalBitmap::ExternalBitmap | ( | Beatmup::Context & | ctx | ) |
Instantiates external image.
This must not be called from Beatmup internal threads.
Definition at line 65 of file external_bitmap.cpp.
ExternalBitmap::~ExternalBitmap | ( | ) |
Definition at line 138 of file external_bitmap.cpp.
|
protectedvirtual |
Prepares (eventually uploads) texture data on GPU.
Called only by the context managing thread.
[in] | gpu | Graphic pipeline instance |
Reimplemented from Beatmup::AbstractBitmap.
Definition at line 154 of file external_bitmap.cpp.
|
inlineprotectedvirtual |
Locks access to the CPU memory buffer containing pixel data.
Implements Beatmup::AbstractBitmap.
Definition at line 41 of file external_bitmap.h.
|
inlineprotectedvirtual |
Unlocks access to the CPU memory buffer containing pixel data.
Implements Beatmup::AbstractBitmap.
Definition at line 42 of file external_bitmap.h.
void ExternalBitmap::bind | ( | JNIEnv * | jenv, |
jobject | frontend | ||
) |
Attaches the bitmap object to its Java frontend and initializes the surface texture in it.
Definition at line 74 of file external_bitmap.cpp.
|
inlinevirtual |
Returns the texture format specifying how the shader must interpret the data.
Reimplemented from Beatmup::AbstractBitmap.
Definition at line 59 of file external_bitmap.h.
|
inlinevirtual |
Pixel format of the bitmap.
Implements Beatmup::AbstractBitmap.
Definition at line 63 of file external_bitmap.h.
|
inlinevirtual |
Width of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Definition at line 67 of file external_bitmap.h.
|
inlinevirtual |
Height of the texture in pixels.
Implements Beatmup::GL::TextureHandler.
Definition at line 71 of file external_bitmap.h.
|
inlinevirtual |
Depth of the texture in pixels.
Reimplemented from Beatmup::AbstractBitmap.
Definition at line 75 of file external_bitmap.h.
|
inlinevirtual |
Bitmap size in bytes.
Implements Beatmup::AbstractBitmap.
Definition at line 79 of file external_bitmap.h.
|
inlinevirtual |
Returns a pointer to given pixel.
x | target pixel horizontal coordinate |
y | target pixel vertical coordinate |
Implements Beatmup::AbstractBitmap.
Definition at line 83 of file external_bitmap.h.
|
inlinevirtual |
Implements Beatmup::AbstractBitmap.
Definition at line 87 of file external_bitmap.h.
void ExternalBitmap::notifyUpdate | ( | const int | width, |
const int | height | ||
) |
Definition at line 147 of file external_bitmap.cpp.
|
private |
Definition at line 32 of file external_bitmap.h.
|
private |
Definition at line 32 of file external_bitmap.h.
|
private |
Definition at line 33 of file external_bitmap.h.
|
private |
Definition at line 34 of file external_bitmap.h.
|
private |
Definition at line 35 of file external_bitmap.h.
|
private |
Definition at line 36 of file external_bitmap.h.
|
private |
Definition at line 37 of file external_bitmap.h.