Hi,

I have a sample code to display a rectangle on the screen. But i need to know, 
to display a rectangle is any for loop is needed. and also when i run my exe 
file it goes to fullscreen mode and displays rectangle but never returns back.

My code is below:

#include <stdio.h>
#include <unistd.h>
#include <directfb.h>

static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width  = 0;
static int screen_height = 0;
#define DFBCHECK(x...)                                         \
  {                                                            \
    DFBResult err = x;                                         \
                                                               \
    if (err != DFB_OK)                                         \
      {                                                        \
        fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
        DirectFBErrorFatal( #x, err );                         \
      }                                                        \
  }


int main (int argc, char **argv)
{
  int i,j;
  DFBSurfaceDescription dsc;
  DFBCHECK (DirectFBInit (&argc, &argv));
  DFBCHECK (DirectFBCreate (&dfb));
  DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
  dsc.flags = DSDESC_CAPS;
  dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
  DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
  DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
 for(i=0;i<screen_height;i++)
 {
  for(j=0;j<screen_width;j++)
  {
  DFBCHECK (primary->SetColor (primary, 0x60, 0x80, 0xff, 0x00));
  DFBCHECK (primary->FillRectangle (primary, 300, 0, screen_width, 
screen_height));
  DFBCHECK (primary->Flip (primary, NULL, 0));
  }
 }
  primary->Release( primary );
  dfb->Release( dfb );
  return 0;
}


The output is like:

./draw_rectangle

     =======================|  DirectFB 1.0.0  |=======================
          (c) 2001-2007  The DirectFB Organization (directfb.org)
          (c) 2000-2004  Convergence (integrated media) GmbH
        ------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2008-09-10 15:11)
(*) Direct/Thread: Running 'VT Switcher' (CRITICAL, 2933)...
(*) Direct/Thread: Running 'Linux Input' (INPUT, 2936)...
(*) DirectFB/Input: AT Translated Set 2 keyboard (1) 0.1 (directfb.org)
(*) Direct/Thread: Running 'Linux Input' (INPUT, 2937)...
(*) DirectFB/Input: ImPS/2 Generic Wheel Mouse (2) 0.1 (directfb.org)
(*) Direct/Thread: Running 'Linux Input' (INPUT, 2938)...
(*) DirectFB/Input: PC Speaker (3) 0.1 (directfb.org)

(*) Direct/Thread: Running 'PS/2 Input' (INPUT, 2939)...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Running 'Keyboard Input' (INPUT, 2940)...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Genefx: MMX detected and enabled
(*) DirectFB/Graphics: MMX Software Rasterizer 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
(!) DirectFB/FBDev: Panning display failed!
    --> Invalid argument

after this the line "[EMAIL PROTECTED] coding_DirectFB]#" comes for 100 times. 
Please let me know the problem in my code.

Thanks and Regards,
Santosh Kumar G.K













This message (including any attachment) is confidential and may be legally 
privileged.  Access to this message by anyone other than the intended 
recipient(s) listed above is unauthorized.  If you are not the intended 
recipient you are hereby notified that any disclosure, copying, or distribution 
of the message, or any action taken or omission of action by you in reliance 
upon it, is prohibited and may be unlawful.  Please immediately notify the 
sender by reply e-mail and permanently delete all copies of the message if you 
have received this message in error.
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to