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 private static final String SERIALIZATION_NAME = "NEGATIVE"; 10 public ImageFilterNegative() { 11 mName = "Negative"; 12 } 13 14 public FilterRepresentation getDefaultRepresentation() { 15 FilterRepresentation representation = new FilterDirectRepresentation("Negative"); 16 representation.setSerializationName(SERIALIZATION_NAME); 17 representation.setFilterClass(ImageFilterNegative.class); 18 representation.setTextId(R.string.negative); 19 representation.setShowParameterValue(false); 20 representation.setEditorId(ImageOnlyEditor.ID); 21 representation.setSupportsPartialRendering(true); 22 representation.setIsBooleanFilter(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