Problem with extract SurfaceView to PNG file

Problems with Canvas, OpenGL, etc...

Problem with extract SurfaceView to PNG file

Postby fanmanga » Sat Apr 02, 2011 10:12 am

Look at and help me , thank :(

On thread to draw on surfaceview i added
@Override
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public void run() {
  2.             Canvas c;
  3.             while (_run) {
  4.                 c = new Canvas();
  5.                 try {
  6.                     c = _surfaceHolder.lockCanvas(null);
  7.                     synchronized (_surfaceHolder) {
  8.                         _panel.onDraw(pictureCanvas);
  9.                         c.drawBitmap(pictureBitmap,new Matrix(), null);// draw on Bitmap
  10.                     }
  11.                 } finally {
  12.                     // do this in a finally so that if an exception is thrown
  13.                     // during the above, we don't leave the Surface in an
  14.                     // inconsistent state
  15.                     if (c != null) {                    
  16.                         _surfaceHolder.unlockCanvasAndPost(c);
  17.                     }
  18.                 }
  19.             }
  20.         }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


And in onDraw() method
Syntax: [ Download ] [ Hide ]
Using javascript Syntax Highlighting
  1. @Override
  2.         public void onDraw(Canvas canvas) {
  3.                         canvas.drawColor(this.color);
  4.                         Log.i("TAG", this.color+"");
  5.                        
  6.                         if(!_graphics.isEmpty()){
  7.                                 for (Path path : _graphics) {
  8.                                         //canvas.drawPoint(graphic.x, graphic.y, mPaint);
  9.                                         //canvas.drawColor(this.color);                                
  10.                                         canvas.drawPath(path, mPaint);
  11.                                 }
  12.                         }              
  13.                 }
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


But the result :
Image

Sorry , my english is quite bad , thank in advanced
fanmanga
Once Poster
Once Poster
 
Posts: 1
Joined: Sat Apr 02, 2011 10:02 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 3 guests