Revision 4348b52e
Added by Leszek Koltunski about 9 years ago
| src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java | ||
|---|---|---|
| 80 | 80 |
String[] itemsName = new String[] { getText(R.string.distort ).toString(),
|
| 81 | 81 |
getText(R.string.sink ).toString(), |
| 82 | 82 |
getText(R.string.alpha ).toString(), |
| 83 |
getText(R.string.macroblock).toString(),
|
|
| 83 |
getText(R.string.brightness).toString(),
|
|
| 84 | 84 |
getText(R.string.chroma ).toString()}; |
| 85 | 85 |
|
| 86 | 86 |
String[] itemsType = new String[] {"VERTEX", "FRAGMENT"};
|
| src/main/java/org/distorted/examples/movingeffects/MovingEffectsActivity.java | ||
|---|---|---|
| 37 | 37 |
private static final int COLOR_UNPRESSED = 0x888888ff; |
| 38 | 38 |
private static final String SHOWED_TOAST = "showed_toast"; |
| 39 | 39 |
|
| 40 |
Button mAbort, mMacro, mTrans, mSink, mBubble, mSwirl;
|
|
| 40 |
Button mAbort, mChroma, mTrans, mSink, mBubble, mSwirl;
|
|
| 41 | 41 |
|
| 42 | 42 |
/////////////////////////////////////////////////////////////////// |
| 43 | 43 |
@Override |
| ... | ... | |
| 48 | 48 |
setContentView(R.layout.movingeffectslayout); |
| 49 | 49 |
|
| 50 | 50 |
mAbort = (Button)findViewById(R.id.movingeffectsAbort); |
| 51 |
mMacro = (Button)findViewById(R.id.movingeffectsMacro);
|
|
| 51 |
mChroma= (Button)findViewById(R.id.movingeffectsChroma);
|
|
| 52 | 52 |
mTrans = (Button)findViewById(R.id.movingeffectsTrans); |
| 53 | 53 |
mSink = (Button)findViewById(R.id.movingeffectsSink); |
| 54 | 54 |
mBubble= (Button)findViewById(R.id.movingeffectsBubble); |
| 55 | 55 |
mSwirl= (Button)findViewById(R.id.movingeffectsSwirl); |
| 56 | 56 |
|
| 57 | 57 |
mAbort.setBackgroundColor(COLOR_PRESSED); |
| 58 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 58 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 59 | 59 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 60 | 60 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 61 | 61 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| ... | ... | |
| 119 | 119 |
MovingEffectsSurfaceView.Bubble(); |
| 120 | 120 |
|
| 121 | 121 |
mAbort.setBackgroundColor(COLOR_UNPRESSED); |
| 122 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 122 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 123 | 123 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 124 | 124 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 125 | 125 |
mBubble.setBackgroundColor(COLOR_PRESSED); |
| ... | ... | |
| 133 | 133 |
MovingEffectsSurfaceView.Sink(); |
| 134 | 134 |
|
| 135 | 135 |
mAbort.setBackgroundColor(COLOR_UNPRESSED); |
| 136 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 136 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 137 | 137 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 138 | 138 |
mSink.setBackgroundColor(COLOR_PRESSED); |
| 139 | 139 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| ... | ... | |
| 147 | 147 |
MovingEffectsSurfaceView.Transparency(); |
| 148 | 148 |
|
| 149 | 149 |
mAbort.setBackgroundColor(COLOR_UNPRESSED); |
| 150 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 150 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 151 | 151 |
mTrans.setBackgroundColor(COLOR_PRESSED); |
| 152 | 152 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 153 | 153 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| ... | ... | |
| 156 | 156 |
|
| 157 | 157 |
/////////////////////////////////////////////////////////////////// |
| 158 | 158 |
|
| 159 |
public void Macroblock(View v)
|
|
| 159 |
public void Chroma(View v)
|
|
| 160 | 160 |
{
|
| 161 |
MovingEffectsSurfaceView.Macroblock();
|
|
| 161 |
MovingEffectsSurfaceView.Chroma();
|
|
| 162 | 162 |
|
| 163 | 163 |
mAbort.setBackgroundColor(COLOR_UNPRESSED); |
| 164 |
mMacro.setBackgroundColor(COLOR_PRESSED);
|
|
| 164 |
mChroma.setBackgroundColor(COLOR_PRESSED);
|
|
| 165 | 165 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 166 | 166 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 167 | 167 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| ... | ... | |
| 175 | 175 |
MovingEffectsSurfaceView.Swirl(); |
| 176 | 176 |
|
| 177 | 177 |
mAbort.setBackgroundColor(COLOR_UNPRESSED); |
| 178 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 178 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 179 | 179 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 180 | 180 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 181 | 181 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| ... | ... | |
| 189 | 189 |
MovingEffectsSurfaceView.Abort(); |
| 190 | 190 |
|
| 191 | 191 |
mAbort.setBackgroundColor(COLOR_PRESSED); |
| 192 |
mMacro.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 192 |
mChroma.setBackgroundColor(COLOR_UNPRESSED);
|
|
| 193 | 193 |
mTrans.setBackgroundColor(COLOR_UNPRESSED); |
| 194 | 194 |
mSink.setBackgroundColor(COLOR_UNPRESSED); |
| 195 | 195 |
mBubble.setBackgroundColor(COLOR_UNPRESSED); |
| src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
|---|---|---|
| 49 | 49 |
public static final int EFFECT_BUBBLE=1; |
| 50 | 50 |
public static final int EFFECT_SINK =2; |
| 51 | 51 |
public static final int EFFECT_TRANS =3; |
| 52 |
public static final int EFFECT_MACRO =4;
|
|
| 52 |
public static final int EFFECT_CHROMA=4;
|
|
| 53 | 53 |
public static final int EFFECT_SWIRL =5; |
| 54 | 54 |
|
| 55 | 55 |
private static MovingEffectsRenderer mRenderer; |
| ... | ... | |
| 147 | 147 |
|
| 148 | 148 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 149 | 149 |
|
| 150 |
public static void Macroblock()
|
|
| 150 |
public static void Chroma()
|
|
| 151 | 151 |
{
|
| 152 |
if( mCurrEffect==EFFECT_MACRO ) return;
|
|
| 152 |
if( mCurrEffect==EFFECT_CHROMA ) return;
|
|
| 153 | 153 |
|
| 154 | 154 |
synchronized(lock) |
| 155 | 155 |
{
|
| 156 | 156 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.VERTEX); |
| 157 | 157 |
MovingEffectsRenderer.mBackground.abortEffects(EffectTypes.FRAGMENT); |
| 158 |
MovingEffectsRenderer.mBackground.macroblock(new Static1D(3), mRegion);
|
|
| 159 |
mCurrEffect = EFFECT_MACRO;
|
|
| 158 |
MovingEffectsRenderer.mBackground.chroma(new Static1D(0.5f), new Static3D(1,0,0), mRegion, true);
|
|
| 159 |
mCurrEffect = EFFECT_CHROMA;
|
|
| 160 | 160 |
} |
| 161 | 161 |
} |
| 162 | 162 |
|
| src/main/res/layout/movingeffectslayout.xml | ||
|---|---|---|
| 67 | 67 |
android:text="@string/alpha" /> |
| 68 | 68 |
|
| 69 | 69 |
<Button |
| 70 |
android:id="@+id/movingeffectsMacro"
|
|
| 70 |
android:id="@+id/movingeffectsChroma"
|
|
| 71 | 71 |
android:layout_width="wrap_content" |
| 72 | 72 |
android:layout_height="wrap_content" |
| 73 | 73 |
android:layout_marginLeft="2dp" |
| 74 | 74 |
android:layout_marginRight="2dp" |
| 75 | 75 |
android:layout_weight="0.17" |
| 76 |
android:onClick="Macroblock"
|
|
| 76 |
android:onClick="Chroma"
|
|
| 77 | 77 |
android:paddingLeft="5dp" |
| 78 | 78 |
android:paddingRight="5dp" |
| 79 |
android:text="@string/macroblock" />
|
|
| 79 |
android:text="@string/chroma" />
|
|
| 80 | 80 |
|
| 81 | 81 |
<Button |
| 82 | 82 |
android:id="@+id/movingeffectsAbort" |
| src/main/res/values/strings.xml | ||
|---|---|---|
| 8 | 8 |
<string name="shear">Shear</string> |
| 9 | 9 |
<string name="sink">Sink</string> |
| 10 | 10 |
<string name="alpha">Alpha</string> |
| 11 |
<string name="macroblock">Macro</string> |
|
| 12 | 11 |
<string name="chroma">Chroma</string> |
| 13 | 12 |
<string name="brightness">Brightness</string> |
| 14 | 13 |
<string name="saturation">Saturation</string> |
Also available in: Unified diff
Fix the 'Moving Effects' app