Skip to content

Commit 60de3df

Browse files
committed
first commit
0 parents  commit 60de3df

File tree

135 files changed

+3276
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+3276
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
.DS_Store
6+
build
7+
/captures
8+
.externalNativeBuild

LICENSE.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2019 Allan Yoshio Hasegawa
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Tomo
2+
3+
Tomo is a collection of fast image processing effects for Android.
4+
Its main goal is to generate dynamic content for aesthetically pleasing apps.
5+
6+
## Showcase
7+
8+
In this demo app we showcase a cool adaptive background being generated using
9+
the content of the screen:
10+
11+
![](/docs/tomo_showcase.gif)
12+
13+
## Using it
14+
15+
Add the snippet below in your root `build.gradle` at the end of repositories:
16+
17+
```
18+
allprojects {
19+
repositories {
20+
...
21+
maven { url 'https://jitpack.io' }
22+
}
23+
}
24+
```
25+
26+
Then, add the dependency to your module:
27+
28+
```
29+
dependencies {
30+
compile 'com.github.AllanHasegawa.Tomo:tomo:x.y.z'
31+
}
32+
```
33+
34+
Latest release: [![Release](https://jitpack.io/v/AllanHasegawa/Tomo.svg)]
35+
(https://jitpack.io/#AllanHasegawa/Tomo)
36+
37+
Initialize the library in your `Application` class:
38+
39+
```
40+
class MyApp : Application {
41+
override fun onCreate() {
42+
Tomo.initialize(this)
43+
...
44+
}
45+
}
46+
```
47+
48+
Now you're ready to either apply the effects over `Bitmap`s or `ImageView`s:
49+
50+
```
51+
val myBitmap: Bitmap = ...
52+
val bitmapProcessed = Tomo.applyAdaptiveBackgroundGenerator(myBitmap, darkTheme = true)
53+
54+
val myImageView: ImageView = ...
55+
Tomo.applyAdaptiveBackgroundGenerator(myImageView, darkTheme = true)
56+
```
57+
58+
## Built-in effects
59+
60+
### Adaptive Background Generator
61+
62+
<table>
63+
<tr>
64+
<th rowspan="2">Source Image</th>
65+
<th colspan="2">Adaptive Background Generator</th>
66+
</tr>
67+
<tr>
68+
<th>Dark Theme</th>
69+
<th>Light Theme</th>
70+
</tr>
71+
<tr>
72+
<td><img width="100" src="/docs/tsunami_original.jpg?raw=true"></td>
73+
<td><img width="100" src="/docs/tsunami_adp_bg_dark.png?raw=true"></td>
74+
<td><img width="100" src="/docs/tsunami_adp_bg_light.png?raw=true"></td>
75+
</tr>
76+
<tr>
77+
<td><img width="100" src="/docs/dali_original.jpg?raw=true"></td>
78+
<td><img width="100" src="/docs/dali_adp_bg_dark.png?raw=true"></td>
79+
<td><img width="100" src="/docs/dali_adp_bg_light.png?raw=true"></td>
80+
</tr>
81+
</table>
82+
83+
## Custom effects
84+
85+
Tomo comes equipped with a list of image transformations that can be
86+
arranged in any order to build cool custom effects.
87+
88+
To transform a `Bitmap`, call `Tomo::applyCustomTransformation()`:
89+
90+
```kotlin
91+
val newBitmap = Tomo.applyCustomTransformation(oldBitmap) {
92+
// Scale to 1/10 of its size
93+
resize(
94+
newWidth = initialSize.width / 10,
95+
newHeight = initialSize.height / 10
96+
)
97+
98+
// Blur it
99+
blur(radius = 25f)
100+
101+
// Clamp the value (from HSV)
102+
valueClamp(
103+
lowValue = 0.05f,
104+
highValue = 0.3f,
105+
saturationMultiplier = 1.3f,
106+
saturationLowValue = 0f,
107+
saturationHighValue = 1f
108+
)
109+
110+
// Apply a noise overlay
111+
grayNoise()
112+
}
113+
```
114+
115+
### `resize`
116+
117+
`resize`, as the name implies, lets you resize the bitmap.
118+
119+
### `blur`
120+
121+
`blur` applies a gaussian blur. It's maximum radius is `25f`.
122+
123+
### `valueClamp`
124+
125+
`valueClamp` clamps the value and the saturation of an image.
126+
It can also scale the saturation.
127+
128+
### `grayNoise`
129+
130+
`grayNoise` applies a gray noise over the image.
131+
132+
### `rgbNoise`
133+
134+
`rgbNoise` assigns a random, close, RGB color to each pixel.
135+
136+
# License
137+
138+
```
139+
Copyright 2019 Allan Yoshio Hasegawa
140+
141+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
142+
143+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
144+
145+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
146+
```

build.gradle.kts

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
repositories {
5+
google()
6+
jcenter()
7+
}
8+
dependencies {
9+
classpath("com.android.tools.build:gradle:3.3.0")
10+
classpath(kotlin("gradle-plugin", version = Versions.kotlin))
11+
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
12+
13+
// NOTE: Do not place your application dependencies here; they belong
14+
// in the individual module build.gradle.kts files
15+
}
16+
}
17+
18+
allprojects {
19+
repositories {
20+
google()
21+
jcenter()
22+
}
23+
}
24+
25+
tasks.register("clean", Delete::class) {
26+
delete(rootProject.buildDir)
27+
}

buildSrc/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
jcenter()
7+
}

buildSrc/settings.gradle.kts

Whitespace-only changes.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object AndroidConfig {
2+
const val compileSdkVersion = 28
3+
const val targetSdkVersion = compileSdkVersion
4+
const val minSdkVersion = 23
5+
}

buildSrc/src/main/java/Dep.kt

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
object Dep {
2+
private val v = Versions
3+
4+
// Kotlin
5+
6+
const val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${v.kotlin}"
7+
const val junit = "junit:junit:${v.junit}"
8+
const val retrofit = "com.squareup.retrofit2:retrofit:${v.retrofit}"
9+
const val retrofitMoshi = "com.squareup.retrofit2:converter-moshi:${v.retrofit}"
10+
11+
// Android
12+
13+
const val appCompat = "androidx.appcompat:appcompat:${v.appCompat}"
14+
const val testRunner = "androidx.test:runner:${v.testRunner}"
15+
const val espresso = "androidx.test.espresso:espresso-core:${v.espresso}"
16+
const val constraintLayout = "androidx.constraintlayout:constraintlayout:${v.constraintLayout}"
17+
const val picasso = "com.squareup.picasso:picasso:${v.picasso}"
18+
const val groupie = "com.xwray:groupie:${v.groupie}"
19+
const val groupieKt = "com.xwray:groupie-kotlin-android-extensions:${v.groupie}"
20+
const val material = "com.google.android.material:material:${v.material}"
21+
const val rebound = "com.facebook.rebound:rebound:${v.rebound}"
22+
const val rvAnimators = "jp.wasabeef:recyclerview-animators:${v.rvAnimators}"
23+
}
24+
25+
object Versions {
26+
// Kotlin
27+
28+
const val kotlin = "1.3.20"
29+
const val junit = "4.12"
30+
const val retrofit = "2.5.0"
31+
32+
// Android
33+
34+
const val appCompat = "1.0.2"
35+
const val material = "1.0.0"
36+
const val testRunner = "1.1.1"
37+
const val espresso = "3.1.1"
38+
const val constraintLayout = "2.0.0-alpha3"
39+
const val picasso = "2.71828"
40+
const val groupie = "2.3.0"
41+
const val rebound = "0.3.8"
42+
const val rvAnimators = "3.0.0"
43+
}

buildSrc/src/main/java/versioning.kt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
object Versioning {
2+
private val semantic = Semantic(
3+
major = 0,
4+
minor = 0,
5+
patch = 1
6+
)
7+
8+
val version = semantic.toVersion()
9+
}
10+
11+
data class Version(val code: Int, val name: String)
12+
13+
private data class Semantic(
14+
val major: Int,
15+
val minor: Int,
16+
val patch: Int
17+
) {
18+
fun toVersion() = Version(
19+
code = major * 10_000 + minor * 100 + patch,
20+
name = "$major.$minor.$patch"
21+
)
22+
}

docs/dali_adp_bg_dark.png

1.59 MB
Loading

docs/dali_adp_bg_light.png

1.36 MB
Loading

docs/dali_original.jpg

50.8 KB
Loading

docs/tomo_showcase.gif

19.9 MB
Loading

docs/tsunami_adp_bg_dark.png

1.41 MB
Loading

docs/tsunami_adp_bg_light.png

1.48 MB
Loading

docs/tsunami_original.jpg

30.9 KB
Loading

gradle.properties

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx1536m
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# Kotlin code style for this project: "official" or "obsolete":
15+
kotlin.code.style=official
16+
android.useAndroidX=true
17+
android.enableJetifier=true

gradle/wrapper/gradle-wrapper.jar

53.1 KB
Binary file not shown.
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)