我们如何为direcfb提供坐标 - >创建表面函数

时间:2015-10-08 05:41:48

标签: c linux graphics directfb

我的要求是创建一个小表面(区域),我想使用该表面显示一个小图标。所以,我想创建一个高度和宽度为100 px * 100 px的曲面,对于坐标,我不知道我必须初始化哪些参数。

以下代码仅供您参考。

DFBSurfaceDescription   desc    = { 0 };

    desc.flags |= DSDESC_CAPS | DSDESC_PIXELFORMAT | DSDESC_WIDTH |DSDESC_HEIGHT;
    desc.caps   = DSCAPS_VIDEOONLY ; //DSCAPS_VIDEOONLY ; //DSCAPS_SHARED; DSCAPS_SYSTEMONLY;
    desc.pixelformat = DSPF_ARGB ;
    desc.width  = pstBuffer->ui4InWidth;
    desc.height = pstBuffer->ui4InHeight;

    ret = gpstDfb->CreateSurface( gpstDfb, &desc, &source );

desc结构定义如下:

typedef struct {
     DFBSurfaceDescriptionFlags         flags;       /* field validation */

     DFBSurfaceCapabilities             caps;        /* capabilities */
     int                                width;       /* pixel width */
     int                                height;      /* pixel height */
     DFBSurfacePixelFormat              pixelformat; /* pixel format */

     struct {
          void                         *data;        /* data pointer of existing buffer */
          int                           pitch;       /* pitch of buffer */
     } preallocated[2];

     struct {
          const DFBColor               *entries;
          unsigned int                  size;
     } palette;                                      /* initial palette */

     unsigned long                      resource_id;   /* universal resource id, either user specified for general
                                                          purpose surfaces or id of layer or window */

     DFBSurfaceHintFlags                hints;       /* usage hints for optimized allocation, format selection etc. */
} DFBSurfaceDescription;

0 个答案:

没有答案