| 21 | |
| 22 | |
| 23 | public class Effect |
| 24 | { |
| 25 | private static final boolean NATIVE = false; |
| 26 | private final static ColorMatrix matrix = new ColorMatrix(); |
| 27 | |
| 28 | public enum DistortionType |
| 29 | { |
| 30 | SHRINK_GROW, |
| 31 | SWIRL_CW_CCW, |
| 32 | SMEAR, |
| 33 | } |
| 34 | |
| 35 | public enum SelectCriterion |
| 36 | { |
| 37 | COMPOSITE, |
| 38 | |
| 39 | RED, |
| 40 | GREEN, |
| 41 | BLUE, |
| 42 | ALPHA, |
| 43 | |
| 44 | HUE, |
| 45 | SATURATION, |
| 46 | VALUE, |
| 47 | }; |
| 48 | |
| 49 | public static void applyWhirlPinch(Bitmap image, Point pivot, float whirl, float pinch, float radius) |
| 50 | { |
| 51 | if(image == null || image.getConfig() != Bitmap.Config.ARGB_8888) |
| 52 | throw new IllegalArgumentException("bad image"); // 0xBAD13A9E |
| 53 | |
| 54 | nativeApplyWhirlPinch(image, pivot, whirl, pinch, radius); |
| 55 | } |
| 56 | |
| 57 | public static void applyWhirlPinch(Bitmap image, float whirl, float pinch, float radius) |
| 58 | { |
| 59 | if(image == null || image.getConfig() != Bitmap.Config.ARGB_8888) |
| 60 | throw new IllegalArgumentException("bad image"); // 0xBAD13A9E |
| 61 | nativeApplyWhirlPinch2(image, whirl, pinch, radius); |
| 62 | } |
| 63 | |
| 64 | public static void distort(Bitmap image, PointF point0, PointF point1, float strength, DistortionType type) |
| 65 | { |
| 66 | if(image == null || image.getConfig() != Bitmap.Config.ARGB_8888) |
| 67 | throw new IllegalArgumentException("bad image"); // 0xBAD13A9E |
| 68 | |
| 69 | nativeDistort(image, point0, point1, strength, type.ordinal()); |
| 70 | } |
| 71 | |
| 72 | public static void catmullRomSpline(PointF result, float t, PointF p0, PointF p1, PointF p2, PointF p3) |
| 73 | { |
| 74 | if(BuildConfig.DEBUG && (result == null || p0 == null || p1 == null || p2 == null || p3 == null)) |
| 75 | throw new NullPointerException("PointF is null"); |
| 76 | |
| 77 | nativeCatmullRomSpline(result, t, p0, p1, p2, p3); |
| 78 | } |
| 79 | |
| 80 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected