Beatmup
Beatmup::FloatBilinearInterpolator< scanner, pixel > Class Template Reference

Floating point bitmap bilinear interpolation, implemented using pixel arithmetics. More...

#include <interpolation.h>

Inheritance diagram for Beatmup::FloatBilinearInterpolator< scanner, pixel >:

Public Member Functions

 FloatBilinearInterpolator (const AbstractBitmap &bitmap, int x=0, int y=0)
 
pixel operator() () const
 
pixel operator() (float x, float y) const
 

Detailed Description

template<class scanner, typename pixel>
class Beatmup::FloatBilinearInterpolator< scanner, pixel >

Floating point bitmap bilinear interpolation, implemented using pixel arithmetics.

Definition at line 190 of file interpolation.h.

Constructor & Destructor Documentation

◆ FloatBilinearInterpolator()

template<class scanner , typename pixel >
Beatmup::FloatBilinearInterpolator< scanner, pixel >::FloatBilinearInterpolator ( const AbstractBitmap bitmap,
int  x = 0,
int  y = 0 
)
inline

Definition at line 192 of file interpolation.h.

192 : scanner(bitmap, x, y) {}
jobject jlong jint jint y
jobject jlong jint x
Beatmup::InternalBitmap * bitmap

Member Function Documentation

◆ operator()() [1/2]

template<class scanner , typename pixel >
pixel Beatmup::FloatBilinearInterpolator< scanner, pixel >::operator() ( ) const
inline

Definition at line 194 of file interpolation.h.

194  {
195  return scanner::operator()();
196  }

◆ operator()() [2/2]

template<class scanner , typename pixel >
pixel Beatmup::FloatBilinearInterpolator< scanner, pixel >::operator() ( float  x,
float  y 
) const
inline

Definition at line 198 of file interpolation.h.

198  {
199  int ix = (int)x, iy = (int)y;
200  pixel* p = (pixel*)scanner::jump(ix, iy);
201  if (ix < scanner::width-1) {
202  float fx = x - ix;
203  if (iy < scanner::height-1) {
204  float fy = y - iy;
205  return (p[0] * (1 - fx) + p[1] * fx) * (1 - fy) + (p[scanner::width] * (1 - fx) + p[scanner::width + 1] * fx) * fy;
206  }
207  else
208  return p[0] * (1 - fx) + p[1] * fx;
209  }
210  else
211  if (iy < scanner::height-1) {
212  float fy = y - iy;
213  return p[0] * (1 - fy) + p[scanner::width] * fy;
214  }
215  else
216  return p[0];
217  }
jlong jint width
jlong jint jint height
Beatmup::IntPoint p((int) x,(int) y)

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