Beatmup
Beatmup::SingleByteMaskWriter Class Reference

#include <mask_bitmap_access.h>

Inheritance diagram for Beatmup::SingleByteMaskWriter:
Beatmup::SingleByteMaskReader Beatmup::BitmapContentModifier Beatmup::MaskScanner< 8 >

Public Member Functions

void putValue (unsigned char x)
 Puts a properly scaled (0..MAX_UNNORM_VALUE) value at the current position. More...
 
unsigned char assign (int x)
 Puts an unscaled (0..255) value at the current position. More...
 
unsigned char assign (int r, int g, int b)
 
unsigned char assign (int r, int g, int b, int a)
 
unsigned char assign (float x)
 
unsigned char assign (float r, float g, float b)
 
unsigned char assign (float r, float g, float b, float a)
 
void operator<< (const pixint1 &P)
 
void operator<< (const pixint3 &P)
 
void operator<< (const pixint4 &P)
 
void operator<< (const pixfloat1 &P)
 
void operator<< (const pixfloat3 &P)
 
void operator<< (const pixfloat4 &P)
 
void operator= (const pixint1 &P)
 
void operator= (const pixint3 &P)
 
void operator= (const pixint4 &P)
 
void operator= (const pixfloat1 &P)
 
void operator= (const pixfloat3 &P)
 
void operator= (const pixfloat4 &P)
 
 SingleByteMaskWriter (AbstractBitmap &bitmap, int x=0, int y=0)
 
- Public Member Functions inherited from Beatmup::SingleByteMaskReader
unsigned char getValue () const
 Returns 0..MAX_UNNORM_VALUE value at current position. More...
 
unsigned char getValue (int i) const
 Returns 0..MAX_UNNORM_VALUE value at position shifted by i pixels in scanline order with respect to the current position. More...
 
unsigned char getValue (int x, int y) const
 Returns 0..MAX_UNNORM_VALUE value at (x,y) position. More...
 
pixint1 operator() () const
 Returns 0..255 value at current position. More...
 
pixint1 operator() (int x, int y) const
 Returns 0..255 value at (x,y) position. More...
 
const pixint1 operator[] (int i) const
 Returns 0..255 value at position shifted by i pixels in scanline order with respect to the current position. More...
 
void operator++ (int)
 Move the current position ONE PIXEL forward. More...
 
void operator+= (const int N)
 Move the current position N pixels forward. More...
 
void goTo (int x, int y)
 Changes current position. More...
 
 SingleByteMaskReader (const AbstractBitmap &bitmap, int x=0, int y=0)
 
- Public Member Functions inherited from Beatmup::MaskScanner< 8 >
bool operator< (const MaskScanner &another) const
 
pixtypeoperator* () const
 
int getWidth () const
 Returns bitmap width in pixels. More...
 
int getHeight () const
 Returns bitmap height in pixels. More...
 

Additional Inherited Members

- Public Types inherited from Beatmup::MaskScanner< 8 >
typedef unsigned char pixvaltype
 
typedef pixint1 pixtype
 
- Public Attributes inherited from Beatmup::MaskScanner< 8 >
const int NUMBER_OF_CHANNELS
 
const int NUMBER_OF_BITS
 
const int MAX_VALUE
 
const int MAX_UNNORM_VALUE
 
- Protected Member Functions inherited from Beatmup::MaskScanner< 8 >
 MaskScanner (const AbstractBitmap &bitmap)
 
- Protected Attributes inherited from Beatmup::MaskScanner< 8 >
unsigned char * data
 all bitmap data More...
 
unsigned char * ptr
 pointer to current pixel More...
 
unsigned char bit
 current position bit More...
 
int width
 
int height
 bitmap size in pixels More...
 
- Private Member Functions inherited from Beatmup::BitmapContentModifier
 BitmapContentModifier (AbstractBitmap &bitmap)
 

Detailed Description

Definition at line 367 of file mask_bitmap_access.h.

Constructor & Destructor Documentation

◆ SingleByteMaskWriter()

Beatmup::SingleByteMaskWriter::SingleByteMaskWriter ( AbstractBitmap bitmap,
int  x = 0,
int  y = 0 
)
inline

Definition at line 455 of file mask_bitmap_access.h.

BitmapContentModifier(AbstractBitmap &bitmap)
Definition: bitmap_access.h:60
SingleByteMaskReader(const AbstractBitmap &bitmap, int x=0, int y=0)
jobject jlong jint jint y
jobject jlong jint x
Beatmup::InternalBitmap * bitmap

Member Function Documentation

◆ putValue()

void Beatmup::SingleByteMaskWriter::putValue ( unsigned char  x)
inline

Puts a properly scaled (0..MAX_UNNORM_VALUE) value at the current position.

