ImageFilterContrast.java revision d42f6c69c5980110c16cd679f914c4e4e7caa29d
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
8d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    public String name() {
9d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        return "Contrast";
10d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    }
11d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
12d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    public ImageFilter copy() {
13d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        return new ImageFilterContrast();
14d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    }
15d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
16d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, float strength);
17d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford
18d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    public void apply(Bitmap bitmap) {
19d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        int w = bitmap.getWidth();
20d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        int h = bitmap.getHeight();
21d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        float p = mParameter;
22d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        float value = p;
23d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford        nativeApplyFilter(bitmap, w, h, value);
24d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford    }
25d42f6c69c5980110c16cd679f914c4e4e7caa29dJohn Hoford}
26