I use this code to draw a bitmap >64k from a stream resource -
{
FileHand inHand;
t_bmpDetails bmpDetails;
BitmapPtr bitmapP;
UInt32 bitmapDataSize,bitmapHeaderSize;
Int32 objectsRead;
UInt32 density;
Boolean highDensityBackground=false;
inHand=FileOpen(0,dbJpgCacheName,dBJpgCacheType,launcherFileCreator,fileModeReadOnly,&error)
;
if (inHand) //there is a stored bitmap!
{
objectsRead=FileRead(inHand,&bmpDetails,sizeof(t_bmpDetails),1,&error);
bitmapP = BmpCreate(bmpDetails.width, bmpDetails.height,
bmpDetails.depth, NULL, &error);
if (bitmapP)
{
BmpGetSizes(bitmapP,&bitmapDataSize,&bitmapHeaderSize);
objectsRead=FileRead(inHand,BmpGlueGetBits(bitmapP),bitmapDataSize,1,&error);
}
FileClose(inHand);
WinScreenGetAttribute(winScreenDensity,&density);
if (objectsRead==1)
{
Int16 x,y;
if (density==kDensityDouble && (bmpDetails.width>160 ||
bmpDetails.height>160))
{
BitmapTypeV3 *tempBitmapP;
tempBitmapP=BmpCreateBitmapV3(bitmapP,kDensityDouble,BmpGlueGetBits(bitmapP),NULL);
BmpDelete(bitmapP);
bitmapP=(BitmapPtr)tempBitmapP;
highDensityBackground=true;
//change bitmap size to correct value in normal
coordinates
bmpDetails.width=bmpDetails.width/2;
bmpDetails.height=bmpDetails.height/2;
}
//
//screenSize= highDensityBackground?320:160;
x=bmpDetails.width<160?((160-bmpDetails.width)/2):0;
y=bmpDetails.height<160?((160-bmpDetails.height)/2):0;
WinPaintBitmap(bitmapP,x,y);
}
BmpDelete(bitmapP);
}
}
for this to work - I have saved the bitmap myself, so I can fill in the
typedef struct {
Int16 width;
Int16 height;
UInt8 depth;
} t_bmpDetails;
You could adapt this approach to work with vfs pretty easily.
email me if you need more details.
Rob
On Thu, 14 Jul 2005 20:14:53 -0600, ThuNguyet Nguyen
<[EMAIL PROTECTED]> wrote:
Hi there,
Has anyone drawn a bitmap bigger than 64k
from an external card before? I was able
to get the image from the card and allocate
enough memory for a MemPtr to hold it by
using MemGluePtrNew. After casting the
MemPtr as a BitmapPtr, I called
WinDrawBitmap(someBitmap,0,0) in the
frmOpenEvent event handler, but nothing
showed up... Can somebody help?
Can you draw a smaller bitmap from the external card? If not, try that
first.
WinDrawBitmap(someBitmap,0,0)
Input data someBitmap (of WinDrawBitmap()) is in the Palm bitmap format
(bitmap family, check the "Palm OS Programmer's Companion"). It is a lot
different than the format of images (.bmp,.gif, .jpg, etc...)
If you can load the image in advanced, cut the image to smaller size
imagees and put them in the resources (using Constructor).
If you have to load the image at runtime
http://flippinbits.com/twiki/bin/view/Main/DevelopmentToolsList
has links for some image related libraries.
I tried to show images at run time on the Palm but I couldn't get the
right color table (color pallete) and I gave up.
If you find out how to draw bitmap from external card, let me know too,
please.
tnn
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/