22 #include "../basic_types.h"
23 #include "../geometry.h"
24 #include "../utils/image_resolution.h"
25 #include "../gpu/texture_handler.h"
26 #include "../exception.h"
90 template<const ProcessingTarget>
class WriteLock;
118 virtual void
prepare(GraphicPipeline& gpu);
251 template<ProcessingTarget target>
Locks a bitmap for reading on CPU.
ReadLock(AbstractBitmap &bitmap)
Makes a bitmap writable for a specific target device.
WriteLock(AbstractBitmap &bitmap)
A very basic class for any image.
virtual const TextureFormat getTextureFormat() const
Returns the texture format specifying how the shader must interpret the data.
static const unsigned char BITS_PER_PIXEL[NUM_PIXEL_FORMATS]
number of bits per pixel for each pixel format
const unsigned char getNumberOfChannels() const
Returns number of bytes per pixel stored in each bitmap.
Context & ctx
context managing this bitmap
Context & getContext() const
virtual const PixelFormat getPixelFormat() const =0
Pixel format of the bitmap.
bool isDirty() const
Returns true if the bitmap does not contain any valid content.
const ImageResolution getSize() const
Returns the bitmap resolution within ImageResolution object.
static const int NUM_PIXEL_FORMATS
static const char * PIXEL_FORMAT_NAMES[NUM_PIXEL_FORMATS]
pixel format names
bool isInteger() const
Returns true if the bitmap contains integer values, false otherwise.
int getPixelInt(int x, int y, int cha=0) const
Retrieves integer value of given channel at given pixel.
std::string toString() const
Retruns a string describing the bitmap.
virtual void prepare(GraphicPipeline &gpu)
Prepares (eventually uploads) texture data on GPU.
const unsigned char getBitsPerPixel() const
Returns number of bits per pixel stored in each bitmap.
bool isMask() const
Returns true if the bitmap is a mask, false otherwise.
bool isFloat() const
Returns true if the bitmap contains floating point values, false otherwise.
virtual const pixbyte * getData(int x, int y) const =0
Returns a pointer to given pixel.
bool isUpToDate(ProcessingTarget) const
virtual const int getDepth() const
Depth of the texture in pixels.
void saveBmp(const char *filename)
Saves the bitmap to a BMP file.
virtual void lockPixelData()=0
Locks access to the CPU memory buffer containing pixel data.
virtual const msize getMemorySize() const =0
Bitmap size in bytes.
virtual void unlockPixelData()=0
Unlocks access to the CPU memory buffer containing pixel data.
virtual pixbyte * getData(int x, int y)=0
static const unsigned char CHANNELS_PER_PIXEL[NUM_PIXEL_FORMATS]
number of channels for each pixel format
void zero()
Sets all the pixels to zero.
bool upToDate[2]
bitmap up-to-date state on CPU and GPU
Makes sure the bitmap content is accessible within an image processing task.
Basic class: task and memory management, any kind of static data.
virtual const int getHeight() const =0
Height of the texture in pixels.
TextureFormat
Texture format, specifies how the texture should be interpreted on the shader side.
virtual const int getWidth() const =0
Width of the texture in pixels.
Internal low-level GPU control API.
Represents image size in pixels.
uint32_t msize
memory size
@ SingleByte
single channel of 8 bits per pixel (like grayscale), unsigned integer values
@ SingleFloat
single channel of 32 bits per pixel (like grayscale), single precision floating point values
@ QuaternaryMask
2 bits per pixel
@ QuadFloat
4 channels of 32 bits per pixel, single precision floating point values,
@ TripleFloat
3 channels of 32 bits per pixel, single precision floating point values
@ QuadByte
4 channels of 8 bits per pixel (like RGBA), unsigned integer values
@ TripleByte
3 channels of 8 bits per pixel (like RGB), unsigned integer values
@ BinaryMask
1 bit per pixel
@ HexMask
4 bits per pixel
jlong jint jint jint jint pixelFormat
jobject jlong jint jint y
JNIEnv jlong jstring filename