1 |
edafb4a7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2016 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.examples.fragment3d;
|
21 |
|
|
|
22 |
|
|
import android.widget.LinearLayout;
|
23 |
|
|
import android.widget.SeekBar;
|
24 |
|
|
import android.widget.TextView;
|
25 |
|
|
|
26 |
|
|
import org.distorted.library.DistortedBitmap;
|
27 |
|
|
import org.distorted.library.EffectNames;
|
28 |
|
|
|
29 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
30 |
|
|
|
31 |
|
|
public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
|
32 |
|
|
|
33 |
|
|
{
|
34 |
|
|
private static Fragment3DActivity activity;
|
35 |
|
|
|
36 |
|
|
private EffectNames name;
|
37 |
|
|
private float inter1, inter2, inter3, inter4;
|
38 |
|
|
private float regX, regY, regRX, regRY;
|
39 |
|
|
|
40 |
|
|
private TextView textEffect, textCenter;
|
41 |
|
|
private SeekBar[] mSpinRegion;
|
42 |
|
|
private SeekBar[] mSpinInter;
|
43 |
|
|
|
44 |
|
|
private DistortedBitmap mRegion;
|
45 |
|
|
|
46 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
47 |
|
|
|
48 |
|
|
public static void setActivity(Fragment3DActivity act)
|
49 |
|
|
{
|
50 |
|
|
activity = act;
|
51 |
|
|
}
|
52 |
|
|
|
53 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
54 |
|
|
|
55 |
|
|
public Fragment3DEffect(EffectNames name)
|
56 |
|
|
{
|
57 |
|
|
this.name = name;
|
58 |
|
|
mSpinInter = new SeekBar[name.getDimension()];
|
59 |
|
|
mSpinRegion= new SeekBar[4];
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
63 |
|
|
|
64 |
|
|
public void addView(LinearLayout layout)
|
65 |
|
|
{
|
66 |
|
|
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
70 |
|
|
|
71 |
|
|
private void setBar(int id, int value)
|
72 |
|
|
{
|
73 |
|
|
SeekBar bar = (SeekBar)activity.findViewById(id);
|
74 |
|
|
bar.setOnSeekBarChangeListener(this);
|
75 |
|
|
bar.setProgress(value);
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
79 |
|
|
|
80 |
|
|
public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
|
81 |
|
|
{
|
82 |
|
|
switch (bar.getId())
|
83 |
|
|
{
|
84 |
|
|
// TODO
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89 |
|
|
|
90 |
|
|
public void onStartTrackingTouch(SeekBar bar) { }
|
91 |
|
|
|
92 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
93 |
|
|
|
94 |
|
|
public void onStopTrackingTouch(SeekBar bar) { }
|
95 |
|
|
}
|