Beatmup
Beatmup::SingleByteMaskReader Class Reference

Mask reqding interface to single byte bitmap. More...

#include <mask_bitmap_access.h>

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

Public Member Functions

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...
 

Detailed Description

Mask reqding interface to single byte bitmap.

Definition at line 288 of file mask_bitmap_access.h.

Constructor & Destructor Documentation

◆ SingleByteMaskReader()

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

Definition at line 359 of file mask_bitmap_access.h.

359  :
360  MaskScanner<8>(bitmap)
361  {
362  goTo(x, y);
363  }
void goTo(int x, int y)
Changes current position.
jobject jlong jint jint y
jobject jlong jint x
Beatmup::InternalBitmap * bitmap

Member Function Documentation

◆ getValue() [1/3]

unsigned char Beatmup::SingleByteMaskReader::getValue ( ) const
inline

Returns 0..MAX_UNNORM_VALUE value at current position.

Definition at line 293 of file mask_bitmap_access.h.

293  {
294  return *ptr;
295  }
unsigned char * ptr
pointer to current pixel

◆ getValue() [2/3]

unsigned char Beatmup::SingleByteMaskReader::getValue ( int  i) const
inline

Returns 0..MAX_UNNORM_VALUE value at position shifted by i pixels in scanline order with respect to the current position.

Definition at line 301 of file mask_bitmap_access.h.

301  {
302  return ptr[i];
303  }

◆ getValue() [3/3]

unsigned char Beatmup::SingleByteMaskReader::getValue ( int  x,
int  y 
) const
inline

Returns 0..MAX_UNNORM_VALUE value at (x,y) position.

Definition at line 308 of file mask_bitmap_access.h.

308  {
309  return data[width*y + x];
310  }
unsigned char * data
all bitmap data

◆ operator()() [1/2]

pixint1 Beatmup::SingleByteMaskReader::operator() ( ) const
inline

Returns 0..255 value at current position.

Definition at line 315 of file mask_bitmap_access.h.

315  {
316  return pixint1{ getValue() };
317  }
unsigned char getValue() const
Returns 0..MAX_UNNORM_VALUE value at current position.

◆ operator()() [2/2]

pixint1 Beatmup::SingleByteMaskReader::operator() ( int  x,
int  y 
) const
inline

Returns 0..255 value at (x,y) position.

Definition at line 322 of file mask_bitmap_access.h.

322  {
323  return pixint1{ getValue(x, y) };
324  }

◆ operator[]()

const pixint1 Beatmup::SingleByteMaskReader::operator[] ( int  i) const
inline

Returns 0..255 value at position shifted by i pixels in scanline order with respect to the current position.

Definition at line 329 of file mask_bitmap_access.h.

329  {
330  return pixint1{ getValue(i) };
331  }

◆ operator++()

void Beatmup::SingleByteMaskReader::operator++ ( int  )
inline

Move the current position ONE PIXEL forward.

Definition at line 336 of file mask_bitmap_access.h.

336  {
337  // int argument here is to declare the postfix increment (a C++ convention)
338  ptr++;
339  }

◆ operator+=()

void Beatmup::SingleByteMaskReader::operator+= ( const int  N)
inline

Move the current position N pixels forward.

Definition at line 344 of file mask_bitmap_access.h.

344  {
345  ptr += N;
346  }

◆ goTo()

void Beatmup::SingleByteMaskReader::goTo ( int  x,
int  y 
)
inline

Changes current position.

Definition at line 351 of file mask_bitmap_access.h.

351  {
352 #ifdef BEATMUP_DEBUG
353  DebugAssertion::check(x >= 0 && y >= 0 && x < width && y < height,
354  "Coordinates outside of image: %d %d (width=%d, height=%d)", x, y, width, height);
355 #endif
356  ptr = data + (width*y + x);
357  }
int height
bitmap size in pixels

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