diff --git a/example/src/main/java/com/example/filters/MainActivity.java b/example/src/main/java/com/example/filters/MainActivity.java index c3120d2..3d116ef 100644 --- a/example/src/main/java/com/example/filters/MainActivity.java +++ b/example/src/main/java/com/example/filters/MainActivity.java @@ -61,6 +61,11 @@ public void run() { ThumbnailItem t4 = new ThumbnailItem(); ThumbnailItem t5 = new ThumbnailItem(); ThumbnailItem t6 = new ThumbnailItem(); + ThumbnailItem t7 = new ThumbnailItem(); + ThumbnailItem t8 = new ThumbnailItem(); + ThumbnailItem t9 = new ThumbnailItem(); + ThumbnailItem t10 = new ThumbnailItem(); + ThumbnailItem t11 = new ThumbnailItem(); t1.image = thumbImage; t2.image = thumbImage; @@ -68,6 +73,11 @@ public void run() { t4.image = thumbImage; t5.image = thumbImage; t6.image = thumbImage; + t7.image = thumbImage; + t8.image = thumbImage; + t9.image = thumbImage; + t10.image = thumbImage; + t11.image = thumbImage; ThumbnailsManager.clearThumbs(); ThumbnailsManager.addThumb(t1); // Original Image @@ -86,6 +96,23 @@ public void run() { t6.filter = SampleFilters.getNightWhisperFilter(); ThumbnailsManager.addThumb(t6); + t7.filter = SampleFilters.getBlackAndWhiteFilter(); + ThumbnailsManager.addThumb(t7); + + t8.filter = SampleFilters.getArtisticBWFilter(); + ThumbnailsManager.addThumb(t8); + + t9.filter = SampleFilters.getPurplishFilter(); + ThumbnailsManager.addThumb(t9); + + t10.filter = SampleFilters.getSepiaFilter(); + ThumbnailsManager.addThumb(t10); + + t11.filter = SampleFilters.getCutenessFilter(); + ThumbnailsManager.addThumb(t11); + + + List thumbs = ThumbnailsManager.processThumbs(context); ThumbnailsAdapter adapter = new ThumbnailsAdapter(thumbs, (ThumbnailCallback) activity); diff --git a/photofilterssdk/src/main/java/com/zomato/photofilters/SampleFilters.java b/photofilterssdk/src/main/java/com/zomato/photofilters/SampleFilters.java index 6f2a663..fdcbaed 100644 --- a/photofilterssdk/src/main/java/com/zomato/photofilters/SampleFilters.java +++ b/photofilterssdk/src/main/java/com/zomato/photofilters/SampleFilters.java @@ -2,8 +2,11 @@ import com.zomato.photofilters.geometry.Point; import com.zomato.photofilters.imageprocessors.Filter; +import com.zomato.photofilters.imageprocessors.SubFilter; import com.zomato.photofilters.imageprocessors.subfilters.BrightnessSubFilter; +import com.zomato.photofilters.imageprocessors.subfilters.ColorOverlaySubFilter; import com.zomato.photofilters.imageprocessors.subfilters.ContrastSubFilter; +import com.zomato.photofilters.imageprocessors.subfilters.SaturationSubFilter; import com.zomato.photofilters.imageprocessors.subfilters.ToneCurveSubFilter; /** @@ -135,4 +138,71 @@ public static Filter getNightWhisperFilter() { filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, redKnots, greenKnots, blueKnots)); return filter; } + + public static Filter getBlackAndWhiteFilter() { + Filter filter = new Filter(); + filter.addSubFilter(new SaturationSubFilter((float) -0.99)); + return filter; + } + + public static Filter getArtisticBWFilter(){ + + Point[] redKnots; + redKnots = new Point[8]; + redKnots[0] = new Point(0, 0); + redKnots[1] = new Point(86, 34); + redKnots[2] = new Point(117, 41); + redKnots[3] = new Point(146, 80); + redKnots[4] = new Point(170, 151); + redKnots[5] = new Point(200, 214); + redKnots[6] = new Point(225, 242); + redKnots[7] = new Point(255, 255); + Filter filter = new Filter(); + filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, null)); + filter.addSubFilter(new SaturationSubFilter((float) -0.99)); + return filter; + } + + public static Filter getPurplishFilter(){ + + Point[] rgbKnots; + rgbKnots = new Point[3]; + rgbKnots[0] = new Point(0, 0); + rgbKnots[1] = new Point(89, 67); + rgbKnots[2] = new Point(255, 255); + Filter filter = new Filter(); + filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, null, null, null)); + filter.addSubFilter(new ColorOverlaySubFilter(100,(float)0.41,0,(float )0.68)); + return filter; + } + + public static Filter getSepiaFilter(){ + + Point[] rgbKnots; + rgbKnots = new Point[3]; + rgbKnots[0] = new Point(0, 0); + rgbKnots[1] = new Point(73, 38); + rgbKnots[2] = new Point(255, 255); + Filter filter = new Filter(); + filter.addSubFilter(new SaturationSubFilter((float) -0.99)); + filter.addSubFilter(new ColorOverlaySubFilter(50,0,(float)0.38,0)); + filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, null, null, null)); + return filter; + + + } + + + public static Filter getCutenessFilter(){ + Point[] rgbKnots; + rgbKnots = new Point[3]; + rgbKnots[0] = new Point(0, 0); + rgbKnots[1] = new Point(65, 34); + rgbKnots[2] = new Point(255, 255); + Filter filter = new Filter(); + filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, null, null, null)); + filter.addSubFilter(new SaturationSubFilter((float) 1.72)); + return filter; + } + }