DirectFB基本概念  

2009-08-18 11:52:18|  分类: GUI|字号 订阅

 
 
Surface is a reserved area in memory where pixel data for one image is stored in a
specific pixel format. A Surface can reside in video and/or system memory. It is possible to perform drawing operations on a surface or to Blit the surface to another.
   In fullscreen mode, the visible screen is represented by the ”‘Primary Surface”’, so it is possible to perform graphics operations directly on the visible screen.Every Surface can optionally use double buffering, graphics operations are then first executed on a secondary buffer and become valid after Flip() is called. To prevent flickering it is advised to use Doublebuffering on the primary Surface in most cases.

Depending on the graphics hardware, there are one or more display Layers. A standard PC graphics card has only oneLayer, but sophisticated devices like TV set top boxes may support two or more layers. Layers occupy different areas in video ram, and are usually combined by using alpha blending. This in done automatically by the display hardware. If the content of the lowest Layer changes, no repaint has to be done and the contents of the above layers remain untouched. Today, most PC graphics cards also support an additional layer (a ”‘video layer”’), which can be scaled and does color conversion from YUV to RGB. This layer cannot usually be blended and has to remain fully opaque. Video layers are supported by varios DirectFB graphics drivers.

Normally the contents of a layer’s surface is controlled by the integrated windowing system that shows the windows belonging to the layer on a configurable background. Each window has its own surface that is used by the windowing system to produce the composed image of overlapping windows. Alternatively applications, especially games, can get exclusive access to the layer. This way the application has direct control over the layer’s surface and it’s contents, no windows are shown.

  • 1 IDirectFB (top-level) <--> N Screens
  • 1 Screen <--> N Layers
  • 1 Layer <--> 1 Primary Surface
  • 1 Layer <--> N Windows
  • 1 Window <--> 1 Window Surface
  • 1 Surface <--> N Subsurfaces

so,make the conclusions:
    layer    object:screen,layer,window
    drawing  object:surface
    Every layers has its own surface.

Then the concepts above told us how to use DFB:drawing on the surface ,management on the layer object.

 

问题1. 据我的理解是一个layer上可以放多个surface, 一个surface上又可以放多个window.  不知道这个理解对不对?

问题2 (见附件)
据图中所说layer对象可以通过directfb Get layer 获得
window对象可以通过layer Create window获得

但关键是surface对象 从图上看 有三种方法可以获得surface 对象
1. 通过directfb Create Surface 获得
2. 通过directfb Get layer 获得layer对象 再从layer Get surface 获得surface 对象
3. 通过directfb Get layer 获得layer对象 通过layer Create window获得 window对象 再从window Get surface 获得surface对象

那么这三 种方法获得的surface 是否一样呢?

问题3 如果我要创建两个surface 一个surface上显示图象 另一个surface可以根据自己的意愿(如:按一个键)显示菜单 那我应该怎么做呢?请指教

 DirectFB基本概念 - 111 - woxihuanpes 的博客

 

 

 我认为你的理解基本是正确的, 
第3个问题你可以在一个主surface上创建一个surface作为显示图像,在主surface上创建一个window,通过window获得surface作为你的另一种用途(因为你说的显示一个按键需要焦点,所以创建window好一点)
当然还有其它的方法实现它,我只是说了其中一种而已.

 

 

 

问题1. 你用的词是“放”,而不是创建。所以现在的说法是没错的。不过注意windows并不是放到surface上,而是把window中的surface  blit到这个surface上。
问题2。不一样。还得看你create和get的参数。有的surface是显示层的,修改后flip就会更新到显示上,有的要用blit到显示层的surface上才可以显示。
问题3.(对echo:)“在主surface上创建一个window”这个说法不正确。因为surface不可以创建window。而是应该说在主“层”上创建一个window。

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 丘猴子 的頭像
    丘猴子

    轉貼部落格

    丘猴子 發表在 痞客邦 留言(0) 人氣()