App
mhr_appcore_interpolators_Interpolator.cpp
Go to the documentation of this file.
2 #include "../app/app_all.hpp"
3 
4 using namespace app;
5 
9 JNIEXPORT jint JNICALL Java_mhr_appcore_interpolators_Interpolator_resampleTo__IJJ(JNIEnv * pEnv, jclass pThisClass, jint nativeType, jlong srcAdress, jlong dstAdress) {
10  int retVal = 0;
11  switch ((BitmapNativeType) nativeType) {
12  case mono_8_bit:
13  {
15  retVal = i->resampleTo(*((mono_8bit_bitmap *)dstAdress));
16  delete i;
17  break;
18  }
19  case rgba_8_bit:
20  {
22  retVal = i->resampleTo(*((rgba_8bit_bitmap *)dstAdress));
23  delete i;
24  break;
25  }
26  default:
27  retVal = -1;
28  break;
29  }
30  return retVal;
31 }
32 
33 JNIEXPORT jint JNICALL Java_mhr_appcore_interpolators_Interpolator_resampleTo__IJJI(JNIEnv * pEnv, jclass pThisClass, jint nativeType, jlong srcAdress, jlong dstAdress, jint iType) {
34  int retVal = 0;
35  switch ((BitmapNativeType) nativeType) {
36  case mono_8_bit:
37  {
39  switch ((InterpolatorNativeType)iType) {
40  case NEAREST_NEIGHBOUR:
42  break;
43  case LINEAR:
44  i = new TLinearFInt<px_1x8bit, px_1x8bit>(*((mono_8bit_bitmap *)srcAdress));
45  break;
46  case CUBIC:
47  i = new TCubicFInt<px_1x8bit, px_1x8bit>(*((mono_8bit_bitmap *)srcAdress));
48  break;
49  default:
50  break;
51  }
52  if (i != NULL) {
53  retVal = i->resampleTo(*((mono_8bit_bitmap *)dstAdress));
54  delete i;
55  }
56  break;
57  }
58  case rgba_8_bit:
59  {
61  switch ((InterpolatorNativeType)iType) {
62  case NEAREST_NEIGHBOUR:
64  break;
65  case LINEAR:
66  i = new TLinearFInt<px_4x8bit, px_1x8bit>(*((rgba_8bit_bitmap *)srcAdress));
67  break;
68  case CUBIC:
69  i = new TCubicFInt<px_4x8bit, px_1x8bit>(*((rgba_8bit_bitmap *)srcAdress));
70  break;
71  default:
72  break;
73  }
74  if (i != NULL) {
75  retVal = i->resampleTo(*((rgba_8bit_bitmap *)dstAdress));
76  delete i;
77  }
78  break;
79  }
80  default:
81  retVal = -1;
82  break;
83  }
84  return retVal;
85 }
86 
87 JNIEXPORT jint JNICALL Java_mhr_appcore_interpolators_Interpolator_resampleTo__IJJID(JNIEnv * pEnv, jclass pThisClass, jint nativeType, jlong srcAdress, jlong dstAdress, jint iType, jdouble force) {
88  int retVal = 0;
89  switch ((BitmapNativeType) nativeType) {
90  case mono_8_bit:
91  {
93  switch ((InterpolatorNativeType)iType) {
94  case NEAREST_NEIGHBOUR:
96  break;
97  case LINEAR:
98  i = new TLinearFInt<px_1x8bit, px_1x8bit>(*((mono_8bit_bitmap *)srcAdress));
99  break;
100  case CUBIC:
101  i = new TCubicFInt<px_1x8bit, px_1x8bit>(*((mono_8bit_bitmap *)srcAdress));
102  break;
103  default:
104  break;
105  }
106  if (i != NULL) {
107  retVal = i->resampleTo_aliased(*((mono_8bit_bitmap *)dstAdress), force);
108  delete i;
109  }
110  break;
111  }
112  case rgba_8_bit:
113  {
115  switch ((InterpolatorNativeType)iType) {
116  case NEAREST_NEIGHBOUR:
117  i = new TNearestFInt<px_4x8bit, px_1x8bit>(*((rgba_8bit_bitmap *)srcAdress));
118  break;
119  case LINEAR:
120  i = new TLinearFInt<px_4x8bit, px_1x8bit>(*((rgba_8bit_bitmap *)srcAdress));
121  break;
122  case CUBIC:
123  i = new TCubicFInt<px_4x8bit, px_1x8bit>(*((rgba_8bit_bitmap *)srcAdress));
124  break;
125  default:
126  break;
127  }
128  if (i != NULL) {
129  retVal = i->resampleTo_aliased(*((rgba_8bit_bitmap *)dstAdress), force);
130  delete i;
131  }
132  break;
133  }
134  default:
135  retVal = -1;
136  break;
137  }
138  return retVal;
139 }