Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidPhotoFilters - New Filters #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions example/src/main/java/com/example/filters/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,23 @@ 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;
t3.image = thumbImage;
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

Expand All @@ -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<ThumbnailItem> thumbs = ThumbnailsManager.processThumbs(context);

ThumbnailsAdapter adapter = new ThumbnailsAdapter(thumbs, (ThumbnailCallback) activity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}

}