Revision a935e9db
Added by Leszek Koltunski over 6 years ago
src/main/java/org/distorted/examples/multiblur/MultiblurActivity.java | ||
---|---|---|
23 | 23 |
import android.opengl.GLSurfaceView; |
24 | 24 |
import android.os.Bundle; |
25 | 25 |
import android.view.View; |
26 |
import android.widget.AdapterView; |
|
27 |
import android.widget.ArrayAdapter; |
|
26 | 28 |
import android.widget.CheckBox; |
27 | 29 |
import android.widget.SeekBar; |
30 |
import android.widget.Spinner; |
|
28 | 31 |
|
29 | 32 |
import org.distorted.examples.R; |
30 | 33 |
import org.distorted.library.main.Distorted; |
... | ... | |
32 | 35 |
|
33 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 37 |
|
35 |
public class MultiblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
|
38 |
public class MultiblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener, AdapterView.OnItemSelectedListener
|
|
36 | 39 |
{ |
37 | 40 |
private int mQuality; |
38 | 41 |
|
... | ... | |
56 | 59 |
rangeBar.setProgress(50); |
57 | 60 |
mQuality = EffectQuality.HIGHEST.ordinal(); |
58 | 61 |
} |
62 |
|
|
63 |
Spinner typeSpinner = (Spinner)findViewById(R.id.multiblur_spinnerQuality); |
|
64 |
typeSpinner.setOnItemSelectedListener(this); |
|
65 |
|
|
66 |
String[] objectType = new String[] {"Quality Highiest", "Quality High", "Quality Medium", "Quality Low"}; |
|
67 |
|
|
68 |
ArrayAdapter<String> adapterType = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType); |
|
69 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
70 |
typeSpinner.setAdapter(adapterType); |
|
71 |
|
|
72 |
Spinner bitmapSpinner = (Spinner)findViewById(R.id.multiblur_spinnerMode); |
|
73 |
bitmapSpinner.setOnItemSelectedListener(this); |
|
74 |
|
|
75 |
String[] objectBitmap = new String[] { "Render: Normal", "Render: OIT" }; |
|
76 |
|
|
77 |
ArrayAdapter<String> adapterBitmap = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectBitmap); |
|
78 |
adapterBitmap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
79 |
bitmapSpinner.setAdapter(adapterBitmap); |
|
80 |
} |
|
81 |
|
|
82 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
83 |
|
|
84 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
|
85 |
{ |
|
86 |
MultiblurSurfaceView v = this.findViewById(R.id.multiblurSurfaceView); |
|
87 |
MultiblurRenderer renderer = v.getRenderer(); |
|
88 |
|
|
89 |
switch(parent.getId()) |
|
90 |
{ |
|
91 |
case R.id.multiblur_spinnerQuality: EffectQuality quality; |
|
92 |
|
|
93 |
switch(pos) |
|
94 |
{ |
|
95 |
case 0 : quality = EffectQuality.HIGHEST; break; |
|
96 |
case 1 : quality = EffectQuality.HIGH ; break; |
|
97 |
case 2 : quality = EffectQuality.MEDIUM ; break; |
|
98 |
default: quality = EffectQuality.LOW ; |
|
99 |
} |
|
100 |
renderer.setQuality(quality); |
|
101 |
mQuality = quality.ordinal(); |
|
102 |
break; |
|
103 |
case R.id.multiblur_spinnerMode : renderer.setRenderModeToOIT(pos==1); |
|
104 |
break; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
109 |
|
|
110 |
public void onNothingSelected(AdapterView<?> parent) |
|
111 |
{ |
|
59 | 112 |
} |
60 | 113 |
|
61 | 114 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
63 | 116 |
@Override |
64 | 117 |
protected void onPause() |
65 | 118 |
{ |
66 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
119 |
GLSurfaceView view = this.findViewById(R.id.multiblurSurfaceView); |
|
67 | 120 |
view.onPause(); |
68 | 121 |
Distorted.onPause(); |
69 | 122 |
super.onPause(); |
... | ... | |
75 | 128 |
protected void onResume() |
76 | 129 |
{ |
77 | 130 |
super.onResume(); |
78 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
131 |
GLSurfaceView view = this.findViewById(R.id.multiblurSurfaceView); |
|
79 | 132 |
view.onResume(); |
80 | 133 |
} |
81 | 134 |
|
... | ... | |
95 | 148 |
{ |
96 | 149 |
super.onSaveInstanceState(savedInstanceState); |
97 | 150 |
|
98 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
151 |
MultiblurSurfaceView view = this.findViewById(R.id.multiblurSurfaceView); |
|
99 | 152 |
MultiblurRenderer renderer = view.getRenderer(); |
100 | 153 |
|
101 | 154 |
savedInstanceState.putBooleanArray("checkboxes", renderer.getChecked() ); |
... | ... | |
111 | 164 |
|
112 | 165 |
boolean[] checkboxes = savedInstanceState.getBooleanArray("checkboxes"); |
113 | 166 |
|
114 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
167 |
MultiblurSurfaceView view = this.findViewById(R.id.multiblurSurfaceView); |
|
115 | 168 |
MultiblurRenderer renderer = view.getRenderer(); |
116 | 169 |
|
117 | 170 |
if( checkboxes!=null ) |
... | ... | |
126 | 179 |
|
127 | 180 |
switch(mQuality) |
128 | 181 |
{ |
129 |
case 0 : quality0(null); break;
|
|
130 |
case 1 : quality1(null); break;
|
|
131 |
case 2 : quality2(null); break;
|
|
132 |
case 3 : quality3(null); break;
|
|
182 |
case 0 : renderer.setQuality(EffectQuality.HIGHEST); break;
|
|
183 |
case 1 : renderer.setQuality(EffectQuality.HIGH ); break;
|
|
184 |
case 2 : renderer.setQuality(EffectQuality.MEDIUM ); break;
|
|
185 |
case 3 : renderer.setQuality(EffectQuality.LOW ); break;
|
|
133 | 186 |
default: android.util.Log.e("MultiBlur", "error - unknown quality!"); |
134 | 187 |
} |
135 | 188 |
} |
... | ... | |
140 | 193 |
{ |
141 | 194 |
switch (bar.getId()) |
142 | 195 |
{ |
143 |
case R.id.multiblurDistanceSeek: MultiblurSurfaceView view1 = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
196 |
case R.id.multiblurDistanceSeek: MultiblurSurfaceView view1 = this.findViewById(R.id.multiblurSurfaceView); |
|
144 | 197 |
view1.getRenderer().setDistance(progress); |
145 | 198 |
break; |
146 |
case R.id.multiblurRangeSeek : MultiblurSurfaceView view2 = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
199 |
case R.id.multiblurRangeSeek : MultiblurSurfaceView view2 = this.findViewById(R.id.multiblurSurfaceView); |
|
147 | 200 |
view2.getRenderer().setRange(progress); |
148 | 201 |
break; |
149 | 202 |
|
... | ... | |
165 | 218 |
CheckBox box = (CheckBox)view; |
166 | 219 |
int id = box.getId(); |
167 | 220 |
boolean checked = box.isChecked(); |
168 |
MultiblurSurfaceView sView = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView);
|
|
221 |
MultiblurSurfaceView sView = this.findViewById(R.id.multiblurSurfaceView); |
|
169 | 222 |
|
170 | 223 |
switch(id) |
171 | 224 |
{ |
... | ... | |
180 | 233 |
} |
181 | 234 |
} |
182 | 235 |
|
183 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
184 |
|
|
185 |
public void quality0(View v) |
|
186 |
{ |
|
187 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
188 |
MultiblurRenderer renderer = view.getRenderer(); |
|
189 |
renderer.setQuality(EffectQuality.HIGHEST); |
|
190 |
mQuality = EffectQuality.HIGHEST.ordinal(); |
|
191 |
} |
|
192 |
|
|
193 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
194 |
|
|
195 |
public void quality1(View v) |
|
196 |
{ |
|
197 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
198 |
MultiblurRenderer renderer = view.getRenderer(); |
|
199 |
renderer.setQuality(EffectQuality.HIGH); |
|
200 |
mQuality = EffectQuality.HIGH.ordinal(); |
|
201 |
} |
|
202 |
|
|
203 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
204 |
|
|
205 |
public void quality2(View v) |
|
206 |
{ |
|
207 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
208 |
MultiblurRenderer renderer = view.getRenderer(); |
|
209 |
renderer.setQuality(EffectQuality.MEDIUM); |
|
210 |
mQuality = EffectQuality.MEDIUM.ordinal(); |
|
211 |
} |
|
212 |
|
|
213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
214 |
|
|
215 |
public void quality3(View v) |
|
216 |
{ |
|
217 |
MultiblurSurfaceView view = (MultiblurSurfaceView) this.findViewById(R.id.multiblurSurfaceView); |
|
218 |
MultiblurRenderer renderer = view.getRenderer(); |
|
219 |
renderer.setQuality(EffectQuality.LOW); |
|
220 |
mQuality = EffectQuality.LOW.ordinal(); |
|
221 |
} |
|
222 | 236 |
} |
src/main/java/org/distorted/examples/multiblur/MultiblurRenderer.java | ||
---|---|---|
147 | 147 |
mBlur.setQuality(quality); |
148 | 148 |
} |
149 | 149 |
|
150 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
151 |
|
|
152 |
void setRenderModeToOIT(boolean oit) |
|
153 |
{ |
|
154 |
mScreen.setOrderIndependentTransparency(oit); |
|
155 |
} |
|
156 |
|
|
150 | 157 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
151 | 158 |
|
152 | 159 |
public void onDrawFrame(GL10 glUnused) |
src/main/java/org/distorted/examples/transparency/TransparencyActivity.java | ||
---|---|---|
23 | 23 |
import android.opengl.GLSurfaceView; |
24 | 24 |
import android.os.Bundle; |
25 | 25 |
import android.view.View; |
26 |
import android.widget.AdapterView; |
|
27 |
import android.widget.ArrayAdapter; |
|
26 | 28 |
import android.widget.SeekBar; |
29 |
import android.widget.Spinner; |
|
27 | 30 |
|
28 | 31 |
import org.distorted.examples.R; |
29 | 32 |
import org.distorted.library.main.Distorted; |
30 | 33 |
|
31 | 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 35 |
|
33 |
public class TransparencyActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
|
36 |
public class TransparencyActivity extends Activity implements SeekBar.OnSeekBarChangeListener, AdapterView.OnItemSelectedListener
|
|
34 | 37 |
{ |
35 | 38 |
private int mRenderFirst; |
36 | 39 |
|
... | ... | |
54 | 57 |
barYellow.setProgress(50); |
55 | 58 |
privateRenderFirst(0); |
56 | 59 |
} |
60 |
|
|
61 |
Spinner typeSpinner = (Spinner)findViewById(R.id.transparency_spinnerFirst); |
|
62 |
typeSpinner.setOnItemSelectedListener(this); |
|
63 |
|
|
64 |
String[] objectType = new String[] {"First: Red", "First: Yellow"}; |
|
65 |
|
|
66 |
ArrayAdapter<String> adapterType = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType); |
|
67 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
68 |
typeSpinner.setAdapter(adapterType); |
|
69 |
|
|
70 |
Spinner bitmapSpinner = (Spinner)findViewById(R.id.transparency_spinnerMode); |
|
71 |
bitmapSpinner.setOnItemSelectedListener(this); |
|
72 |
|
|
73 |
String[] objectBitmap = new String[] { "Render: Normal", "Render: OIT" }; |
|
74 |
|
|
75 |
ArrayAdapter<String> adapterBitmap = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectBitmap); |
|
76 |
adapterBitmap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
77 |
bitmapSpinner.setAdapter(adapterBitmap); |
|
57 | 78 |
} |
58 | 79 |
|
80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
81 |
|
|
82 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
|
83 |
{ |
|
84 |
switch(parent.getId()) |
|
85 |
{ |
|
86 |
case R.id.transparency_spinnerFirst : privateRenderFirst(pos); |
|
87 |
break; |
|
88 |
case R.id.transparency_spinnerMode : setRenderModeToOIT(pos==1); |
|
89 |
break; |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
94 |
|
|
95 |
public void onNothingSelected(AdapterView<?> parent) |
|
96 |
{ |
|
97 |
} |
|
98 |
|
|
59 | 99 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
60 | 100 |
|
61 | 101 |
@Override |
... | ... | |
131 | 171 |
|
132 | 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
133 | 173 |
|
134 |
public void renderFirst(View v)
|
|
174 |
private void setRenderModeToOIT(boolean oit)
|
|
135 | 175 |
{ |
136 |
switch(v.getId()) |
|
137 |
{ |
|
138 |
case R.id.transparencyRed : privateRenderFirst(0); break; |
|
139 |
case R.id.transparencyYellow: privateRenderFirst(1); break; |
|
140 |
} |
|
176 |
TransparencySurfaceView view = (TransparencySurfaceView) this.findViewById(R.id.transparencySurfaceView); |
|
177 |
TransparencyRenderer renderer= view.getRenderer(); |
|
178 |
|
|
179 |
renderer.setRenderModeToOIT(oit); |
|
141 | 180 |
} |
142 | 181 |
|
143 | 182 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/examples/transparency/TransparencyRenderer.java | ||
---|---|---|
149 | 149 |
} |
150 | 150 |
} |
151 | 151 |
|
152 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
153 |
|
|
154 |
void setRenderModeToOIT(boolean oit) |
|
155 |
{ |
|
156 |
mScreen.setOrderIndependentTransparency(oit); |
|
157 |
} |
|
158 |
|
|
152 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
153 | 160 |
|
154 | 161 |
public void onDrawFrame(GL10 glUnused) |
src/main/java/org/distorted/examples/triblur/TriblurActivity.java | ||
---|---|---|
23 | 23 |
import android.opengl.GLSurfaceView; |
24 | 24 |
import android.os.Bundle; |
25 | 25 |
import android.view.View; |
26 |
import android.widget.AdapterView; |
|
27 |
import android.widget.ArrayAdapter; |
|
26 | 28 |
import android.widget.CheckBox; |
27 | 29 |
import android.widget.SeekBar; |
30 |
import android.widget.Spinner; |
|
28 | 31 |
|
29 | 32 |
import org.distorted.examples.R; |
30 | 33 |
import org.distorted.library.effect.EffectQuality; |
... | ... | |
32 | 35 |
|
33 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 37 |
|
35 |
public class TriblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener |
|
38 |
public class TriblurActivity extends Activity implements SeekBar.OnSeekBarChangeListener, AdapterView.OnItemSelectedListener
|
|
36 | 39 |
{ |
37 | 40 |
private int mQuality; |
38 | 41 |
private int mBackground; |
... | ... | |
45 | 48 |
super.onCreate(savedState); |
46 | 49 |
setContentView(R.layout.triblurlayout); |
47 | 50 |
|
48 |
SeekBar radiusBar0 = (SeekBar)findViewById(R.id.triblurSeek0);
|
|
49 |
SeekBar radiusBar1 = (SeekBar)findViewById(R.id.triblurSeek1);
|
|
50 |
SeekBar radiusBar2 = (SeekBar)findViewById(R.id.triblurSeek2);
|
|
51 |
SeekBar radiusBar0 = findViewById(R.id.triblurSeek0); |
|
52 |
SeekBar radiusBar1 = findViewById(R.id.triblurSeek1); |
|
53 |
SeekBar radiusBar2 = findViewById(R.id.triblurSeek2); |
|
51 | 54 |
|
52 | 55 |
radiusBar0.setOnSeekBarChangeListener(this); |
53 | 56 |
radiusBar1.setOnSeekBarChangeListener(this); |
... | ... | |
62 | 65 |
privateQuality(1); |
63 | 66 |
privateBackgroundColor(1); |
64 | 67 |
} |
68 |
|
|
69 |
Spinner typeSpinner = findViewById(R.id.triblur_spinnerQuality); |
|
70 |
typeSpinner.setOnItemSelectedListener(this); |
|
71 |
|
|
72 |
String[] objectType = new String[] {"Quality Highiest", "Quality High", "Quality Medium", "Quality Low"}; |
|
73 |
|
|
74 |
ArrayAdapter<String> adapterType = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectType); |
|
75 |
adapterType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
76 |
typeSpinner.setAdapter(adapterType); |
|
77 |
|
|
78 |
Spinner bitmapSpinner = findViewById(R.id.triblur_spinnerMode); |
|
79 |
bitmapSpinner.setOnItemSelectedListener(this); |
|
80 |
|
|
81 |
String[] objectBitmap = new String[] { "Render: Normal", "Render: OIT" }; |
|
82 |
|
|
83 |
ArrayAdapter<String> adapterBitmap = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, objectBitmap); |
|
84 |
adapterBitmap.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
|
85 |
bitmapSpinner.setAdapter(adapterBitmap); |
|
86 |
} |
|
87 |
|
|
88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
89 |
|
|
90 |
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) |
|
91 |
{ |
|
92 |
switch(parent.getId()) |
|
93 |
{ |
|
94 |
case R.id.triblur_spinnerQuality: privateQuality(pos); |
|
95 |
break; |
|
96 |
case R.id.triblur_spinnerMode : TriblurSurfaceView v = this.findViewById(R.id.triblurSurfaceView); |
|
97 |
TriblurRenderer renderer = v.getRenderer(); |
|
98 |
renderer.setRenderModeToOIT(pos==1); |
|
99 |
break; |
|
100 |
} |
|
101 |
} |
|
102 |
|
|
103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
104 |
|
|
105 |
public void onNothingSelected(AdapterView<?> parent) |
|
106 |
{ |
|
65 | 107 |
} |
66 | 108 |
|
67 | 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
69 | 111 |
@Override |
70 | 112 |
protected void onPause() |
71 | 113 |
{ |
72 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
114 |
GLSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
73 | 115 |
view.onPause(); |
74 | 116 |
Distorted.onPause(); |
75 | 117 |
super.onPause(); |
... | ... | |
81 | 123 |
protected void onResume() |
82 | 124 |
{ |
83 | 125 |
super.onResume(); |
84 |
GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
126 |
GLSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
85 | 127 |
view.onResume(); |
86 | 128 |
} |
87 | 129 |
|
... | ... | |
101 | 143 |
{ |
102 | 144 |
super.onSaveInstanceState(savedInstanceState); |
103 | 145 |
|
104 |
TriblurSurfaceView view = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
146 |
TriblurSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
105 | 147 |
TriblurRenderer renderer = view.getRenderer(); |
106 | 148 |
|
107 | 149 |
savedInstanceState.putBooleanArray("checkboxes", renderer.getChecked() ); |
... | ... | |
118 | 160 |
|
119 | 161 |
boolean[] checkboxes = savedInstanceState.getBooleanArray("checkboxes"); |
120 | 162 |
|
121 |
TriblurSurfaceView view = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
163 |
TriblurSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
122 | 164 |
TriblurRenderer renderer = view.getRenderer(); |
123 | 165 |
|
124 | 166 |
if( checkboxes!=null ) |
... | ... | |
142 | 184 |
{ |
143 | 185 |
switch (bar.getId()) |
144 | 186 |
{ |
145 |
case R.id.triblurSeek0: TriblurSurfaceView view0 = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
187 |
case R.id.triblurSeek0: TriblurSurfaceView view0 = this.findViewById(R.id.triblurSurfaceView); |
|
146 | 188 |
view0.getRenderer().setRange(0,progress); |
147 | 189 |
break; |
148 |
case R.id.triblurSeek1: TriblurSurfaceView view1 = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
190 |
case R.id.triblurSeek1: TriblurSurfaceView view1 = this.findViewById(R.id.triblurSurfaceView); |
|
149 | 191 |
view1.getRenderer().setRange(1,progress); |
150 | 192 |
break; |
151 |
case R.id.triblurSeek2: TriblurSurfaceView view2 = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
193 |
case R.id.triblurSeek2: TriblurSurfaceView view2 = this.findViewById(R.id.triblurSurfaceView); |
|
152 | 194 |
view2.getRenderer().setRange(2,progress); |
153 | 195 |
break; |
154 | 196 |
} |
... | ... | |
168 | 210 |
{ |
169 | 211 |
CheckBox box = (CheckBox)view; |
170 | 212 |
boolean checked = box.isChecked(); |
171 |
TriblurSurfaceView sView = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
213 |
TriblurSurfaceView sView = this.findViewById(R.id.triblurSurfaceView); |
|
172 | 214 |
|
173 | 215 |
switch(box.getId()) |
174 | 216 |
{ |
... | ... | |
190 | 232 |
} |
191 | 233 |
} |
192 | 234 |
|
193 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
194 |
|
|
195 |
public void quality(View v) |
|
196 |
{ |
|
197 |
switch(v.getId()) |
|
198 |
{ |
|
199 |
case R.id.triblurRadioQuality0: privateQuality(0); break; |
|
200 |
case R.id.triblurRadioQuality1: privateQuality(1); break; |
|
201 |
case R.id.triblurRadioQuality2: privateQuality(2); break; |
|
202 |
case R.id.triblurRadioQuality3: privateQuality(3); break; |
|
203 |
} |
|
204 |
} |
|
205 |
|
|
206 | 235 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
207 | 236 |
|
208 | 237 |
private void privateBackgroundColor(int index) |
209 | 238 |
{ |
210 |
TriblurSurfaceView view = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
239 |
TriblurSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
211 | 240 |
TriblurRenderer renderer = view.getRenderer(); |
212 | 241 |
|
213 | 242 |
switch(index) |
... | ... | |
222 | 251 |
|
223 | 252 |
private void privateQuality(int index) |
224 | 253 |
{ |
225 |
TriblurSurfaceView view = (TriblurSurfaceView) this.findViewById(R.id.triblurSurfaceView);
|
|
254 |
TriblurSurfaceView view = this.findViewById(R.id.triblurSurfaceView); |
|
226 | 255 |
TriblurRenderer renderer = view.getRenderer(); |
227 | 256 |
|
228 | 257 |
switch(index) |
src/main/java/org/distorted/examples/triblur/TriblurRenderer.java | ||
---|---|---|
149 | 149 |
} |
150 | 150 |
} |
151 | 151 |
|
152 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
153 |
|
|
154 |
void setRenderModeToOIT(boolean oit) |
|
155 |
{ |
|
156 |
mScreen.setOrderIndependentTransparency(oit); |
|
157 |
} |
|
158 |
|
|
152 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
153 | 160 |
|
154 | 161 |
void setBackground(float r, float g, float b, float a) |
src/main/res/layout/multiblurlayout.xml | ||
---|---|---|
10 | 10 |
android:layout_height="0dp" |
11 | 11 |
android:layout_weight="1" /> |
12 | 12 |
|
13 |
<LinearLayout |
|
14 |
android:id="@+id/linearLayout3" |
|
15 |
android:layout_width="fill_parent" |
|
16 |
android:layout_height="wrap_content" |
|
17 |
android:gravity="center|fill_horizontal" |
|
18 |
android:orientation="horizontal" |
|
19 |
android:background="@color/blue"> |
|
20 |
|
|
21 |
<Spinner |
|
22 |
android:layout_width="0dp" |
|
23 |
android:layout_height="50dp" |
|
24 |
android:layout_weight="0.5" |
|
25 |
android:id="@+id/multiblur_spinnerQuality" |
|
26 |
/> |
|
27 |
|
|
28 |
<Spinner |
|
29 |
android:layout_width="0dp" |
|
30 |
android:layout_height="50dp" |
|
31 |
android:layout_weight="0.5" |
|
32 |
android:id="@+id/multiblur_spinnerMode" |
|
33 |
/> |
|
34 |
</LinearLayout> |
|
35 |
|
|
13 | 36 |
<LinearLayout |
14 | 37 |
android:id="@+id/linearLayout1" |
15 | 38 |
android:layout_width="fill_parent" |
... | ... | |
115 | 138 |
|
116 | 139 |
</LinearLayout> |
117 | 140 |
|
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 |
android:textSize="14sp"/> |
|
143 |
|
|
144 |
<RadioButton |
|
145 |
android:id="@+id/multiblurRadioQuality1" |
|
146 |
android:layout_width="match_parent" |
|
147 |
android:layout_height="wrap_content" |
|
148 |
android:layout_weight="1" |
|
149 |
android:onClick="quality1" |
|
150 |
android:text="@string/quality1" |
|
151 |
android:textSize="14sp"/> |
|
152 |
|
|
153 |
<RadioButton |
|
154 |
android:id="@+id/multiblurRadioQuality2" |
|
155 |
android:layout_width="match_parent" |
|
156 |
android:layout_height="wrap_content" |
|
157 |
android:layout_weight="1" |
|
158 |
android:onClick="quality2" |
|
159 |
android:text="@string/quality2" |
|
160 |
android:textSize="14sp"/> |
|
161 |
|
|
162 |
<RadioButton |
|
163 |
android:id="@+id/multiblurRadioQuality3" |
|
164 |
android:layout_width="match_parent" |
|
165 |
android:layout_height="wrap_content" |
|
166 |
android:layout_weight="1" |
|
167 |
android:onClick="quality3" |
|
168 |
android:text="@string/quality3" |
|
169 |
android:textSize="14sp"/> |
|
170 |
|
|
171 |
</RadioGroup> |
|
172 |
|
|
173 |
</LinearLayout> |
|
174 |
|
|
175 | 141 |
</LinearLayout> |
src/main/res/layout/transparencylayout.xml | ||
---|---|---|
11 | 11 |
android:layout_weight="1" /> |
12 | 12 |
|
13 | 13 |
<LinearLayout |
14 |
android:id="@+id/linearLayout1" |
|
15 |
android:layout_width="fill_parent" |
|
16 |
android:layout_height="100dp" |
|
17 |
android:orientation="horizontal"> |
|
18 |
|
|
19 |
<LinearLayout |
|
20 |
android:id="@+id/linearLayout2" |
|
21 |
android:layout_width="wrap_content" |
|
22 |
android:layout_height="fill_parent" |
|
23 |
android:orientation="vertical" |
|
24 |
android:layout_weight="0.1"> |
|
25 |
|
|
26 |
<RadioGroup |
|
27 |
android:id="@+id/transparencyRadioGroup" |
|
28 |
android:layout_width="fill_parent" |
|
29 |
android:layout_height="fill_parent" |
|
30 |
android:orientation="vertical"> |
|
31 |
|
|
32 |
<RadioButton |
|
33 |
android:id="@+id/transparencyRed" |
|
34 |
android:layout_width="fill_parent" |
|
35 |
android:layout_height="wrap_content" |
|
36 |
android:layout_weight="1" |
|
37 |
android:background="@color/red" |
|
38 |
android:onClick="renderFirst" |
|
39 |
android:checked="true" |
|
40 |
android:textSize="14sp"/> |
|
41 |
|
|
42 |
<RadioButton |
|
43 |
android:id="@+id/transparencyYellow" |
|
44 |
android:layout_width="fill_parent" |
|
45 |
android:layout_height="wrap_content" |
|
46 |
android:layout_weight="1" |
|
47 |
android:background="@color/yellow" |
|
48 |
android:onClick="renderFirst" |
|
49 |
android:textSize="14sp"/> |
|
50 |
</RadioGroup> |
|
51 |
</LinearLayout> |
|
52 |
|
|
53 |
<LinearLayout |
|
54 |
android:id="@+id/linearLayout3" |
|
55 |
android:layout_width="wrap_content" |
|
56 |
android:layout_height="fill_parent" |
|
57 |
android:orientation="vertical" |
|
58 |
android:layout_weight="0.9"> |
|
14 |
android:orientation="horizontal" |
|
15 |
android:layout_width="match_parent" |
|
16 |
android:layout_height="wrap_content"> |
|
17 |
|
|
18 |
<Spinner |
|
19 |
android:layout_width="0dp" |
|
20 |
android:layout_height="50dp" |
|
21 |
android:layout_weight="0.5" |
|
22 |
android:id="@+id/transparency_spinnerFirst" |
|
23 |
/> |
|
24 |
|
|
25 |
<Spinner |
|
26 |
android:layout_width="0dp" |
|
27 |
android:layout_height="50dp" |
|
28 |
android:layout_weight="0.5" |
|
29 |
android:id="@+id/transparency_spinnerMode" |
|
30 |
/> |
|
31 |
</LinearLayout> |
|
59 | 32 |
|
60 |
<SeekBar
|
|
61 |
android:id="@+id/transparencySeekRed"
|
|
62 |
android:background="@color/red"
|
|
63 |
android:layout_height="50dp"
|
|
64 |
android:layout_width="fill_parent"
|
|
65 |
android:paddingLeft="10dp"
|
|
66 |
android:paddingRight="10dp" />
|
|
67 |
<SeekBar
|
|
68 |
android:id="@+id/transparencySeekYellow"
|
|
69 |
android:background="@color/yellow"
|
|
70 |
android:layout_height="50dp"
|
|
71 |
android:layout_width="fill_parent"
|
|
72 |
android:paddingLeft="10dp"
|
|
73 |
android:paddingRight="10dp" />
|
|
33 |
<SeekBar |
|
34 |
android:id="@+id/transparencySeekRed" |
|
35 |
android:background="@color/red" |
|
36 |
android:layout_height="50dp" |
|
37 |
android:layout_width="fill_parent" |
|
38 |
android:paddingLeft="10dp" |
|
39 |
android:paddingRight="10dp" /> |
|
40 |
<SeekBar |
|
41 |
android:id="@+id/transparencySeekYellow" |
|
42 |
android:background="@color/yellow" |
|
43 |
android:layout_height="50dp" |
|
44 |
android:layout_width="fill_parent" |
|
45 |
android:paddingLeft="10dp" |
|
46 |
android:paddingRight="10dp" /> |
|
74 | 47 |
|
75 |
</LinearLayout> |
|
76 |
</LinearLayout> |
|
77 | 48 |
</LinearLayout> |
src/main/res/layout/triblurlayout.xml | ||
---|---|---|
10 | 10 |
android:layout_height="0dp" |
11 | 11 |
android:layout_weight="1" /> |
12 | 12 |
|
13 |
|
|
14 |
<LinearLayout |
|
15 |
android:id="@+id/linearLayout3" |
|
16 |
android:layout_width="fill_parent" |
|
17 |
android:layout_height="wrap_content" |
|
18 |
android:gravity="center|fill_horizontal" |
|
19 |
android:orientation="horizontal" |
|
20 |
android:background="@color/blue"> |
|
21 |
|
|
22 |
<Spinner |
|
23 |
android:layout_width="0dp" |
|
24 |
android:layout_height="50dp" |
|
25 |
android:layout_weight="0.5" |
|
26 |
android:id="@+id/triblur_spinnerQuality" |
|
27 |
/> |
|
28 |
|
|
29 |
<Spinner |
|
30 |
android:layout_width="0dp" |
|
31 |
android:layout_height="50dp" |
|
32 |
android:layout_weight="0.5" |
|
33 |
android:id="@+id/triblur_spinnerMode" |
|
34 |
/> |
|
35 |
</LinearLayout> |
|
36 |
|
|
13 | 37 |
<LinearLayout |
14 | 38 |
android:orientation="horizontal" |
15 | 39 |
android:background="@color/red" |
... | ... | |
130 | 154 |
|
131 | 155 |
</LinearLayout> |
132 | 156 |
|
133 |
<LinearLayout |
|
134 |
android:id="@+id/linearLayout3" |
|
135 |
android:layout_width="fill_parent" |
|
136 |
android:layout_height="wrap_content" |
|
137 |
android:gravity="center|fill_horizontal" |
|
138 |
android:orientation="horizontal" |
|
139 |
android:background="@color/blue" |
|
140 |
android:paddingBottom="10dp" |
|
141 |
android:paddingTop="10dp" > |
|
142 |
|
|
143 |
<RadioGroup |
|
144 |
android:id="@+id/triblurRadioGroup" |
|
145 |
android:layout_width="match_parent" |
|
146 |
android:layout_height="wrap_content" |
|
147 |
android:orientation="horizontal"> |
|
148 |
|
|
149 |
<RadioButton |
|
150 |
android:id="@+id/triblurRadioQuality0" |
|
151 |
android:layout_width="match_parent" |
|
152 |
android:layout_height="wrap_content" |
|
153 |
android:layout_weight="1" |
|
154 |
android:onClick="quality" |
|
155 |
android:text="@string/quality0" |
|
156 |
android:textSize="14sp"/> |
|
157 |
|
|
158 |
<RadioButton |
|
159 |
android:id="@+id/triblurRadioQuality1" |
|
160 |
android:layout_width="match_parent" |
|
161 |
android:layout_height="wrap_content" |
|
162 |
android:layout_weight="1" |
|
163 |
android:checked="true" |
|
164 |
android:onClick="quality" |
|
165 |
android:text="@string/quality1" |
|
166 |
android:textSize="14sp"/> |
|
167 |
|
|
168 |
<RadioButton |
|
169 |
android:id="@+id/triblurRadioQuality2" |
|
170 |
android:layout_width="match_parent" |
|
171 |
android:layout_height="wrap_content" |
|
172 |
android:layout_weight="1" |
|
173 |
android:onClick="quality" |
|
174 |
android:text="@string/quality2" |
|
175 |
android:textSize="14sp"/> |
|
176 |
|
|
177 |
<RadioButton |
|
178 |
android:id="@+id/triblurRadioQuality3" |
|
179 |
android:layout_width="match_parent" |
|
180 |
android:layout_height="wrap_content" |
|
181 |
android:layout_weight="1" |
|
182 |
android:onClick="quality" |
|
183 |
android:text="@string/quality3" |
|
184 |
android:textSize="14sp"/> |
|
185 |
|
|
186 |
</RadioGroup> |
|
187 |
|
|
188 |
</LinearLayout> |
|
189 |
|
|
190 | 157 |
</LinearLayout> |
Also available in: Unified diff
Correct a recently introduced bug.