-
Notifications
You must be signed in to change notification settings - Fork 482
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
Added Instagram-like filters. #45
Open
tizisdeepan
wants to merge
3
commits into
Zomato:master
Choose a base branch
from
tizisdeepan:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@color/thumb_background_color"> | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:background="@color/thumb_background_color" | ||
android:orientation="vertical"> | ||
|
||
<ImageView | ||
android:id="@+id/thumbnail" | ||
android:layout_width="@dimen/thumbnail_size" | ||
android:layout_height="@dimen/thumbnail_size" | ||
android:paddingLeft="@dimen/thumbnail_horizontal_padding" | ||
android:paddingRight="@dimen/thumbnail_horizontal_padding"/> | ||
android:paddingRight="@dimen/thumbnail_horizontal_padding" /> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,13 @@ | |
import com.zomato.photofilters.geometry.Point; | ||
import com.zomato.photofilters.imageprocessors.Filter; | ||
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; | ||
|
||
import java.lang.reflect.Array; | ||
|
||
/** | ||
* @author Varun on 01/07/15. | ||
*/ | ||
|
@@ -135,4 +139,200 @@ public static Filter getNightWhisperFilter() { | |
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, redKnots, greenKnots, blueKnots)); | ||
return filter; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are the recreated Instagram filters. |
||
public static Filter getDefaultFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new BrightnessSubFilter(20)); | ||
filter.addSubFilter(new ContrastSubFilter(1.4f)); | ||
filter.addSubFilter(new SaturationSubFilter(1.4f)); | ||
return filter; | ||
} | ||
|
||
public static Filter getMayFairFilter() { | ||
Point[] rgbKnots = new Point[8]; | ||
rgbKnots[0] = new Point(0f, 0f); | ||
rgbKnots[1] = new Point(34f, 6f); | ||
rgbKnots[2] = new Point(69f, 23f); | ||
rgbKnots[3] = new Point(100f, 58f); | ||
rgbKnots[4] = new Point(150f, 154f); | ||
rgbKnots[5] = new Point(176f, 196f); | ||
rgbKnots[6] = new Point(207f, 233f); | ||
rgbKnots[7] = new Point(255f, 255f); | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, null, null, null)); | ||
return filter; | ||
} | ||
|
||
public static Filter getSierraFilter() { | ||
Point[] rgbKnots = new Point[2]; | ||
Point[] redKnots = new Point[2]; | ||
|
||
rgbKnots[0] = new Point(0f, 54f); | ||
rgbKnots[1] = new Point(255f, 255f); | ||
|
||
redKnots[0] = new Point(0f, 21f); | ||
redKnots[1] = new Point(255f, 255f); | ||
|
||
|
||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ToneCurveSubFilter(rgbKnots, redKnots, null, null)); | ||
filter.addSubFilter(new ContrastSubFilter(1.33f)); | ||
filter.addSubFilter(new BrightnessSubFilter(-30)); | ||
return filter; | ||
} | ||
|
||
public static Filter getAmazonFilter() { | ||
Point[] blueKnots = new Point[6]; | ||
blueKnots[0] = new Point(0f, 0f); | ||
blueKnots[1] = new Point(11f, 40f); | ||
blueKnots[2] = new Point(36f, 99f); | ||
blueKnots[3] = new Point(86f, 151f); | ||
blueKnots[4] = new Point(167f, 209f); | ||
blueKnots[5] = new Point(255f, 255f); | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.2f)); | ||
filter.addSubFilter(new ToneCurveSubFilter(null, null, null, blueKnots)); | ||
return filter; | ||
} | ||
|
||
public static Filter getAdeleFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new SaturationSubFilter(-100f)); | ||
return filter; | ||
} | ||
|
||
public static Filter getCruzFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new SaturationSubFilter(-100f)); | ||
filter.addSubFilter(new ContrastSubFilter(1.3f)); | ||
filter.addSubFilter(new BrightnessSubFilter(20)); | ||
return filter; | ||
} | ||
|
||
public static Filter getMetropolisFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new SaturationSubFilter(-1f)); | ||
filter.addSubFilter(new ContrastSubFilter(1.7f)); | ||
filter.addSubFilter(new BrightnessSubFilter(70)); | ||
return filter; | ||
} | ||
|
||
public static Filter getAudreyFilter() { | ||
Filter filter = new Filter(); | ||
|
||
Point[] redKnots = new Point[3]; | ||
redKnots[0] = new Point(0f, 0f); | ||
redKnots[1] = new Point(124f, 138f); | ||
redKnots[2] = new Point(255f, 255f); | ||
|
||
filter.addSubFilter(new SaturationSubFilter(-100f)); | ||
filter.addSubFilter(new ContrastSubFilter(1.3f)); | ||
filter.addSubFilter(new BrightnessSubFilter(20)); | ||
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, null)); | ||
return filter; | ||
} | ||
|
||
public static Filter getRiseFilter() { | ||
Point[] blueKnots = new Point[4]; | ||
Point[] redKnots = new Point[4]; | ||
|
||
blueKnots[0] = new Point(0f, 0f); | ||
blueKnots[1] = new Point(39f, 70f); | ||
blueKnots[2] = new Point(150f, 200f); | ||
blueKnots[3] = new Point(255f, 255f); | ||
|
||
redKnots[0] = new Point(0f, 0f); | ||
redKnots[1] = new Point(45f, 64f); | ||
redKnots[2] = new Point(170f, 190f); | ||
redKnots[3] = new Point(255f, 255f); | ||
|
||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.9f)); | ||
filter.addSubFilter(new BrightnessSubFilter(60)); | ||
// filter.addSubFilter(VignetteSubfilter(ctx, 200)) | ||
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, blueKnots)); | ||
return filter; | ||
} | ||
|
||
public static Filter getMarsFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.5f)); | ||
filter.addSubFilter(new BrightnessSubFilter(10)); | ||
return filter; | ||
} | ||
|
||
public static Filter getAprilFilter() { | ||
Point[] blueKnots = new Point[4]; | ||
Point[] redKnots = new Point[4]; | ||
|
||
blueKnots[0] = new Point(0f, 0f); | ||
blueKnots[1] = new Point(39f, 70f); | ||
blueKnots[2] = new Point(150f, 200f); | ||
blueKnots[3] = new Point(255f, 255f); | ||
|
||
redKnots[0] = new Point(0f, 0f); | ||
redKnots[1] = new Point(45f, 64f); | ||
redKnots[2] = new Point(170f, 190f); | ||
redKnots[3] = new Point(255f, 255f); | ||
|
||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.5f)); | ||
filter.addSubFilter(new BrightnessSubFilter(5)); | ||
// filter.addSubFilter(VignetteSubfilter(context, 150)) | ||
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, null, blueKnots)); | ||
return filter; | ||
} | ||
|
||
public static Filter getHaanFilter() { | ||
Point[] greenKnots = new Point[3]; | ||
greenKnots[0] = new Point(0f, 0f); | ||
greenKnots[1] = new Point(113f, 142f); | ||
greenKnots[2] = new Point(255f, 255f); | ||
|
||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.3f)); | ||
filter.addSubFilter(new BrightnessSubFilter(60)); | ||
// filter.addSubFilter(VignetteSubfilter(context, 200)) | ||
filter.addSubFilter(new ToneCurveSubFilter(null, null, greenKnots, null)); | ||
return filter; | ||
} | ||
|
||
public static Filter getOldManFilter() { | ||
Filter filter = new Filter(); | ||
filter.addSubFilter(new BrightnessSubFilter(30)); | ||
filter.addSubFilter(new SaturationSubFilter(0.8f)); | ||
filter.addSubFilter(new ContrastSubFilter(1.3f)); | ||
// filter.addSubFilter(VignetteSubfilter(context, 100)) | ||
filter.addSubFilter(new ColorOverlaySubFilter(100, .2f, .2f, .1f)); | ||
return filter; | ||
} | ||
|
||
public static Filter getClarendonFilter() { | ||
Point[] redKnots = new Point[4]; | ||
Point[] greenKnots = new Point[4]; | ||
Point[] blueKnots = new Point[4]; | ||
|
||
redKnots[0] = new Point(0f, 0f); | ||
redKnots[1] = new Point(56f, 68f); | ||
redKnots[2] = new Point(196f, 206f); | ||
redKnots[3] = new Point(255f, 255f); | ||
|
||
|
||
greenKnots[0] = new Point(0f, 0f); | ||
greenKnots[1] = new Point(46f, 77f); | ||
greenKnots[2] = new Point(160f, 200f); | ||
greenKnots[3] = new Point(255f, 255f); | ||
|
||
|
||
blueKnots[0] = new Point(0f, 0f); | ||
blueKnots[1] = new Point(33f, 86f); | ||
blueKnots[2] = new Point(126f, 220f); | ||
blueKnots[3] = new Point(255f, 255f); | ||
|
||
Filter filter = new Filter(); | ||
filter.addSubFilter(new ContrastSubFilter(1.5f)); | ||
filter.addSubFilter(new BrightnessSubFilter(-10)); | ||
filter.addSubFilter(new ToneCurveSubFilter(null, redKnots, greenKnots, blueKnots)); | ||
return filter; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to redo the object instantiations in order to make the code better understanding. I have used the respective filter names for variables.