Commit 3a6bb33e authored by Thomas Krex's avatar Thomas Krex
Browse files

paint funktioniert, aber langsam

parent 33a8627e
......@@ -5,6 +5,7 @@ import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
......@@ -13,6 +14,7 @@ public class MySurfaceView extends SurfaceView implements
private final SurfaceHolder sh;
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
Canvas canvas;
public MySurfaceView(Context context) {
super(context);
......@@ -44,8 +46,10 @@ public class MySurfaceView extends SurfaceView implements
}
public void drawRec() {
Canvas canvas = sh.lockCanvas();
public void drawRec(int x, int y, int w, int h, Paint p) {
canvas = sh.lockCanvas();
canvas.drawRect(new Rect(x, y, x + w, y + h), p);
sh.unlockCanvasAndPost(canvas);
}
......
......@@ -34,7 +34,6 @@ public class PlayerActivity extends Activity {
fileName = getIntent().getStringExtra(DownloadService.FILE_NAME);
filePath = getIntent().getStringExtra(DownloadService.FILE_PATH);
GraphicsContext graphicsContext = new GraphicsContext(imgV);
File file = new File(filePath + "/" + fileName + ".ttt");
playButton = (Button) findViewById(R.id.play_btn);
stopButton = (Button) findViewById(R.id.stop_btn);
......@@ -52,33 +51,16 @@ public class PlayerActivity extends Activity {
@Override
public void onClick(View v) {
recording.stop();
;
recording.pause();
}
});
// bitmap = Bitmap.createBitmap(1280, 768, Config.ARGB_8888);
// final int[] pixels = new int[1280 * 768];
// for (int i = 10 * 1280; i < 11 * 1280; i++) {
// pixels[i] = Color.BLUE;
//
// }
// imgV.setImageBitmap(bitmap);
//
// Thread t = new Thread(new Runnable() {
//
// @Override
// public void run() {
// handleUpdatedPixels(pixels, 0, 10, 1280, 1);
//
// }
// });
// t.start();
try {
recording = new Recording(file, graphicsContext);
recording = new Recording(file);
GraphicsContext graphicsContext = new GraphicsContext(imgV,
recording);
} catch (IOException e) {
// TODO Auto-generated catch block
......@@ -86,12 +68,4 @@ public class PlayerActivity extends Activity {
}
}
public void handleUpdatedPixels(int[] pixels, int x, int y, int w, int h) {
// System.out.println("handleUpdatedPixels("+x+","+y+","+w+","+h+")");
// drawingScreen.updateBitmap(pixels,prefs.framebufferWidth,
// prefs.framebufferHeight);
bitmap.setPixels(pixels, x + y * 1280, 1280, x, y, w, h);
imgV.setImageBitmap(bitmap);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment