1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 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 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 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. 15 */ 16 17 package com.android.photoeditor.filters; 18 19 import android.graphics.Bitmap; 20 import android.graphics.PointF; 21 22 23 /** 24 * Image utilities that calls to JNI methods for image processing. 25 */ 26 public class ImageUtils { 27 28 static { 29 System.loadLibrary("jni_photoeditor"); 30 } 31 32 public static native boolean init(byte[] pgm, int pgmLength); 33 34 public static native void nativeBacklight(Bitmap src, Bitmap dst, float backlight); 35 public static native void nativeBlur(Bitmap src, Bitmap dst, float scale); 36 public static native void nativeColorTemp(Bitmap src, Bitmap dst, float scale); 37 public static native void nativeCopy(Bitmap src, Bitmap dst); 38 public static native void nativeCrossProcess(Bitmap src, Bitmap dst); 39 public static native void nativeDuotone(Bitmap src, Bitmap dst, int firstColor, 40 int secondColor); 41 public static native void nativeFisheye(Bitmap src, Bitmap dst, float focusX, 42 float focusY, float scale); 43 public static native void nativeFlipBoth(Bitmap src, Bitmap dst); 44 public static native void nativeFlipHorizontal(Bitmap src, Bitmap dst); 45 public static native void nativeFlipVertical(Bitmap src, Bitmap dst); 46 public static native void nativeGrain(Bitmap src, Bitmap dst, float scale); 47 public static native void nativeGrayscale(Bitmap src, Bitmap dst, float scale); 48 public static native void nativeHEQ(Bitmap src, Bitmap dst, float scale); 49 public static native void nativeNegative(Bitmap src, Bitmap dst); 50 public static native void nativeQuantize(Bitmap src, Bitmap dst); 51 public static native void nativeRedEye(Bitmap src, Bitmap dst, PointF[] redeyes, 52 float radius, float intensity); 53 public static native void nativeSaturation(Bitmap src, Bitmap dst, float scale); 54 public static native void nativeSepia(Bitmap src, Bitmap dst); 55 public static native void nativeSharpen(Bitmap src, Bitmap dst, float scale); 56 public static native void nativeTint(Bitmap src, Bitmap dst, int tint); 57 public static native void nativeVignetting(Bitmap src, Bitmap dst, float range); 58 public static native void nativeWarmify(Bitmap src, Bitmap dst); 59 public static native void nativeWhiteBlack(Bitmap src, Bitmap dst, float white, float black); 60 } 61