Revision bf0bc90f
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
import org.distorted.examples.R; |
30 | 30 |
import org.distorted.library.Distorted; |
31 |
import org.distorted.library.EffectQuality; |
|
31 | 32 |
|
32 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
33 | 34 |
|
... | ... | |
163 | 164 |
case R.id.multiblurCheckBox7 : sView.getRenderer().setChecked(7,checked); break; |
164 | 165 |
} |
165 | 166 |
} |
167 |
|
|
168 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
169 |
|
|
170 |
public void quality0(View v) |
|
171 |
{ |
|
172 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
173 |
MultiblurRenderer renderer = view.getRenderer(); |
|
174 |
renderer.setQuality(EffectQuality.HIGHEST); |
|
175 |
} |
|
176 |
|
|
177 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
178 |
|
|
179 |
public void quality1(View v) |
|
180 |
{ |
|
181 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
182 |
MultiblurRenderer renderer = view.getRenderer(); |
|
183 |
renderer.setQuality(EffectQuality.HIGH); |
|
184 |
} |
|
185 |
|
|
186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
187 |
|
|
188 |
public void quality2(View v) |
|
189 |
{ |
|
190 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
191 |
MultiblurRenderer renderer = view.getRenderer(); |
|
192 |
renderer.setQuality(EffectQuality.MEDIUM); |
|
193 |
} |
|
194 |
|
|
195 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
196 |
|
|
197 |
public void quality3(View v) |
|
198 |
{ |
|
199 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
200 |
MultiblurRenderer renderer = view.getRenderer(); |
|
201 |
renderer.setQuality(EffectQuality.LOW); |
|
202 |
} |
|
166 | 203 |
} |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
33 | 33 |
import org.distorted.library.DistortedScreen; |
34 | 34 |
import org.distorted.library.DistortedTexture; |
35 | 35 |
import org.distorted.library.EffectNames; |
36 |
import org.distorted.library.EffectQuality; |
|
36 | 37 |
import org.distorted.library.EffectTypes; |
37 | 38 |
import org.distorted.library.MeshCubes; |
38 | 39 |
import org.distorted.library.MeshFlat; |
... | ... | |
176 | 177 |
} |
177 | 178 |
|
178 | 179 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
179 |
|
|
180 |
|
|
181 |
void setQuality(EffectQuality quality) |
|
182 |
{ |
|
183 |
mPostEffects.setQuality(quality); |
|
184 |
} |
|
185 |
|
|
186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
187 |
|
|
180 | 188 |
public void onDrawFrame(GL10 glUnused) |
181 | 189 |
{ |
182 | 190 |
mPaint.setColor(0xffffffff); |
src/main/res/layout/fbolayout.xml | ||
---|---|---|
15 | 15 |
android:layout_width="fill_parent" |
16 | 16 |
android:layout_height="wrap_content" |
17 | 17 |
android:gravity="center|fill_horizontal" |
18 |
android:orientation="vertical" >
|
|
18 |
android:orientation="vertical"> |
|
19 | 19 |
|
20 | 20 |
<RadioGroup |
21 | 21 |
android:id="@+id/radioGroup1" |
22 | 22 |
android:layout_width="match_parent" |
23 | 23 |
android:layout_height="wrap_content" |
24 |
android:orientation="horizontal" >
|
|
25 |
|
|
24 |
android:orientation="horizontal"> |
|
25 |
|
|
26 | 26 |
<RadioButton |
27 | 27 |
android:id="@+id/deformDistortButton" |
28 | 28 |
android:layout_width="wrap_content" |
29 | 29 |
android:layout_height="wrap_content" |
30 | 30 |
android:checked="true" |
31 | 31 |
android:onClick="DepthYes" |
32 |
android:text="@string/DepthYes" />
|
|
32 |
android:text="@string/DepthYes"/> |
|
33 | 33 |
|
34 | 34 |
<RadioButton |
35 | 35 |
android:id="@+id/deformDeformButton" |
36 | 36 |
android:layout_width="wrap_content" |
37 | 37 |
android:layout_height="wrap_content" |
38 | 38 |
android:onClick="DepthNo" |
39 |
android:text="@string/DepthNo" />
|
|
39 |
android:text="@string/DepthNo"/> |
|
40 | 40 |
|
41 | 41 |
</RadioGroup> |
42 | 42 |
|
src/main/res/layout/multiblurlayout.xml | ||
---|---|---|
82 | 82 |
android:onClick="onClick" |
83 | 83 |
android:layout_weight="1" |
84 | 84 |
android:checked="false"/> |
85 |
<CheckBox |
|
86 |
android:layout_width="wrap_content" |
|
87 |
android:layout_height="match_parent" |
|
88 |
android:id="@+id/multiblurCheckBox4" |
|
89 |
android:onClick="onClick" |
|
90 |
android:layout_weight="1" |
|
91 |
android:checked="false"/> |
|
92 |
<CheckBox |
|
93 |
android:layout_width="wrap_content" |
|
94 |
android:layout_height="match_parent" |
|
95 |
android:id="@+id/multiblurCheckBox5" |
|
96 |
android:onClick="onClick" |
|
97 |
android:layout_weight="1" |
|
98 |
android:checked="false"/> |
|
99 |
<CheckBox |
|
100 |
android:layout_width="wrap_content" |
|
101 |
android:layout_height="match_parent" |
|
102 |
android:id="@+id/multiblurCheckBox6" |
|
103 |
android:onClick="onClick" |
|
104 |
android:layout_weight="1" |
|
105 |
android:checked="false"/> |
|
106 |
<CheckBox |
|
107 |
android:layout_width="wrap_content" |
|
108 |
android:layout_height="match_parent" |
|
109 |
android:id="@+id/multiblurCheckBox7" |
|
110 |
android:onClick="onClick" |
|
111 |
android:layout_weight="1" |
|
112 |
android:checked="false"/> |
|
85 |
<CheckBox |
|
86 |
android:layout_width="wrap_content" |
|
87 |
android:layout_height="match_parent" |
|
88 |
android:id="@+id/multiblurCheckBox4" |
|
89 |
android:onClick="onClick" |
|
90 |
android:layout_weight="1" |
|
91 |
android:checked="false"/> |
|
92 |
<CheckBox |
|
93 |
android:layout_width="wrap_content" |
|
94 |
android:layout_height="match_parent" |
|
95 |
android:id="@+id/multiblurCheckBox5" |
|
96 |
android:onClick="onClick" |
|
97 |
android:layout_weight="1" |
|
98 |
android:checked="false"/> |
|
99 |
<CheckBox |
|
100 |
android:layout_width="wrap_content" |
|
101 |
android:layout_height="match_parent" |
|
102 |
android:id="@+id/multiblurCheckBox6" |
|
103 |
android:onClick="onClick" |
|
104 |
android:layout_weight="1" |
|
105 |
android:checked="false"/> |
|
106 |
<CheckBox |
|
107 |
android:layout_width="wrap_content" |
|
108 |
android:layout_height="match_parent" |
|
109 |
android:id="@+id/multiblurCheckBox7" |
|
110 |
android:onClick="onClick" |
|
111 |
android:layout_weight="1" |
|
112 |
android:checked="false"/> |
|
113 |
|
|
113 | 114 |
</LinearLayout> |
114 | 115 |
|
115 | 116 |
</LinearLayout> |
116 | 117 |
|
118 |
<LinearLayout |
|
119 |
android:id="@+id/linearLayout3" |
|
120 |
android:layout_width="fill_parent" |
|
121 |
android:layout_height="wrap_content" |
|
122 |
android:gravity="center|fill_horizontal" |
|
123 |
android:orientation="horizontal" |
|
124 |
android:background="@color/blue" |
|
125 |
android:paddingBottom="10dp" |
|
126 |
android:paddingTop="10dp" > |
|
127 |
|
|
128 |
<RadioGroup |
|
129 |
android:id="@+id/multiblurRadioGroup" |
|
130 |
android:layout_width="match_parent" |
|
131 |
android:layout_height="wrap_content" |
|
132 |
android:orientation="horizontal"> |
|
133 |
|
|
134 |
<RadioButton |
|
135 |
android:id="@+id/multiblurRadioQuality0" |
|
136 |
android:layout_width="match_parent" |
|
137 |
android:layout_height="wrap_content" |
|
138 |
android:layout_weight="1" |
|
139 |
android:checked="true" |
|
140 |
android:onClick="quality0" |
|
141 |
android:text="@string/quality0"/> |
|
142 |
|
|
143 |
<RadioButton |
|
144 |
android:id="@+id/multiblurRadioQuality1" |
|
145 |
android:layout_width="match_parent" |
|
146 |
android:layout_height="wrap_content" |
|
147 |
android:layout_weight="1" |
|
148 |
android:onClick="quality1" |
|
149 |
android:text="@string/quality1"/> |
|
150 |
|
|
151 |
<RadioButton |
|
152 |
android:id="@+id/multiblurRadioQuality2" |
|
153 |
android:layout_width="match_parent" |
|
154 |
android:layout_height="wrap_content" |
|
155 |
android:layout_weight="1" |
|
156 |
android:onClick="quality2" |
|
157 |
android:text="@string/quality2"/> |
|
158 |
|
|
159 |
<RadioButton |
|
160 |
android:id="@+id/multiblurRadioQuality3" |
|
161 |
android:layout_width="match_parent" |
|
162 |
android:layout_height="wrap_content" |
|
163 |
android:layout_weight="1" |
|
164 |
android:onClick="quality3" |
|
165 |
android:text="@string/quality3"/> |
|
166 |
|
|
167 |
</RadioGroup> |
|
168 |
|
|
169 |
</LinearLayout> |
|
170 |
|
|
117 | 171 |
</LinearLayout> |
src/main/res/values/strings.xml | ||
---|---|---|
61 | 61 |
<string name="DepthYes">Depth</string> |
62 | 62 |
<string name="DepthNo">No Depth</string> |
63 | 63 |
<string name="mesh">Mesh</string> |
64 |
<string name="quality0">Highest</string> |
|
65 |
<string name="quality1">High</string> |
|
66 |
<string name="quality2">Medium</string> |
|
67 |
<string name="quality3">Low</string> |
|
64 | 68 |
|
65 | 69 |
<string name="radius_placeholder">Radius: %1$s</string> |
66 | 70 |
<string name="noise_placeholder">Noise %1$s</string> |
Also available in: Unified diff
Mipmap levels!