ImageFilterContrast.java revision 81eb9976f967d9b3faa1749a8ab29d1743cf347d
1d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
2d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hofordpackage com.android.gallery3d.filtershow.filters;
3d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
4d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hofordimport android.graphics.Bitmap;
5d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
6d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hofordpublic class ImageFilterContrast extends ImageFilter {
7d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
8bf93da72576b28f4e9dfb27f8f3fef702c8ae82dnicolasroard    public ImageFilterContrast() {
9bf93da72576b28f4e9dfb27f8f3fef702c8ae82dnicolasroard        mName = "Contrast";
10d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    }
11d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
12d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float strength);
13d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
1481eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard    @Override
1581eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard    public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
16d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        int w = bitmap.getWidth();
17d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        int h = bitmap.getHeight();
18d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        float p = mParameter;
19d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        float value = p;
20d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        nativeApplyFilter(bitmap, w, h, value);
2181eb9976f967d9b3faa1749a8ab29d1743cf347dnicolasroard        return bitmap;
22d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    }
23d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford}
24