mirror of
https://github.com/xdsopl/robot36.git
synced 2025-12-06 07:12:07 +01:00
added save and clear image buttons
This commit is contained in:
parent
8b16b13ad2
commit
9bbca4bd6d
|
|
@ -92,7 +92,7 @@ public class Decoder {
|
|||
}
|
||||
};
|
||||
|
||||
public Decoder(MainActivity activity, SpectrumView spectrum, SpectrumView spectrogram,ImageView image, VUMeterView meter) {
|
||||
public Decoder(MainActivity activity, SpectrumView spectrum, SpectrumView spectrogram, ImageView image, VUMeterView meter) {
|
||||
this.image = image;
|
||||
this.spectrogram = spectrogram;
|
||||
this.spectrum = spectrum;
|
||||
|
|
@ -150,6 +150,7 @@ public class Decoder {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
void clear_image() { rsDecoder.invoke_reset_buffer(); }
|
||||
void toggle_scaling() { image.intScale ^= true; }
|
||||
void softer_image() { rsDecoder.invoke_incr_blur(); }
|
||||
void sharper_image() { rsDecoder.invoke_decr_blur(); }
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import java.util.Date;
|
|||
|
||||
public class MainActivity extends Activity {
|
||||
private Decoder decoder;
|
||||
private ImageView image;
|
||||
private Bitmap bitmap;
|
||||
private NotificationManager manager;
|
||||
private ShareActionProvider share;
|
||||
|
|
@ -121,10 +122,11 @@ public class MainActivity extends Activity {
|
|||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
changeLayoutOrientation(getResources().getConfiguration());
|
||||
image = (ImageView)findViewById(R.id.image);
|
||||
decoder = new Decoder(this,
|
||||
(SpectrumView)findViewById(R.id.spectrum),
|
||||
(SpectrumView)findViewById(R.id.spectrogram),
|
||||
(ImageView)findViewById(R.id.image),
|
||||
image,
|
||||
(VUMeterView)findViewById(R.id.meter)
|
||||
);
|
||||
manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
|
|
@ -180,6 +182,12 @@ public class MainActivity extends Activity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_save_image:
|
||||
storeBitmap(image.bitmap);
|
||||
return true;
|
||||
case R.id.action_clear_image:
|
||||
decoder.clear_image();
|
||||
return true;
|
||||
case R.id.action_softer_image:
|
||||
decoder.softer_image();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,18 @@
|
|||
android:title="Share"
|
||||
android:actionProviderClass="android.widget.ShareActionProvider" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_save_image"
|
||||
android:title="@string/action_save_image"
|
||||
android:icon="@android:drawable/ic_menu_save"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_clear_image"
|
||||
android:title="@string/action_clear_image"
|
||||
android:icon="@android:drawable/ic_menu_close_clear_cancel"
|
||||
android:showAsAction="ifRoom" />
|
||||
|
||||
<item android:id="@+id/action_softer_image" android:title="@string/action_softer_image"
|
||||
android:orderInCategory="100" android:showAsAction="never" />
|
||||
<item android:id="@+id/action_sharper_image" android:title="@string/action_sharper_image"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
<string name="app_name">Robot36</string>
|
||||
<string name="decoder_running">"decoder is running</string>
|
||||
<string name="action_save_image">Save Image</string>
|
||||
<string name="action_clear_image">Clear Image</string>
|
||||
<string name="action_toggle_auto">Toggle Auto Mode</string>
|
||||
<string name="action_toggle_debug">Toggle Debug Mode</string>
|
||||
<string name="action_toggle_analyzer">Toggle Analyzer</string>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ limitations under the License.
|
|||
#include "stft.rsh"
|
||||
#include "utils.rsh"
|
||||
|
||||
static void reset_buffer()
|
||||
void reset_buffer()
|
||||
{
|
||||
vpos = 0;
|
||||
hpos = 0;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void initialize(float rate, int length, int iw, int ih, int sw, int sh, int sgw,
|
|||
maximum_height = ih;
|
||||
|
||||
for (int i = 0; i < iw * ih; ++i)
|
||||
pixel_buffer[i] = 0;
|
||||
pixel_buffer[i] = rgb(0, 0, 0);
|
||||
|
||||
init_analyzer(sw, sh, sgw, sgh);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue