1 package com.android.gallery3d.filtershow.filters; 2 3 import android.graphics.Bitmap; 4 5 import com.android.gallery3d.R; 6 import com.android.gallery3d.filtershow.editors.ImageOnlyEditor; 7 8 public class ImageFilterNegative extends ImageFilter { 9 10 public ImageFilterNegative() { 11 mName = "Negative"; 12 } 13 14 public FilterRepresentation getDefaultRepresentation() { 15 FilterRepresentation representation = new FilterDirectRepresentation("Negative"); 16 representation.setFilterClass(ImageFilterNegative.class); 17 representation.setTextId(R.string.negative); 18 representation.setButtonId(R.id.negativeButton); 19 representation.setShowEditingControls(false); 20 representation.setShowParameterValue(false); 21 representation.setEditorId(ImageOnlyEditor.ID); 22 representation.setSupportsPartialRendering(true); 23 return representation; 24 } 25 26 native protected void nativeApplyFilter(Bitmap bitmap, int w, int h); 27 28 @Override 29 public void useRepresentation(FilterRepresentation representation) { 30 31 } 32 33 @Override 34 public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) { 35 int w = bitmap.getWidth(); 36 int h = bitmap.getHeight(); 37 nativeApplyFilter(bitmap, w, h); 38 return bitmap; 39 } 40 } 41