Beatmup
Beatmup::TripleByteBilinearInterpolator Class Reference

Triple byte bitmap bilinear interpolation. More...

#include <interpolation.h>

Inheritance diagram for Beatmup::TripleByteBilinearInterpolator:
Beatmup::TripleByteBitmapReader Beatmup::CustomBitmapScanner< pixbyte, 3 >

Public Member Functions

 TripleByteBilinearInterpolator (const AbstractBitmap &bitmap, int x=0, int y=0)
 
pixint3 operator() () const
 
pixint3 operator() (float x, float y) const
 
- Public Member Functions inherited from Beatmup::TripleByteBitmapReader
pixint3 operator() () const
 
pixint3 operator() (int x, int y) const
 
const pixint3 operator[] (int i) const
 Retrieves a value at position shifted by i pixels in scanline order with respect to the current position. More...
 
 TripleByteBitmapReader (const AbstractBitmap &bitmap, int x=0, int y=0)
 
- Public Member Functions inherited from Beatmup::CustomBitmapScanner< pixbyte, 3 >
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::TripleByteBitmapReader
typedef pixint3 pixtype
 
- Public Types inherited from Beatmup::CustomBitmapScanner< pixbyte, 3 >
typedef pixbyte pixvaltype
 
- Public Attributes inherited from Beatmup::TripleByteBitmapReader
const int MAX_VALUE = 255
 
- Public Attributes inherited from Beatmup::CustomBitmapScanner< pixbyte, 3 >
const int NUMBER_OF_CHANNELS
 
- Protected Member Functions inherited from Beatmup::CustomBitmapScanner< pixbyte, 3 >
pixbytejump (int x, int y) const
 Retrieves pixel address at a given position;. More...
 
- Protected Attributes inherited from Beatmup::CustomBitmapScanner< pixbyte, 3 >
pixbytedata
 bitmap data More...
 
pixbyteptr
 pointer to the current pixel More...
 
int width
 
int height
 bitmap sizes in pixels More...
 

Detailed Description

Triple byte bitmap bilinear interpolation.

Definition at line 81 of file interpolation.h.

Constructor & Destructor Documentation

◆ TripleByteBilinearInterpolator()

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

Definition at line 83 of file interpolation.h.

TripleByteBitmapReader(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]

pixint3 Beatmup::TripleByteBilinearInterpolator::operator() ( ) const
inline

Definition at line 85 of file interpolation.h.

85  {
87  }

◆ operator()() [2/2]

pixint3 Beatmup::TripleByteBilinearInterpolator::operator() ( float  x,
float  y 
) const
inline

Definition at line 89 of file interpolation.h.

89  {
90  int
91  ix = (int)x, iy = (int)y,
92  i1 = 3 * width;
93  pixbyte* p = jump(ix, iy);
94  if (ix < width-1) {
95  float fx = x - ix;
96  if (iy < height-1) {
97  float
98  fy = y - iy,
99  w0 = (1 - fx) * (1 - fy),
100  w1 = fx * (1 - fy),
101  w2 = (1 - fx) * fy,
102  w3 = fx*fy;
103  return pixint3 {
104  roundf_fast(p[0] * w0 + p[3] * w1 + p[i1 ] * w2 + p[i1+3] * w3),
105  roundf_fast(p[1] * w0 + p[4] * w1 + p[i1+1] * w2 + p[i1+4] * w3),
106  roundf_fast(p[2] * w0 + p[5] * w1 + p[i1+2] * w2 + p[i1+5] * w3)
107  };
108  }
109  else
110  return pixint3{
111  roundf_fast(p[0] * (1 - fx) + p[3] * fx),
112  roundf_fast(p[1] * (1 - fx) + p[4] * fx),
113  roundf_fast(p[2] * (1 - fx) + p[5] * fx)
114  };
115  }
116  else
117  if (iy < height-1) {
118  float fy = y - iy;
119  return pixint3{
120  roundf_fast(p[0] * (1 - fy) + p[i1 ] * fy),
121  roundf_fast(p[1] * (1 - fy) + p[i1+1] * fy),
122  roundf_fast(p[2] * (1 - fy) + p[i1+2] * fy)
123  };
124  }
125  else
126  return pixint3{ p[0], p[1], p[2] };
127  }
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: