hi all,
       Currently i am working on a project where i need to draw an image
onto surface, i have done that successfully too. but strange this is my red
and blue color is interchanged and i found that it is becoz of colors, so
when i try to access colors using GetPalette, it is not entering the
function pSource->GetPalette, so can anyone help me out to solve this issue
and i will be thankful to whoever it is. any suggestions and corrections
will be appreciated. My code is as follows

IDirectFB *dfb=NULL;
  DFBDataBufferDescription dsc;
  IDirectFBImageProvider *imgProvider = NULL;
  DFBSurfaceDescription sdsc;
  IDirectFBDisplayLayer *layer;
  DFBDisplayLayerConfig layer_config;
  IDirectFBSurface *pSurface=NULL;
  //IDirectFBPalette *palette=NULL;
  DFBSurfacePixelFormat pixel;
  DFBImageDescription imgDsc;
  DFBResult       ret;
  //DFBColor        Colors[256];


  //Init DirectFB
 DirectFBInit(NULL, NULL);
DirectFBCreate(&dfb);
dfb->CreateImageProvider(dfb, &data1, &imgProvider);
imgProvider->GetSurfaceDescription(imgProvider, &sdsc);
sdsc.pixelformat = DSPF_ARGB;
dfb->CreateSurface(dfb, &sdsc, &pSurface);
imgProvider->RenderTo( imgProvider, pSurface, NULL );
pSurface->Lock(pSurface,DSLF_READ, &imageData, &interlace );
   raster = imageData;
   pSurface->Unlock(pSurface);
ret = pSurface->GetPalette(pSurface, &palette);
if(ret ==
DFB_OK){
---------------------->>>>>>>not
entering here
palette->GetEntries(palette, Colors, 256, 0);     --- i need this colors
value in order to assign the right colors
for(i=0;i<256;i++){
      (*alpha)[i] = Colors[i].a;
      (*red)[i] =  Colors[i].r;
      (*blue)[i] = Colors[i].b;
      (*green)[i] = Colors[i].g;

     }
}
//pSurface->Release(pSurface);  ----if i uncomment this line i dont get the
image
imgProvider->Release(imgProvider);
dfb->Release(dfb);

1) i need the palette colors inorder to assign it as return value to my
function to get the actual colors, so please help me out or any similar code
will be helpful,

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

Reply via email to