2 * Copyright (C) 2012 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <android/log.h>
23 #include <android/bitmap.h>
25 typedef unsigned int Color;
27 #define SetColor(a, r, g, b) (((a) << 24) | ((b) << 16) | ((g) << 8) | ((r) << 0));
28 #define GetA(color) (((color) >> 24) & 0xFF)
29 #define GetB(color) (((color) >> 16) & 0xFF)
30 #define GetG(color) (((color) >> 8) & 0xFF)
31 #define GetR(color) (((color) >> 0) & 0xFF)
33 #define MIN(a, b) ((a) < (b) ? (a) : (b))
34 #define MAX(a, b) ((a) > (b) ? (a) : (b))
36 #define LOG(msg...) __android_log_print(ANDROID_LOG_VERBOSE, "NativeFilters", msg)
38 #define JNIFUNCF(cls, name, vars...) Java_com_android_gallery3d_filtershow_filters_ ## cls ## _ ## name(JNIEnv* env, jobject obj, vars)
44 #define CLAMP(c) (MAX(0, MIN(255, c)))
46 __inline__ unsigned char clamp(int c);
47 __inline__ int clampMax(int c,int max);
49 extern void rgb2hsv( unsigned char *rgb,int rgbOff,unsigned short *hsv,int hsvOff);
50 extern void hsv2rgb(unsigned short *hsv,int hsvOff,unsigned char *rgb,int rgbOff);
51 extern void filterRedEye(unsigned char *src, unsigned char *dest, int iw, int ih, short *rect);
52 extern double fastevalPoly(double *poly,int n, double x);