nicolasroard | 0d7cdf8 | 2012-09-25 14:27:56 -0700 | [diff] [blame] | 1 | |
| 2 | package com.android.gallery3d.filtershow.filters; |
| 3 | |
| 4 | import android.graphics.Bitmap; |
| 5 | |
| 6 | public class ImageFilterSaturated extends ImageFilter { |
| 7 | |
nicolasroard | bf93da7 | 2012-09-29 00:17:09 -0700 | [diff] [blame] | 8 | public ImageFilterSaturated() { |
| 9 | mName = "Saturated"; |
nicolasroard | 0d7cdf8 | 2012-09-25 14:27:56 -0700 | [diff] [blame] | 10 | } |
| 11 | |
| 12 | native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float saturation); |
| 13 | |
nicolasroard | 81eb997 | 2012-10-05 15:55:56 -0700 | [diff] [blame] | 14 | @Override |
| 15 | public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { |
nicolasroard | 0d7cdf8 | 2012-09-25 14:27:56 -0700 | [diff] [blame] | 16 | int w = bitmap.getWidth(); |
| 17 | int h = bitmap.getHeight(); |
John Hoford | d42f6c6 | 2012-09-27 16:34:21 -0700 | [diff] [blame] | 18 | int p = mParameter; |
| 19 | float value = 1 + p / 100.0f; |
nicolasroard | 0d7cdf8 | 2012-09-25 14:27:56 -0700 | [diff] [blame] | 20 | nativeApplyFilter(bitmap, w, h, value); |
nicolasroard | 81eb997 | 2012-10-05 15:55:56 -0700 | [diff] [blame] | 21 | return bitmap; |
nicolasroard | 0d7cdf8 | 2012-09-25 14:27:56 -0700 | [diff] [blame] | 22 | } |
| 23 | } |