Hi,
         I want to implement GUI using DirectFB on IMX21 based embedded 
board.
I had problems with color in both background and in fonts.
Now I solved my background color problem, and the problem is due to 
endianness.
my problem with fonts remain unsolved.
If I give color to the font that particular color is shaded as a border 
to the font.
But some junk color is filled in the inner side of the font.

any help on this will be appreciated.

I am checking this only using directfb example code.


main()
{
     int i,width;
    /*
   * A structure describing font properties.
   */
  DFBFontDescription font_dsc;
  /*
   * (Locals)
   */
  DFBSurfaceDescription dsc;
  DFBSurfacePixelFormat PixelFormat;
  PixelFormat = DSPF_RGB16;
  /*
   * (Initialize)
   */
  DFBCHECK (DirectFBInit (&argc, &argv));
  DFBCHECK (DirectFBCreate (&dfb));
  DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
  dsc.flags = DSDESC_CAPS | DSDESC_PIXELFORMAT;
  dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
  dsc.pixelformat = PixelFormat;
  DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
  DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
  /*
   * First we need to create a font interface by passing a filename
   * and a font description to specify the desired font size. DirectFB will
   * find (or not) a suitable font loader.
   */
  font_dsc.flags = DFDESC_HEIGHT |
DFDESC_ATTRIBUTES|DSDESC_PIXELFORMAT;
  font_dsc.height = 40;

 font_dsc.attributes =0;//DFFA_NOCHARMAP;// 0;//antialias ? 0 :
DFFA_MONOCHROME;

  DFBCHECK (dfb->CreateFont (dfb, "arial18.bdf", &font_dsc, &font));
  printf("\nCreateFont***********************\n");
  /*
   * Set the font to the surface we want to draw to.
   */
  DFBCHECK (primary->SetFont (primary, font));
 /*  font_dsc.flags = DFDESC_ATTRIBUTES;



  font_dsc.attributes = antialias ? 0 : DFFA_MONOCHROME;*/

  /*
   * Determine the size of our string when drawn using the loaded font.
   * Since we are interested in the full string, we pass -1 as string
length.
   */
  DFBCHECK (font->GetStringWidth (font, text, -1, &width));
 /*******************************************/
  DFBCHECK (primary->SetColor (primary, 0xFF, 0x00, 0x00,0xFF)); // 
modified for endianness.
  DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width,
screen_height));
  DFBCHECK (primary->SetColor (primary, 0x00, 0x00, 0x00, 0xF0)); // 
modified for endianness.
 DFBCHECK (primary->DrawString (primary, text, -1,0 , screen_height / 2,
DSTF_LEFT));
 DFBCHECK (primary->Flip (primary, NULL, DSFLIP_WAITFORSYNC));

  /*
   * Release the font.
   */
  font->Release (font);
  /*
   * (Release)
   */
  primary->Release (primary);
  dfb->Release (dfb);
}


Thanks
Dhanasekaran

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments contained in it.

Contact your Administrator for further information.

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to