I am looking for 3.5 version on Signature application
which could run both on 3.1 and 3.5.
I hava an application which I need to run on both os
3.1 and 3.5, I need to save and retreive Bitmap.
Following code I am using to save and display the Bmp.
Its works fine with 3.1 but with 3.5 it is displaying
the bmp with whole white color. I am using sdk 3.5.
Thanks
Nimesh.
//======= To Draw Bitmap ===============
WinDrawBitmap((BitmapPtr)blob, 38, 38);
/*===== To save BMP ======
Checking the version of Os and setting the flag but
its not working with new BMP APIs and thats reason of
commented
*/
static BitmapPtr PrvGetBitmap (WinHandle winH, UInt32
*sizeP,RectangleType* theBoundsPtr, Err *errorP)
{
UInt16 width, height;
UInt16 rowBytes;
BitmapPtr bitmapP;
UInt8 depth;
WindowType *winP;
*errorP = 0;
*sizeP = 0;
// can we use the new window functions?
/*
if (newAPI)
{
BitmapPtr winBmpP =
WinGetBitmap(WinGetDrawWindow());
ColorTableType *clrTableP =
BmpGetColortable(winBmpP);
UInt8 depth = winBmpP->pixelSize;
WinHandle winH;
// we create a bitmap and then make a window to it
so that we can
// create a bitmap whose depth does not match that
of the screen
bitmapP = BmpCreate(theBoundsPtr->extent.x,
theBoundsPtr->extent.y, depth, clrTableP, errorP);
if (!*errorP)
{
winH = WinCreateBitmapWindow(bitmapP,errorP);
}
if (!*errorP)
{
// copy draw area into the bitmap
WinCopyRectangle (WinGetDrawWindow(), winH,
theBoundsPtr, 0, 0, winPaint);
WinDeleteWindow(winH,false);
// compress the bitmap
*errorP =
BmpCompress(bitmapP,BitmapCompressionTypeScanLine);
// get the size of the bitmap
*sizeP = BmpSize(bitmapP);
}
}
else
*/
{
//if (newAPI ) {
// BitmapPtr winBmpP =
WinGetBitmap(WinGetDrawWindow());
// UInt8 depth = winBmpP->pixelSize;
//} else {
depth = 1; // assume one pixel depth
//}
winP = WinGetWindowHandle(winH);
width = winP->windowBounds.extent.x;
height = winP->windowBounds.extent.y;
if ((width == 0) || (height == 0))
{ *errorP = memErrNotEnoughSpace;
return NULL;
}
// Create a display buffer for the window. Round
the line width
// up to an even word boundary.
rowBytes = ((((width*depth)+15) >> 4) << 1);
*sizeP = (rowBytes * height) + sizeof(BitmapType);
// note that we do NOT output a color map here...
bitmapP = (BitmapPtr) MemPtrNew(*sizeP);
if (! bitmapP)
{ *errorP = memErrNotEnoughSpace;
return NULL;
}
MemSet(bitmapP,*sizeP,0); // erase it ...
bitmapP->width = width;
bitmapP->height = height;
bitmapP->rowBytes = rowBytes;
bitmapP->pixelSize = depth;
bitmapP->version = 1;
// copy the bitmap contents from the offscreen
window
// The only way to do this on older ROMS is to
acesss the obsolete v20 field.
MemMove(bitmapP+1,winP->displayAddrV20, rowBytes *
height);
}
return (bitmapP);
}
__________________________________________________
Do You Yahoo!?
Thousands of Stores. Millions of Products. All in one Place.
http://shopping.yahoo.com/
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/