21 #include "../exception.h"
39 "Invalid mask bitmap scanner");
110 int n = this->
bit / num_bits + i;
143 if ((this->
bit += num_bits) >= 8) {
153 this->
bit += N*num_bits;
154 this->
ptr += this->
bit / 8;
155 this->
bit = this->
bit % 8;
163 DebugAssertion::check(
x >= 0 &&
y >= 0 && x < this->
width && y < this->
height,
164 "Coordinates outside of image: %d %d (width=%d, height=%d)",
x,
y, this->
width, this->height);
215 inline unsigned char assign(
float r,
float g,
float b) {
219 inline unsigned char assign(
float r,
float g,
float b,
float a) {
232 *this->
ptr =
clipPixint(((P.
r + P.
g + P.
b) * P.
a + *this->ptr * (255 - P.
a) * 3) / 765);
354 "Coordinates outside of image: %d %d (width=%d, height=%d)",
x,
y,
width,
height);
399 inline unsigned char assign(
float r,
float g,
float b) {
403 inline unsigned char assign(
float r,
float g,
float b,
float a) {
416 *this->
ptr =
clipPixint(((P.
r + P.
g + P.
b) * P.
a + *this->ptr * (255 - P.
a) * 3) / 765);
A very basic class for any image.
const unsigned char getBitsPerPixel() const
Returns number of bits per pixel stored in each bitmap.
const pixbyte * getData(int x, int y) const
Returns a pointer to given pixel.
const int getHeight() const
Height of the texture in pixels.
const int getWidth() const
Width of the texture in pixels.
A generic to access sub-byte mask bitmap data.
unsigned char getValue(int i) const
Returns 0..MAX_UNNORM_VALUE value at position shifted by i pixels in scanline order with respect to t...
pixint1 operator()() const
Returns 0..255 value at current position.
unsigned char getValue() const
Returns 0..MAX_UNNORM_VALUE value at current position.
const pixint1 operator[](int i) const
Returns 0..255 value at position shifted by i pixels in scanline order with respect to the current po...
unsigned char getValue(int x, int y) const
Returns 0..MAX_UNNORM_VALUE value at (x,y) position.
void goTo(int x, int y)
Changes current position.
void operator+=(const int N)
Move the current position N pixels forward.
pixint1 operator()(int x, int y) const
Returns 0..255 value at (x,y) position.
void operator++(int)
Move the current position ONE PIXEL forward.
LookupMaskScanner(const AbstractBitmap &bitmap, int x=0, int y=0)
A generic to write mask bitmap data lookup tables for masks values.
void operator<<(const pixint4 &P)
unsigned char assign(int r, int g, int b)
void putValue(unsigned char x)
Puts a properly scaled (0..MAX_UNNORM_VALUE) value at the current position.
void operator=(const pixint3 &P)
unsigned char assign(float r, float g, float b)
void operator<<(const pixfloat3 &P)
void operator=(const pixfloat1 &P)
void operator<<(const pixfloat1 &P)
void operator<<(const pixfloat4 &P)
void operator=(const pixint1 &P)
void operator=(const pixfloat4 &P)
void operator<<(const pixint1 &P)
void operator=(const pixint4 &P)
unsigned char assign(float x)
unsigned char assign(int r, int g, int b, int a)
void operator<<(const pixint3 &P)
unsigned char assign(int x)
Puts an unscaled (0..255) value at the current position.
void operator=(const pixfloat3 &P)
LookupMaskWriter(AbstractBitmap &bitmap, int x=0, int y=0)
unsigned char assign(float r, float g, float b, float a)
A generic to access mask bitmap data.
MaskScanner(const AbstractBitmap &bitmap)
unsigned char bit
current position bit
const int MAX_UNNORM_VALUE
bool operator<(const MaskScanner &another) const
unsigned char * ptr
pointer to current pixel
int getHeight() const
Returns bitmap height in pixels.
pixtype * operator*() const
int height
bitmap size in pixels
int getWidth() const
Returns bitmap width in pixels.
const int NUMBER_OF_CHANNELS
unsigned char * data
all bitmap data
Mask reqding interface to single byte bitmap.
unsigned char getValue(int x, int y) const
Returns 0..MAX_UNNORM_VALUE value at (x,y) position.
unsigned char getValue(int i) const
Returns 0..MAX_UNNORM_VALUE value at position shifted by i pixels in scanline order with respect to t...
void goTo(int x, int y)
Changes current position.
SingleByteMaskReader(const AbstractBitmap &bitmap, int x=0, int y=0)
unsigned char getValue() const
Returns 0..MAX_UNNORM_VALUE value at current position.
void operator++(int)
Move the current position ONE PIXEL forward.
pixint1 operator()(int x, int y) const
Returns 0..255 value at (x,y) position.
void operator+=(const int N)
Move the current position N pixels forward.
pixint1 operator()() const
Returns 0..255 value at current position.
const pixint1 operator[](int i) const
Returns 0..255 value at position shifted by i pixels in scanline order with respect to the current po...
SingleByteMaskWriter(AbstractBitmap &bitmap, int x=0, int y=0)
void putValue(unsigned char x)
Puts a properly scaled (0..MAX_UNNORM_VALUE) value at the current position.
void operator<<(const pixfloat1 &P)
unsigned char assign(float r, float g, float b)
unsigned char assign(int r, int g, int b)
void operator=(const pixfloat3 &P)
void operator=(const pixfloat1 &P)
unsigned char assign(int x)
Puts an unscaled (0..255) value at the current position.
unsigned char assign(float r, float g, float b, float a)
void operator<<(const pixfloat4 &P)
void operator=(const pixint1 &P)
void operator=(const pixint4 &P)
void operator<<(const pixint3 &P)
void operator=(const pixfloat4 &P)
void operator<<(const pixint1 &P)
unsigned char assign(int r, int g, int b, int a)
void operator=(const pixint3 &P)
unsigned char assign(float x)
void operator<<(const pixint4 &P)
void operator<<(const pixfloat3 &P)
uint32_t msize
memory size
LookupMaskWriter< 4, MASK_LUT_4_BITS > HexMaskWriter
LookupMaskScanner< 2, MASK_LUT_2_BITS > QuaternaryMaskReader
const int MASK_LUT_4_BITS[16]
LookupMaskWriter< 1, MASK_LUT_1_BIT > BinaryMaskWriter
LookupMaskScanner< 1, MASK_LUT_1_BIT > BinaryMaskReader
pixbyte clipPixint(int x)
Clips an integer pixel value to 0..255 range.
pixbyte pixfloat2pixbyte(pixfloat x)
Converts a floating point pixel value to a 0..255 integer.
LookupMaskWriter< 2, MASK_LUT_2_BITS > QuaternaryMaskWriter
const int MASK_LUT_2_BITS[4]
LookupMaskScanner< 4, MASK_LUT_4_BITS > HexMaskReader
const int MASK_LUT_1_BIT[2]
Monochromatic floating point arithmetic.
Trichromatic floating point arithmetic.
4-channel floating point arithmetic
Monochromatic integer arithmetic.
Trichromatic integer arithmetic.
4-channel integer arithmetic
jobject jlong jint jint jint jint g
jobject jlong jint jint jint jint jint b
jobject jlong jint jint y
jobject jlong jint jint jint r
jobject jlong jint jint jint jint jint jint a
Beatmup::InternalBitmap * bitmap
Beatmup::IntPoint p((int) x,(int) y)
JNIEnv jlong jfloat jfloat jfloat v