Definition at line 372 of file mask_bitmap_access.h.

372  {
373  *this->ptr = x;
374  }
unsigned char * ptr
pointer to current pixel

◆ assign() [1/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( int  x)
inline

Puts an unscaled (0..255) value at the current position.

Returns
properly scaled value put into the mask.

Definition at line 380 of file mask_bitmap_access.h.

380  {
381  putValue(x);
382  return x;
383  }
void putValue(unsigned char x)
Puts a properly scaled (0..MAX_UNNORM_VALUE) value at the current position.

◆ assign() [2/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( int  r,
int  g,
int  b 
)
inline

Definition at line 385 of file mask_bitmap_access.h.

385  {
386  return assign((r + g + b) / 3);
387  }
unsigned char assign(int x)
Puts an unscaled (0..255) value at the current position.
jobject jlong jint jint jint jint g
jobject jlong jint jint jint jint jint b
jobject jlong jint jint jint r

◆ assign() [3/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( int  r,
int  g,
int  b,
int  a 
)
inline

Definition at line 389 of file mask_bitmap_access.h.

389  {
390  return assign(a);
391  }
jobject jlong jint jint jint jint jint jint a

◆ assign() [4/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( float  x)
inline

Definition at line 393 of file mask_bitmap_access.h.

393  {
394  unsigned char v = x > 0.0f ? (x < 1.0f ? (unsigned char)roundf(x * this->MAX_UNNORM_VALUE) : this->MAX_UNNORM_VALUE) : 0;
395  putValue(v);
396  return v;
397  }
JNIEnv jlong jfloat jfloat jfloat v

◆ assign() [5/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( float  r,
float  g,
float  b 
)
inline

Definition at line 399 of file mask_bitmap_access.h.

399  {
400  return assign((r + g + b) / 3);
401  }

◆ assign() [6/6]

unsigned char Beatmup::SingleByteMaskWriter::assign ( float  r,
float  g,
float  b,
float  a 
)
inline

Definition at line 403 of file mask_bitmap_access.h.

403  {
404  return assign(a);
405  }

◆ operator<<() [1/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixint1 P)
inline

Definition at line 407 of file mask_bitmap_access.h.

407  {
408  assign(P.x);
409  }

◆ operator<<() [2/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixint3 P)
inline

Definition at line 411 of file mask_bitmap_access.h.

411  {
412  assign(P.r, P.g, P.b);
413  }

◆ operator<<() [3/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixint4 P)
inline

Definition at line 415 of file mask_bitmap_access.h.

415  {
416  *this->ptr = clipPixint(((P.r + P.g + P.b) * P.a + *this->ptr * (255 - P.a) * 3) / 765);
417  }
pixbyte clipPixint(int x)
Clips an integer pixel value to 0..255 range.

◆ operator<<() [4/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixfloat1 P)
inline

Definition at line 419 of file mask_bitmap_access.h.

419  {
420  assign(P.x);
421  }

◆ operator<<() [5/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixfloat3 P)
inline

Definition at line 423 of file mask_bitmap_access.h.

423  {
424  assign(P.r, P.g, P.b);
425  }

◆ operator<<() [6/6]

void Beatmup::SingleByteMaskWriter::operator<< ( const pixfloat4 P)
inline

Definition at line 427 of file mask_bitmap_access.h.

427  {
428  *this->ptr = pixfloat2pixbyte((P.r + P.g + P.b) * P.a / 3 + *this->ptr * (1 - P.a));
429  }
pixbyte pixfloat2pixbyte(pixfloat x)
Converts a floating point pixel value to a 0..255 integer.

◆ operator=() [1/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixint1 P)
inline

Definition at line 431 of file mask_bitmap_access.h.

431  {
432  assign(P.x);
433  }

◆ operator=() [2/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixint3 P)
inline

Definition at line 435 of file mask_bitmap_access.h.

435  {
436  assign(P.r, P.g, P.b);
437  }

◆ operator=() [3/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixint4 P)
inline

Definition at line 439 of file mask_bitmap_access.h.

439  {
440  assign(P.r, P.g, P.b, P.a);
441  }

◆ operator=() [4/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixfloat1 P)
inline

Definition at line 443 of file mask_bitmap_access.h.

443  {
444  assign(P.x);
445  }

◆ operator=() [5/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixfloat3 P)
inline

Definition at line 447 of file mask_bitmap_access.h.

447  {
448  assign(P.r, P.g, P.b);
449  }

◆ operator=() [6/6]

void Beatmup::SingleByteMaskWriter::operator= ( const pixfloat4 P)
inline

Definition at line 451 of file mask_bitmap_access.h.

451  {
452  assign(P.r, P.g, P.b, P.a);
453  }

The documentation for this class was generated from the following file: