Beatmup
Beatmup::SingleByteBilinearInterpolator Class Reference

Single byte bitmap bilinear interpolation. More...

#include <interpolation.h>

Inheritance diagram for Beatmup::SingleByteBilinearInterpolator:
Beatmup::SingleByteBitmapReader Beatmup::CustomBitmapScanner< pixbyte, 1 >

Public Member Functions

 SingleByteBilinearInterpolator (const AbstractBitmap &bitmap, int x=0, int y=0)
 
pixint1 operator() () const
 
pixint1 operator() (float x, float y) const
 
- Public Member Functions inherited from Beatmup::SingleByteBitmapReader
pixint1 operator() () const
 Returns value at current position. More...
 
pixint1 operator() (int x, int y) const
 Returns value at pixel (x,y) position. More...
 
const pixint1 operator[] (int i) const
 Retrieves a value at position shifted by i pixels in scanline order with respect to the current position. More...
 
 SingleByteBitmapReader (const AbstractBitmap &bitmap, int x=0, int y=0)
 
- Public Member Functions inherited from Beatmup::CustomBitmapScanner< pixbyte, 1 >
bool operator< (const CustomBitmapScanner &another) const
 
pixbyteoperator* () const
 
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...
 
int getWidth () const
 Returns bitmap width in pixels. More...
 
int getHeight () const
 Returns bitmap height in pixels. More...
 
 CustomBitmapScanner (const AbstractBitmap &bitmap, int x=0, int y=0)
 

Additional Inherited Members

- Public Types inherited from Beatmup::SingleByteBitmapReader
typedef pixint1 pixtype
 
- Public Types inherited from Beatmup::CustomBitmapScanner< pixbyte, 1 >
typedef pixbyte pixvaltype
 
- Public Attributes inherited from Beatmup::SingleByteBitmapReader
const int MAX_VALUE = 255
 
- Public Attributes inherited from Beatmup::CustomBitmapScanner< pixbyte, 1 >
const int NUMBER_OF_CHANNELS
 
- Protected Member Functions inherited from Beatmup::CustomBitmapScanner< pixbyte, 1 >
pixbytejump (int x, int y) const
 Retrieves pixel address at a given position;. More...
 
- Protected Attributes inherited from Beatmup::CustomBitmapScanner< pixbyte, 1 >
pixbytedata
 bitmap data More...
 
pixbyteptr
 pointer to the current pixel More...
 
int width
 
int height
 bitmap sizes in pixels More...
 

Detailed Description

Single byte bitmap bilinear interpolation.

Definition at line 49 of file interpolation.h.

Constructor & Destructor Documentation

◆ SingleByteBilinearInterpolator()

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

Definition at line 51 of file interpolation.h.

SingleByteBitmapReader(const AbstractBitmap &bitmap, int x=0, int y=0)
jobject jlong jint jint y
jobject jlong jint x
Beatmup::InternalBitmap * bitmap

Member Function Documentation

◆ operator()() [1/2]

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

Definition at line 53 of file interpolation.h.

53  {
55  }
pixint1 operator()() const
Returns value at current position.

◆ operator()() [2/2]

pixint1 Beatmup::SingleByteBilinearInterpolator::operator() ( float  x,
float  y 
) const
inline

Definition at line 57 of file interpolation.h.

57  {
58  int ix = (int)x, iy = (int)y;
59  pixbyte* p = jump(ix, iy);
60  if (ix < width-1) {
61  float fx = x - ix;
62  if (iy < height-1) {
63  float fy = y - iy;
64  return pixint1{ roundf_fast((p[0] * (1 - fx) + p[1] * fx) * (1 - fy) + (p[width] * (1 - fx) + p[width + 1] * fx) * fy) };
65  } else
66  return pixint1{ roundf_fast(p[0] * (1 - fx) + p[1] * fx) };
67  }
68  else
69  if (iy < height-1) {
70  float fy = y - iy;
71  return pixint1{ roundf_fast(p[0] * (1 - fy) + p[width] * fy) };
72  }
73  else
74  return pixint1{ p[0] };
75  }
pixbyte * jump(int x, int y) const
Retrieves pixel address at a given position;.
Definition: bitmap_access.h:75
uint8_t pixbyte
Definition: basic_types.h:34
#define roundf_fast(X)
rounding (nearest integer)
Definition: utils.hpp:22
Beatmup::IntPoint p((int) x,(int) y)

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