Here are the code routines:

btw, the bitmap data is saved with dynamic string fields (at the end of each
record).  That is why I typecast the BitmapPtr as char* when performing the
write operation.  Works like a champ in anything other than 5.0


Displaying Bitmap:
------------------------------------------------------------------------
  // Signature Box
  GetSignatureGadgetBounds(frmP, &bounds);
  WinPaintRectangleFrame(simpleFrame, &bounds);

  if (GetBitMacro(recP->flags.allBits, diveLogStringSignature) != 0)
  {
   signatureP = (BitmapPtr)record.fields[logStringSignature];
   signatureLen = BmpSize(signatureP);
   bitmapP = MemPtrNew(signatureLen);
   if (bitmapP)
   {
    MemMove(bitmapP, signatureP, signatureLen);
    BmpCompress(bitmapP, BitmapCompressionTypeNone);
    WinDrawBitmap(bitmapP, bounds.topLeft.x, bounds.topLeft.y);
    MemPtrUnlock(bitmapP);
    MemPtrFree(bitmapP);
   }
  }

Retrieving bitmap from window gadget to store:
-----------------------------------------------------------------------
  // Create offscreen window to copy the bits surrounded by gadget into.
  signatureWinH = WinCreateOffscreenWindow(boundsP->extent.x,
boundsP->extent.y,
                 screenFormat, &err);
 if (!err)
 {
  // Copy gadget screen rectangle into the new window.
   WinCopyRectangle(NULL, signatureWinH, boundsP, 0, 0, winPaint);
   signatureP = WinGetBitmap(signatureWinH);

   bitmapSize = BmpSize(signatureP);
   bitmapP    = (char*)MemPtrNew(bitmapSize);

   if (bitmapP)
   {
    MemSet(bitmapP, bitmapSize, 0);
    MemMove(bitmapP, signatureP, bitmapSize);
   }

   WinDeleteWindow(signatureWinH, false);


Finally, saving bitmap to database:
--------------------------------------------------------------------------
     // Signature Bitmap
     case logStringSignature:
      GetSignatureGadgetBounds(frmP, &bounds);
      signatureP = GetSignatureBitmap(&bounds);
      BmpCompress(signatureP, BitmapCompressionTypeRLE);
      signatureLen = BmpSize(signatureP);
      if (!signatureLen) fieldP = NULL;
      else fieldP = (char*)signatureP;
      break;







"SLO Revo News" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >That's strange, this link:
> >http://www.palmos.com/dev/support/docs/palmos/Bitmap.html#998439
> >takes me straight to the BmpCompress() function and the OS5 verbage is
> >clearly listed there.
>
> It's is kind of strange.
>
> >My app has a signature box.  Works fine under 4.0 and below.  On 5.0, the
> >signature box is filled with static garbage.  At first I thought it might
be
> >a problem going from a monochrome (i.e. 1 bit) pixel depth to the 16-bit
> >depth.  After verifying everything it was doing including the bit data,
it
> >just appeard that the function just was not working properly.  At least,
> >that is what it seems to be happening.
>
> Are you able to post some code?
>
>



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

Reply via email to