blob: 1d345919582b4213078d3b1fe552603befdbc0c7 [file] [log] [blame]
nicolasroarda9f280f2012-10-23 11:26:38 -07001/*
2 * Copyright (C) 2012 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 */
nicolasroard0d7cdf82012-09-25 14:27:56 -070016
17package com.android.gallery3d.filtershow.filters;
18
19import android.graphics.Bitmap;
20
21public class ImageFilterSaturated extends ImageFilter {
22
nicolasroardbf93da72012-09-29 00:17:09 -070023 public ImageFilterSaturated() {
24 mName = "Saturated";
nicolasroard0d7cdf82012-09-25 14:27:56 -070025 }
26
27 native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float saturation);
28
nicolasroard81eb9972012-10-05 15:55:56 -070029 @Override
30 public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
nicolasroard0d7cdf82012-09-25 14:27:56 -070031 int w = bitmap.getWidth();
32 int h = bitmap.getHeight();
John Hofordd42f6c62012-09-27 16:34:21 -070033 int p = mParameter;
34 float value = 1 + p / 100.0f;
nicolasroard0d7cdf82012-09-25 14:27:56 -070035 nativeApplyFilter(bitmap, w, h, value);
nicolasroard81eb9972012-10-05 15:55:56 -070036 return bitmap;
nicolasroard0d7cdf82012-09-25 14:27:56 -070037 }
38}