I'm not an expert in IMX21 and you didnt tell us what is the problem...
But if you see strange colors then I suppose that is a problem with
Big-Little endian.
In this case RGB565 format gives a very unpredictable results.
To check it you should get access to surface buffer (via
Lock()/Unlock()) and draw anything there with swapped bytes. E.g fill
up the surface with any color.


2007/10/12, Mandala Muneendra Kumar <[EMAIL PROTECTED]>:
>
>
> Hi All,
>
> I have been working on a IMX21 based board which has a LCD controller that
> can display using 16bpp (5R,6G,5B).
> I have written independent application using the frame buffer driver and
> tries to write the text with any color combination it's gives me correct.
>
> Now i want to develop the same thing using "DirectFB".
> Iam facing a strange problem here.
>
> Problem:
>
>  I cannot draw a rectangle with correct color in directfb standalone
> application also.
>
> Any help in this will be a great help to me.
>
>
> 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));
>   DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width,
> screen_height));
>   DFBCHECK (primary->SetColor (primary, 0x00, 0x00, 0x00, 0xF0));
>  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);
> }
>
>
>
>
> 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
> [email protected]
> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
>
>


-- 
Best Regards
Nikita Egorov
[EMAIL PROTECTED]
[EMAIL PROTECTED]

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to