App

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

mhr_appcore_pointops_LUT.cpp
Go to the documentation of this file.
1 #include "mhr_appcore_pointops_LUT.hpp"
2 #include "../app/app_all.hpp"
3
4 using namespace app;
5
9 JNIEXPORT jlong JNICALL Java_mhr_appcore_pointops_LUT_createLut(JNIEnv * pEnv, jclass pThisClass) {
10 TLUT<px_4x8bit, px_1x8bit> * retVal = new TLUT<px_4x8bit, px_1x8bit>(1);
11 if (retVal != NULL) {
12 if (retVal->isInitOk()) {
13 return (long long) retVal;
14 } else {
15 delete retVal;
16 }
17 }
18 return 0x0;
19 }
20
24 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_disposeLut(JNIEnv * pEnv, jclass pThisClass, jlong adress) {
25 TLUT<px_4x8bit, px_1x8bit> * LUT = (TLUT<px_4x8bit, px_1x8bit> *) adress;
26 delete LUT;
27 return 0;
28 }
29
33 JNIEXPORT jlong JNICALL Java_mhr_appcore_pointops_LUT_createBrightnessLut(JNIEnv * pEnv, jclass pThisClass, jdouble bias) {
34 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
35 TLUT<px_4x8bit, px_1x8bit> * retVal = gen.createBrightnessLUT_4ch(bias);
36 if (retVal != NULL) {
37 if (retVal->isInitOk()) {
38 return (long long) retVal;
39 } else {
40 delete retVal;
41 }
42 }
43 return 0x0;
44 }
48 JNIEXPORT jlong JNICALL Java_mhr_appcore_pointops_LUT_createContrastLut(JNIEnv * pEnv, jclass pThisClass, jdouble bias) {
49 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
50 TLUT<px_4x8bit, px_1x8bit> * retVal = gen.createContrastLUT_4ch(bias);
51 if (retVal != NULL) {
52 if (retVal->isInitOk()) {
53 return (long long) retVal;
54 } else {
55 delete retVal;
56 }
57 }
58 return 0x0;
59 }
60
64 JNIEXPORT jlong JNICALL Java_mhr_appcore_pointops_LUT_createGammaLut(JNIEnv * pEnv, jclass pThisClass, jdouble bias) {
65 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
66 TLUT<px_4x8bit, px_1x8bit> * retVal = gen.createGammaLUT_4ch(bias);
67 if (retVal != NULL) {
68 if (retVal->isInitOk()) {
69 return (long long) retVal;
70 } else {
71 delete retVal;
72 }
73 }
74 return 0x0;
75 }
76
77
78
79 JNIEXPORT jlong JNICALL Java_mhr_appcore_pointops_LUT_createCurvesLut(JNIEnv * pEnv, jclass pThisClass,
80 jdoubleArray xM, jdoubleArray yM, jint cM,
81 jdoubleArray xR, jdoubleArray yR, jint cR,
82 jdoubleArray xG, jdoubleArray yG, jint cG,
83 jdoubleArray xB, jdoubleArray yB, jint cB,
84 jdoubleArray xA, jdoubleArray yA, jint cA) {
85
86 jboolean isCopy = 0;
87 double * xMM = pEnv->GetDoubleArrayElements(xM, &isCopy);
88 double * yMM = pEnv->GetDoubleArrayElements(yM, &isCopy);
89 double * xRR = pEnv->GetDoubleArrayElements(xR, &isCopy);
90 double * yRR = pEnv->GetDoubleArrayElements(yR, &isCopy);
91 double * xGG = pEnv->GetDoubleArrayElements(xG, &isCopy);
92 double * yGG = pEnv->GetDoubleArrayElements(yG, &isCopy);
93 double * xBB = pEnv->GetDoubleArrayElements(xB, &isCopy);
94 double * yBB = pEnv->GetDoubleArrayElements(yB, &isCopy);
95 double * xAA = pEnv->GetDoubleArrayElements(xA, &isCopy);
96 double * yAA = pEnv->GetDoubleArrayElements(yA, &isCopy);
97
98 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
99 TLUT<px_4x8bit, px_1x8bit> * retVal = gen.createCurvesLUT_4ch(
100 xMM, yMM, cM,
101 xRR, yRR, cR,
102 xGG, yGG, cG,
103 xBB, yBB, cB,
104 xAA, yAA, cA);
105
106 // Nebudou se kopirovat zpet hodnoty
107 pEnv->ReleaseDoubleArrayElements(xM, xMM, JNI_ABORT);
108 pEnv->ReleaseDoubleArrayElements(yM, yMM, JNI_ABORT);
109 pEnv->ReleaseDoubleArrayElements(xR, xRR, JNI_ABORT);
110 pEnv->ReleaseDoubleArrayElements(yR, yRR, JNI_ABORT);
111 pEnv->ReleaseDoubleArrayElements(xG, xGG, JNI_ABORT);
112 pEnv->ReleaseDoubleArrayElements(yG, yGG, JNI_ABORT);
113 pEnv->ReleaseDoubleArrayElements(xB, xBB, JNI_ABORT);
114 pEnv->ReleaseDoubleArrayElements(yB, yBB, JNI_ABORT);
115 pEnv->ReleaseDoubleArrayElements(xA, xAA, JNI_ABORT);
116 pEnv->ReleaseDoubleArrayElements(yA, yAA, JNI_ABORT);
117
118 if (retVal != NULL) {
119 if (retVal->isInitOk()) {
120 return (long long) retVal;
121 } else {
122 delete retVal;
123 }
124 }
125 return 0x0;
126 }
127
128
129
130
131
132
136 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_fillBrightnessLut(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress, jdouble bias) {
137 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
138 return gen.fillBrightnessLUT_4ch(*(TLUT<px_4x8bit, px_1x8bit> *) lutAdress, bias);
139 }
143 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_fillContrastLut(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress, jdouble bias) {
144 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
145 return gen.fillContrastLUT_4ch(*(TLUT<px_4x8bit, px_1x8bit> *) lutAdress, bias);
146 }
147
151 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_fillGammaLut(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress, jdouble bias) {
152 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
153 return gen.fillGammaLUT_4ch(*(TLUT<px_4x8bit, px_1x8bit> *) lutAdress, bias);
154 }
155
156 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_fillCurvesLut(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress,
157 jdoubleArray xM, jdoubleArray yM, jint cM,
158 jdoubleArray xR, jdoubleArray yR, jint cR,
159 jdoubleArray xG, jdoubleArray yG, jint cG,
160 jdoubleArray xB, jdoubleArray yB, jint cB,
161 jdoubleArray xA, jdoubleArray yA, jint cA) {
162
163 jboolean isCopy = 0;
164 double * xMM = pEnv->GetDoubleArrayElements(xM, &isCopy);
165 double * yMM = pEnv->GetDoubleArrayElements(yM, &isCopy);
166 double * xRR = pEnv->GetDoubleArrayElements(xR, &isCopy);
167 double * yRR = pEnv->GetDoubleArrayElements(yR, &isCopy);
168 double * xGG = pEnv->GetDoubleArrayElements(xG, &isCopy);
169 double * yGG = pEnv->GetDoubleArrayElements(yG, &isCopy);
170 double * xBB = pEnv->GetDoubleArrayElements(xB, &isCopy);
171 double * yBB = pEnv->GetDoubleArrayElements(yB, &isCopy);
172 double * xAA = pEnv->GetDoubleArrayElements(xA, &isCopy);
173 double * yAA = pEnv->GetDoubleArrayElements(yA, &isCopy);
174
175 TLUTGenerator<px_4x8bit, px_1x8bit> gen;
176 int retVal = gen.fillCurvesLUT_4ch( *(TLUT<px_4x8bit, px_1x8bit> *)lutAdress,
177 xMM, yMM, cM,
178 xRR, yRR, cR,
179 xGG, yGG, cG,
180 xBB, yBB, cB,
181 xAA, yAA, cA);
182
183 // Nebudou se kopirovat zpet hodnoty
184 pEnv->ReleaseDoubleArrayElements(xM, xMM, JNI_ABORT);
185 pEnv->ReleaseDoubleArrayElements(yM, yMM, JNI_ABORT);
186 pEnv->ReleaseDoubleArrayElements(xR, xRR, JNI_ABORT);
187 pEnv->ReleaseDoubleArrayElements(yR, yRR, JNI_ABORT);
188 pEnv->ReleaseDoubleArrayElements(xG, xGG, JNI_ABORT);
189 pEnv->ReleaseDoubleArrayElements(yG, yGG, JNI_ABORT);
190 pEnv->ReleaseDoubleArrayElements(xB, xBB, JNI_ABORT);
191 pEnv->ReleaseDoubleArrayElements(yB, yBB, JNI_ABORT);
192 pEnv->ReleaseDoubleArrayElements(xA, xAA, JNI_ABORT);
193 pEnv->ReleaseDoubleArrayElements(yA, yAA, JNI_ABORT);
194
195 return retVal;
196 }
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
229 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_applyTo__JJIIII(JNIEnv *pEnv, jclass pThisClass, jlong lutAdress, jlong dstAdress, jint dstTlx, jint dstTly, jint dstBrx,
230 jint dstBry) {
231 TLUT<px_4x8bit, px_1x8bit> * LUT = (TLUT<px_4x8bit, px_1x8bit> *) lutAdress;
232 rgba_8bit_bitmap * dst = (rgba_8bit_bitmap *) dstAdress;
233 return LUT->applyTo(*dst, Rect(dstTlx, dstTly, dstBrx, dstBry));
234 }
238 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_applyTo__JJIIIID(JNIEnv *pEnv, jclass pThisClass, jlong lutAdress, jlong dstAdress, jint dstTlx, jint dstTly, jint dstBrx,
239 jint dstBry, jdouble alpha) {
240 TLUT<px_4x8bit, px_1x8bit> * LUT = (TLUT<px_4x8bit, px_1x8bit> *) lutAdress;
241 rgba_8bit_bitmap * dst = (rgba_8bit_bitmap *) dstAdress;
242 return LUT->applyTo(*dst, Rect(dstTlx, dstTly, dstBrx, dstBry), alpha);
243 }
247 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_applyTo__JJJIIIIII(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress, jlong dstAdress, jlong mskAdress, jint mskTlx,
248 jint mskTly, jint mskBrx, jint mskBry, jint mskOrigX, jint mskOrigY) {
249 TLUT<px_4x8bit, px_1x8bit> * LUT = (TLUT<px_4x8bit, px_1x8bit> *) lutAdress;
250 rgba_8bit_bitmap * dst = (rgba_8bit_bitmap *) dstAdress;
251 mono_8bit_bitmap * msk = (mono_8bit_bitmap *) mskAdress;
252 return LUT->applyTo(*dst, *msk, Rect(mskTlx, mskTly, mskBrx, mskBry), Point(mskOrigX, mskOrigY));
253 }
257 JNIEXPORT jint JNICALL Java_mhr_appcore_pointops_LUT_applyTo__JJJIIIIIID(JNIEnv * pEnv, jclass pThisClass, jlong lutAdress, jlong dstAdress, jlong mskAdress, jint mskTlx,
258 jint mskTly, jint mskBrx, jint mskBry, jint mskOrigX, jint mskOrigY, jdouble alpha) {
259 TLUT<px_4x8bit, px_1x8bit> * LUT = (TLUT<px_4x8bit, px_1x8bit> *) lutAdress;
260 rgba_8bit_bitmap * dst = (rgba_8bit_bitmap *) dstAdress;
261 mono_8bit_bitmap * msk = (mono_8bit_bitmap *) mskAdress;
262 return LUT->applyTo(*dst, *msk, Rect(mskTlx, mskTly, mskBrx, mskBry), Point(mskOrigX, mskOrigY), alpha);
263 }