After that we tried displaying image using the following code. The image displayed in device is distorted and not clear .Please go through this code segment and guide us.

void createbitmap()
{
      Err error;
   char *pData;
//    UInt8 *pBitmapBits;
   BitmapType *bmpP;
      BitmapTypeV3 *bmpV3P;
   ColorTableType *_ctbl;
//    //MemHandle  hBitmap;
_ctbl = (ColorTableType *)MemPtrNew(sizeof (ColorTableType) + (256 *
sizeof(RGBColorType)));
_ctbl->numEntries = 256;

   bmpP = BmpCreate(95, 90, 8, NULL, &error);
    pData = bmpRead();   //  reads bitmap data

   bmpV3P = BmpCreateBitmapV3(bmpP,kDensityDouble,pData,NULL);
   WinDrawBitmap((BitmapType*)bmpV3P,50,50);
      }



char* bmpRead()
{
     FileRef fref , nfref;
       Err err,err1;
       MemHandle bufH;
       char *bufBaseP;
       UInt32 rb;
       //FileRef fileRef = 0;
       char path[] = "/Palm/programs/test.bmp" ;
       UInt16 volRefNum;
UInt32 volIterator = vfsIteratorStart;

           while (volIterator != vfsIteratorStop) {
              err1 = VFSVolumeEnumerate(&volRefNum, &volIterator);                     }
           err = VFSFileOpen (volRefNum, path, vfsModeRead,  &fref);
           bufH = MemHandleNew (9716);
           bufBaseP = MemHandleLock (bufH);
           err = VFSFileRead (fref, 9716, bufBaseP, &rb);
           VFSFileClose (fref);
           MemHandleUnlock (bufH);
           MemHandleFree   (bufH);
                    return(bufBaseP);

}

Michal Seliga wrote:
i don't know anything about protein sdk so i can't help here, sorry

Anoop wrote:
  
Am attaching the code . Please go through it.

GcBitmapHandle gcBitmap;
GcHandle gc;

gcBitmap = FrmGetBitmapHandle(formP, myAppDB, bitmapRsc,
rscID, 0);
if (!gcBitmap)
return memErrNotEnoughSpace;
GcGetCurrentContext(gc);
if (gc) {
GcDrawBitmapAt(gc, gcBitmap, NULL, x, y);
GcReleaseContext(gc);

Here we need to know how we could give the FrmGetBitmapHandle parameter
"myAppDB", which is the database name. Am developing my application in
Protein sdk. Here i cant find a .pdb file. Please help..

Michal Seliga wrote:
    
if image data are 16bpp you may need to byteswap each pixel. it depends how you
draw it exactly (memmove to window bitmap? or create bitmap and use
WinDrawBitmap()?)

Anoop wrote:
  
      
Hi all,
        We read a bmp image from a file at a specified location and
tried displaying on screen. While trying it in device the image was
correctly loaded but was distorted. We specified the correct height,
width , depth and file size for reading from file. Also we noticed that
the image is inverted. The color combination is also not correct. if
anyone gone through this issue, please guide us.

Thanks,
Anoop

    
        
  
      

  


--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to