1.android videoviewåsurfaceviewçåºå«
android videoviewåsurfaceviewçåºå«
å¨Android游æå½ä¸å å½ä¸»è¦çé¤äºæ§å¶ç±»å¤å°±æ¯æ¾ç¤ºç±»ï¼å¨J2MEä¸æ们ç¨DisplayåCanvasæ¥å®ç°è¿äºï¼èGoogle Androidä¸æ¶åå°æ¾ç¤ºç为viewç±»ï¼Android游æå¼åä¸æ¯è¾éè¦åå¤æçå°±æ¯æ¾ç¤ºå游æé»è¾çå¤çã
è¿é说ä¸android.view.Viewåandroid.view.SurfaceViewãSurfaceViewæ¯ä»Viewåºç±»ä¸æ´¾çåºæ¥çæ¾ç¤ºç±»ï¼ç´æ¥åç±»æGLSurfaceViewåVideoViewï¼å¯ä»¥çåºGLåè§é¢ææ¾ä»¥åCameraæå头ä¸è¬å使ç¨SurfaceViewï¼å°åºæåªäºä¼å¿å¢?码解netconf源码及编译 SurfaceViewå¯ä»¥æ§å¶è¡¨é¢çæ ¼å¼ï¼æ¯å¦å¤§å°ï¼æ¾ç¤ºå¨å±å¹ä¸çä½ç½®ï¼æå ³é®æ¯çæä¾äºSurfaceHolderç±»ï¼ä½¿ç¨getHolderæ¹æ³è·åï¼ç¸å ³çæCanvas lockCanvas()
Canvas lockCanvas(Rect dirty) ãvoid removeCallback(SurfaceHolder.Callback callback)ãvoid unlockCanvasAndPost(Canvas canvas) æ§å¶å¾å½¢ä»¥åç»å¶ï¼èå¨SurfaceHolder.Callback æ¥å£åè°ä¸å¯ä»¥éè¿éåä¸é¢æ¹æ³å®ç°ã
使ç¨çSurfaceViewçæ¶åï¼ä¸è¬æ åµä¸è¦å¯¹å ¶è¿è¡å建ï¼éæ¯ï¼æ¹åæ¶çæ åµè¿è¡çè§ï¼è¿å°±è¦ç¨å° SurfaceHolder.Callback.
class XxxView extends SurfaceView implements SurfaceHolder.Callback {
public void surfaceChanged(SurfaceHolder holder,int format,int width,int height){ }
//çå ¶åç¥å ¶ä¹ï¼å¨surfaceç大å°åçæ¹åæ¶æ¿å
public void surfaceCreated(SurfaceHolder holder){ }
//åä¸ï¼å¨å建æ¶æ¿åï¼ä¸è¬å¨è¿éè°ç¨ç»å¾ç线ç¨ã
public void surfaceDestroyed(SurfaceHolder holder) { }
//åä¸ï¼éæ¯æ¶æ¿åï¼ä¸è¬å¨è¿éå°ç»å¾ç线ç¨åæ¢ãéæ¾ã
}
对äºSurfaceç¸å ³çï¼Androidåºå±è¿æä¾äºGPUå éåè½ï¼æ以ä¸è¬å®æ¶æ§å¾å¼ºçåºç¨ä¸ä¸»è¦ä½¿ç¨SurfaceViewèä¸æ¯ç´æ¥ä»Viewæ建ï¼åæ¶åæ¥åandroid 3d OpenGLä¸çGLSurfaceViewä¹æ¯ä»è¯¥ç±»å®ç°ã
SurfaceViewåViewææ¬è´¨çåºå«å¨äºï¼surfaceViewæ¯å¨ä¸ä¸ªæ°èµ·çåç¬çº¿ç¨ä¸å¯ä»¥éæ°ç»å¶ç»é¢èViewå¿ é¡»å¨UIç主线ç¨ä¸æ´æ°ç»é¢ã
é£ä¹å¨UIç主线ç¨ä¸æ´æ°ç»é¢ å¯è½ä¼å¼åé®é¢ï¼æ¯å¦ä½ æ´æ°ç»é¢çæ¶é´è¿é¿ï¼é£ä¹ä½ ç主UI线ç¨ä¼è¢«ä½ æ£å¨ç»çå½æ°é»å¡ãé£ä¹å°æ æ³ååºæé®ï¼è§¦å±çæ¶æ¯ã
å½ä½¿ç¨surfaceView ç±äºæ¯å¨æ°ç线ç¨ä¸æ´æ°ç»é¢æ以ä¸ä¼é»å¡ä½ çUI主线ç¨ãä½è¿ä¹å¸¦æ¥äºå¦å¤ä¸ä¸ªé®é¢ï¼å°±æ¯äºä»¶åæ¥ãæ¯å¦ä½ 触å±äºä¸ä¸ï¼ä½ éè¦surfaceViewä¸threadå¤çï¼ä¸è¬å°±éè¦æä¸ä¸ªevent queueç设计æ¥ä¿åtouch eventï¼è¿ä¼ç¨ç¨å¤æä¸ç¹ï¼å 为æ¶åå°çº¿ç¨åæ¥ã
æ以åºäºä»¥ä¸ï¼æ ¹æ®æ¸¸æç¹ç¹ï¼ä¸è¬åæ两类ã
1 被å¨æ´æ°ç»é¢çãæ¯å¦æ£ç±»ï¼è¿ç§ç¨view就好äºãå 为ç»é¢çæ´æ°æ¯ä¾èµäº onTouch æ¥æ´æ°ï¼å¯ä»¥ç´æ¥ä½¿ç¨ invalidateã å 为è¿ç§æ åµä¸ï¼è¿ä¸æ¬¡Touchåä¸ä¸æ¬¡çTouchéè¦çæ¶é´æ¯è¾é¿äºï¼ä¸ä¼äº§çå½±åã
2 主å¨æ´æ°ãæ¯å¦ä¸ä¸ªäººå¨ä¸ç´è·å¨ãè¿å°±éè¦ä¸ä¸ªåç¬çthreadä¸åçéç»äººçç¶æï¼é¿å é»å¡main UI threadãæ以æ¾ç¶viewä¸åéï¼éè¦surfaceViewæ¥æ§å¶ã
3.Androidä¸çSurfaceView类就æ¯åç¼å²æºå¶ãå æ¤ï¼å¼å游ææ¶å°½é使ç¨SurfaceViewèä¸è¦ä½¿ç¨Viewï¼è¿æ ·çè¯æçè¾é«ï¼èä¸SurfaceViewçåè½ä¹æ´å å®åã
èè以ä¸å ç¹ï¼æ以æä¸ç´é½éç¨ SurfaceView æ¥è¿è¡æ¸¸æå¼åã
é£ä¹å¨ä»¥åæºç å®ä¾ä¸ï¼é½ä¼ä»¥ç»§æ¿sarfaceViewæ¡æ¶æ¥è¿è¡æ¼ç¤ºã
2024-11-28 18:51619人浏览
2024-11-28 18:501374人浏览
2024-11-28 18:501897人浏览
2024-11-28 17:261066人浏览
2024-11-28 16:51276人浏览
2024-11-28 16:152003人浏览
1.网上了asp源码,怎么样才能运行2.ASP源码是什么?网上了asp源码,怎么样才能运行 方法一:1、获取一个如netbox的ASP本地调试工具,安装后按照软件的指导进行操作;2、使用Windo
前陣子與升格人妻、人母的大學好姊妹聚餐,媽媽經的主題隨著家裡的小鬼頭們準備上小學而繞著同一件事打轉-「學英文」,這個世代的小朋友必備的首要技能。「聽說那所全美語小學費用不便宜,我也是想了好多辦法才湊出
中国消费者报沈阳讯记者王文郁)6月13日,记者从辽宁省阜新市市场监管局了解到,该局自今年4月9日创新实施《药品经营许可证》全生命周期电子化审批以来,共归集相关证照存量数据969条,已受理、办结业务27