Beatmup
Beatmup::QuadByteBilinearInterpolator Class Reference

Quad byte bitmap bilinear interpolation. More...

#include <interpolation.h>

Inheritance diagram for Beatmup::QuadByteBilinearInterpolator:
Beatmup::QuadByteBitmapReader Beatmup::CustomBitmapScanner< pixbyte, 4 >

Public Member Functions

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

Detailed Description

Quad byte bitmap bilinear interpolation.

Definition at line 133 of file interpolation.h.

Constructor & Destructor Documentation

◆ QuadByteBilinearInterpolator()

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

Definition at line 135 of file interpolation.h.

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

pixint4 Beatmup::QuadByteBilinearInterpolator::operator() ( ) const
inline

Definition at line 137 of file interpolation.h.

137  {
139  }

◆ operator()() [2/2]

pixint4 Beatmup::QuadByteBilinearInterpolator::operator() ( float  x,
float  y 
) const
inline

Definition at line 141 of file interpolation.h.

141  {
142  int
143  ix = (int)x, iy = (int)y,
144  i1 = 4 * width;
145  pixbyte* p = jump(ix, iy);
146  if (ix < width-1) {
147  float fx = x - ix;
148  if (iy < height-1) {
149  float
150  fy = y - iy,
151  w0 = (1 - fx) * (1 - fy),
152  w1 = fx * (1 - fy),
153  w2 = (1 - fx) * fy,
154  w3 = fx*fy;
155  return pixint4 {
156  roundf_fast(p[0] * w0 + p[4] * w1 + p[i1 ] * w2 + p[i1 + 4] * w3),
157  roundf_fast(p[1] * w0 + p[5] * w1 + p[i1 + 1] * w2 + p[i1 + 5] * w3),
158  roundf_fast(p[2] * w0 + p[6] * w1 + p[i1 + 2] * w2 + p[i1 + 6] * w3),
159  roundf_fast(p[3] * w0 + p[7] * w1 + p[i1 + 3] * w2 + p[i1 + 7] * w3)
160  };
161  }
162  else {
163  float w = 1 - fx;
164  return pixint4 {
165  roundf_fast(p[0] * w + p[4] * fx),
166  roundf_fast(p[1] * w + p[5] * fx),
167  roundf_fast(p[2] * w + p[6] * fx),
168  roundf_fast(p[3] * w + p[7] * fx)
169  };
170  }
171  }
172  else
173  if (iy < height-1) {
174  float fy = y - iy, w = 1 - fy;
175  return pixint4 {
176  roundf_fast(p[0] * w + p[i1 ] * fy),
177  roundf_fast(p[1] * w + p[i1 + 1] * fy),
178  roundf_fast(p[2] * w + p[i1 + 2] * fy),
179  roundf_fast(p[3] * w + p[i1 + 3] * fy)
180  };
181  }
182  else
183  return pixint4{ p[0], p[1], p[2], p[3] };
184  }
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
jlong jstring jint jint jint jint w
Beatmup::IntPoint p((int) x,(int) y)

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