Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Clipper Visual-Objects > DIB resizing an...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 7 Topic 11314 of 11560
Post > Topic >>

DIB resizing and FABPAINT

by "K Yorke" <kyorke@[EMAIL PROTECTED] > Apr 15, 2008 at 03:20 PM

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**************************
 




 7 Posts in Topic:
DIB resizing and FABPAINT
"K Yorke" <k  2008-04-15 15:20:36 
Re: DIB resizing and FABPAINT
"K Yorke" <k  2008-04-15 15:32:19 
Re: DIB resizing and FABPAINT
Fabrice Foray <fabrice  2008-04-15 02:10:23 
Re: DIB resizing and FABPAINT
"Paul D B" <  2008-04-15 13:20:39 
Re: DIB resizing and FABPAINT
"K Yorke" <k  2008-04-15 22:20:25 
Re: DIB resizing and FABPAINT
Fabrice Foray <fabrice  2008-04-15 10:28:36 
Re: DIB resizing and FABPAINT
"K Yorke" <k  2008-04-17 22:37:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 16:26:03 CDT 2008.