ImageFilterVibrance.java revision a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1
1a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard/* 2a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * Copyright (C) 2012 The Android Open Source Project 3a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * 4a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * Licensed under the Apache License, Version 2.0 (the "License"); 5a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * you may not use this file except in compliance with the License. 6a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * You may obtain a copy of the License at 7a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * 8a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * http://www.apache.org/licenses/LICENSE-2.0 9a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * 10a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * Unless required by applicable law or agreed to in writing, software 11a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * distributed under the License is distributed on an "AS IS" BASIS, 12a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * See the License for the specific language governing permissions and 14a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard * limitations under the License. 15a9f280f938b5fd5891c5cfe0999f8f1d4945d7a1nicolasroard */ 16b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 17b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hofordpackage com.android.gallery3d.filtershow.filters; 18b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 19b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hofordimport android.graphics.Bitmap; 20b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 21b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hofordpublic class ImageFilterVibrance extends ImageFilter { 22b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 23b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford public ImageFilterVibrance() { 24b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford mName = "Vibrance"; 25b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford } 26b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 27b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float bright); 28b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford 29b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford @Override 3081eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) { 31b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford int w = bitmap.getWidth(); 32b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford int h = bitmap.getHeight(); 33b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford int p = mParameter; 34b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford float value = p; 35b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford nativeApplyFilter(bitmap, w, h, value); 3681eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard 3781eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard return bitmap; 38b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford } 39b559b2dd6637660ddbbdbae79a742c9f0fb1180bJohn Hoford} 40