I'm loading a JPEG picture using pnoJpegLib2, on a T|X and I'm
trying to render it in the space where the Graffiti2 area was.
and there's a nasty white border on the part that gets rendered,
is there a way to remove that?
does it matter a lot which of the WinDraw or WinPaint API I use?
here is how I have it so far:
[code in C++]
/*
* drawGUI( )
*
* Draws the background of the GUI
*
*/
void drawGUI(WinHandle winH)
{
pnoJpeg2Ptr jdata;
// initiate the jdata pointer
Err err = pnoJpeg2Create(pJRefNum, &jdata);
if(err == errNone) {
// trying to allocate space enough for the entire background
pnoJpeg2SetMaxDimensions(pJRefNum, jdata, 320, 480);
err = pnoJpeg2LoadFromVFS(pJRefNum,jdata,vRefNum,"/osr/form.jpg");
if(err != errNone) {
pnoJpeg2Free(pJRefNum, &jdata);
goto std_bmp;
}
BitmapPtr bmp;
BitmapPtrV3 bmp3;
err = pnoJpeg2Read(pJRefNum,jdata,&bmp);
// tell that the Bitmap is in DoubleDensity
pnoJpeg2Bmp2DoubleDensity(pJRefNum,bmp,&bmp3);
pnoJpeg2Free(pJRefNum, &jdata);
if(bmp3)
{
// get the draw window
WinHandle tmp = WinSetDrawWindow(winH);
// draw the GUI backgound
WinPaintBitmap((BitmapPtr)bmp3,0,0);
// try to force drawing beyond the 160 boundry
WinPaintBitmap((BitmapPtr)bmp3,0,160);
WinSetDrawWindow(tmp);
return;
}
}
std_bmp: // the old draw section
Coord cTop = 0; // how far from the top to start drawing
Coord bitHeight; // height of the last bitmap drawn
// get the draw window
WinHandle tmp = WinSetDrawWindow(winH);
// get the top from the resource database
MemHandle bitTmp = DmGetResource('Tbmp',BackTop);
BitmapType *top = (BitmapType*)MemHandleLock(bitTmp);
WinPaintBitmap(top,0,cTop);
// get the height of the bitmap
BmpGetDimensions(top,NULL,&bitHeight,NULL);
cTop += bitHeight;
MemHandleUnlock(bitTmp);
// get the middle from the resource database
bitTmp = DmGetResource('Tbmp',BackMid);
BitmapType *mid = (BitmapType*)MemHandleLock(bitTmp);
WinPaintBitmap(mid,0,cTop);
BmpGetDimensions(mid,NULL,&bitHeight,NULL);
cTop += bitHeight;
MemHandleUnlock(bitTmp);
// get the bottom from the resource database
bitTmp = DmGetResource('Tbmp',BackBot);
BitmapType *bot = (BitmapType*)MemHandleLock(bitTmp);
WinPaintBitmap(bot,0,cTop);
BmpGetDimensions(bot,NULL,&bitHeight,NULL);
cTop += bitHeight;
MemHandleUnlock(bitTmp);
// get the button from the resource database
bitTmp = DmGetResource('Tbmp',Buttons);
BitmapType *buttons = (BitmapType*)MemHandleLock(bitTmp);
WinPaintBitmap(buttons,0,cTop);
MemHandleUnlock(bitTmp);
WinSetDrawWindow(tmp);
}
[/code]
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/