FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PalBmpDraw very slow?
Posts: 97
Joined: Mon Nov 21, 2005 10:29 AM

PalBmpDraw very slow?

Posted: Thu Nov 07, 2013 11:02 AM

HEllo,
we are drawing backround screen (bmp image) with PalBmpDraw() and seems that first call to this function after workstation reboot (or after pause using computer) takes about 10..20 seconds and app seems to hang for this period. Is it somehow related to loading palette?

Can we do something to speed it up? Maybe changing image format can help?

Taavi.

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: PalBmpDraw very slow?

Posted: Thu Nov 07, 2013 11:51 AM
Taavi,

I use a funtion, to paint different backgrounds ( Windows or Dialog )

c_path := cFilePath(GetModuleFileName( GetInstance() ) ) // Main-directory
c_path1 := c_path + "IMAGES\" // selected image-directory in function

...
...
// defined values for colors and brushes
// --------------------------------------------
nWStyle := 1 // 1 = Color, 2 = Gradient, 3 = BMP-brush, 4 = Image
nWColorF := 16443068
nWColorB := 10899511
nWGradPos := 0.2
lWDirect := .T. // Vertical
cWBrush := "Brick.Bmp"
WImage := "Logo.Jpg"

ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT WD_BACKGRD( oWnd, nWStyle, lWDirect, nWColorF, nWColorB, nWGradPos, cWBrush, cWImage )
...
// or use to paint a Image-background :
// ON INIT WD_BACKGRD( oWnd, 4, , , , , , "Logo.Jpg" )

Code (fw): Select all Collapse
// --------  WINDOW / DIALOG - Background ---------------

FUNCTION WD_BACKGRD( oDlg, nStyle, lDirect, nColor1, nColor2, nMove, cBrush, cImage ) 
local oBrush, oImage
local aRect := GETCLIENTRECT( oDlg:hWnd )

IF nStyle = 1 // COLOR
    DEFINE BRUSH oBrush COLOR nColor1
ENDIF
IF nStyle = 2 // GRADIENT Brush
    aGrad := { { nMove, nColor1, nColor2 }, { nMove, nColor2, nColor1 } }
    DEFINE BRUSH oBrush GRADIENT aGrad ;
    STYLE ( If( lDirect = .T., "VERTICAL", "HORIZONTAL" ) )
ENDIF
IF nStyle = 3 // BMP-BRUSH
    DEFINE BRUSH oBrush FILE c_path1 + cBrush
ENDIF
IF nStyle = 4 // Image ADJUSTED
    DEFINE IMAGE oImage FILE c_path1 + cImage
    oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) ) 
    oImage:End()
ENDIF
oDlg:SetBrush( oBrush )
oBrush:End()

RETURN( NIL )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: PalBmpDraw very slow?

Posted: Thu Nov 07, 2013 05:23 PM

BMPs are large. I would convert to a JPG and then use something like this:

DEFINE BRUSH oBrush FILE ".\images\background.jpg" resize

DEFINE WINDOW oWnd...BRUSH oBrush

This will be quite fast.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM

Re: PalBmpDraw very slow?

Posted: Fri Nov 08, 2013 02:52 AM

Have FWH reached a point where we could throw all type of images into a resource and all FWH commands and functions are able to use them?

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion