Currently using VO 2.6 with bbrowser and FABPAINT V1.2
I have an app that displays shrunk thumbnail preview pictures in a
bbrowser
column along side other standard data columns.
Some Fabpaint functions are used to resize and display the thumbnails.
This works perfectly on most modern video hardware, but a few old pcs with
old video SVGA hardware running my app display the thumbnails in all the
wrong colours or not at all.
My code is shown below. I THINK (and I could be wrong) the problem is that
the old video hardware cannot correctly display 32bpp images.
Unfortunately,
the FABPaint function DIBResizeBox() only sup****ts 32bpp DIBs so all my
pictures have to be converted to 32bpp.
My question is,.... Does any one know of another function or way to resize
a
DIB while retaining its original bitsperpixel setting? As the image is
being displayed in a bbrowser I don't believe I can use DIBStretch().
Or, is there a newer version of this FABPaint function that retains Bpp
setting and if so is the DLL backwardly compatible with VO2.6?
***************
METHOD PostInit(oWindow,iCtlID,oServer,uExtra) CLASS TabGalleryTable
//Put your PostInit additions here
LOCAL opicdatacol AS bDataColumn
SELF:oDCbBrowser1:use(SELF:owner:server,,{}) //load all columns into
browser, but display none
// initialize column IMAGE
SELF:oDCbBrowser1:rowheight:=60
opicdatacol:=bDataColumn{SELF:oDCbBrowser1,SELF:oDCbBrowser1:server,{|Server,Owner|
Owner:GetImage(Server:filename)}, #Expression, SELF} opicdatacol:Caption :=
"Image" opicdatacol:ValType := "O" opicdatacol:Alignment := BALIGN_CENTER
opicdatacol:Width := 90 opicdatacol:editable:=FALSE
SELF:oDCbBrowser1:AddColumn(opicdatacol)
SELF:oDCbBrowser1:OpenColumn(opicdatacol)
SELF:oDCbBrowser1:SetDeleted(FALSE) SELF:SaveDefaultLayout() // default
column position and widths SELF:odcbbrowser1:OwnerAlignment :=
OA_FULL_SIZERETURN NIL***********************METHOD GetImage(cfilename)
CLASS TabGalleryTable // method to load animage into a bbrowser column
LOCAL oImage AS kybitmap LOCAL pDib AS PTR LOCAL pBitmapInfo AS
_winBitmapInfo LOCAL pbits AS PTR LOCAL pCopy AS PTR LOCAL ncellx AS
LONGINT LOCAL nCelly AS LONGINT LOCAL nscale AS REAL8 LOCAL nNewx AS
LONGINT LOCAL nnewy AS LONGINT DO CASE CASE Empty(cfilename)
pdib:=DIBCreateFromFile(WorkingDirectory+"nopic.bmp") CASE
!File(cfilename)
pdib:=DIBCreateFromFile(WorkingDirectory+"nopic.bmp") CASE
!(Upper(Right(RTrim(cfilename),3))="JPG"
.or.Upper(Right(RTrim(cfilename),3))="BMP"
.or.Upper(Right(RTrim(cfilename),3))="TIF"
.or.Upper(Right(RTrim(cfilename),4))="TIFF"
.or.Upper(Right(RTrim(cfilename),3))="PNG"
.or.Upper(Right(RTrim(cfilename),3))="TGA".or.Upper(Right(RTrim(cfilename),3))="PCX"
.or.Upper(Right(RTrim(cfilename),3))="PCT")
pdib:=DIBCreateFromFile(WorkingDirectory+"noprev.bmp") OTHERWISE
pDib:=DIBCreateFromFile(cfilename) ENDCASE IF pDib<>NULL_PTR
pbitmapinfo:=DIBGetInfo(pDib) nCellx:=90 //width of
bbrowser col nCelly:=60 //bbrowser rowheight
nscale:=Min(ncellx/pbitmapinfo.bmiheader.biwidth,ncelly/pbitmapinfo.bmiheader.biheight)
nNewx:=INT(nscale*pbitmapinfo.bmiheader.biwidth)
nNewy:=INT(nscale*pbitmapinfo.bmiheader.biheight) pCopy :=
DIBCreateCopy( pDib, 32 ) //convert to 32bpp sofollowing DIBresizebox
works DIBResizeBox(pcopy, nNewx, nNEwy,1) //this function only
workswith 32bpp hbitmap:=DIBGetHandle(pcopy)
oimage:=kybitmap{hbitmap} DIBDelete(pdib) //
DIBDelete(pcopy) ENDIFRETURN oimage**************************


|