240 likes | 489 Views
Outline. ??SampleViewSocketCamSurfaceView. ??. ???????????? canvas ??????,???? canvas ???,??????????????????????? View ? invalidate() ,? Android ???????? ? View.invalidate()?????,Android framework ??? View ? onDraw(),??????????????. SurfaceView (1/2). SurfaceView ?? View,????? buffer,?? s
E N D
1. Socket Cam Kimble Hsu
kimble@mail.vnu.edu.tw
2. Outline ??
SampleView
SocketCam
SurfaceView
3. ?? ?????????
??? canvas ??????,???? canvas ???,??????????????
????????? View ? invalidate() ,? Android ????????
? View.invalidate()?????,Android framework ??? View ? onDraw(),??????????????
4. SurfaceView (1/2) SurfaceView ?? View,????? buffer,?? surface?
???? buffer ???? Android framework ?????,????????????,????????
????????,??? Android framework ???,????? hardware ??????????????
????????, ?? SurfaceView?
?? SurfaceView ?,canvas ????? onDraw() ????
5. SurfaceView (2/2) ???? SurfaceView.getHolder() ?? surface holder ,? SurfaceHolder.lockCanvas() ??????????,???? SurfaceHolder.unlockCanvasAndPost() ,??????????
SurfaceHolder.lockCanvas() ????????,?????????????????,????????,?????????,?????????
6. SampleView Canvas Class (??)
Layout
Layout?main.xml??
???SimpleView
SampleView
Inner class
Override onDraw()
7. Canvas
8. SampleView
9. Show Bitmap
10. SocketCam Drawing 2D graphics
Socket Connection
Get Input Steam
Render to Canvas
Exception Handler
Webcam Client (Android)
Webcam Server (PC)
Testing
11. Drawing 2D graphics Draw your graphics or animations into a View object from your layout. the drawing of your graphics is handled by the system's normal View hierarchy drawing process.
Draw your graphics directly to a Canvas. To call the appropriate class's draw() method (passing it your Canvas), or one of the Canvas draw...() methods (like drawPicture()). In doing so, you are also in control of any animation.
12. Socket Connection HttpCamera
SockCamera
13. Interface CameraSource
14. SocketCamera
15. Override Methods
16. SocketConnection
17. Exception Handler
18. Webcam Client (Android)
19. Uses permission
20. Webcam Server (PC) Download webcam2000
http://www.webcam2000.info/
Unzip and run WebCam2000.exe
21. Testing Open Webcam2000
Run Webcam Client (Andriod)
22. Surface View (1/2) Create a new class
Override sufaceCreate
23. Surface View (2/2) Create MyThread for capture continuing
24. Reference Android API Demo, BitmapDecode.java
WebCam2000, http://www.webcam2000.info/
Live Camera Previews in Android, http://www.tomgibara.com/android/camera-source
Surface View
http://heaven.branda.to/~thinker/GinGin_CGI.py/show_id_doc/404