FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Change <Gradient>to<GradientFill> ? (solved)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Change <Gradient>to<GradientFill> ? (solved)
Posted: Tue Nov 04, 2008 09:35 PM
Hello

With Stefan's solution (saving the gradient as BMP ), i could solve the problem :

//------------- 1 GRADIENT HOR / VERT -----------

FUNCTION DRAW_GRAD( hDC,oBitmap,nDirection,nVColor, nBColor, nMove ) 
LOCAL nGRADIENT, oDlg_temp

aGrad := { { nMove, nVColor, nBColor }, ;
         { nMove, nBColor, nVColor } }

aRect := GETCLIENTRECT( oBitmap:hWnd )

IF nDirection = 1
   DEFINE DIALOG oDlg_temp FROM 0,0 TO aRect [3], aRect[4] PIXEL STYLE nOr(WS_POPUP,4)
   ACTIVATE DIALOG oDlg_temp ; 
   ON PAINT ( GradientFill( oDlg_temp:hDC, 0, 0, 130, 180, aGrad, .T. ),; 
		            oDlg_temp:SaveToBmp("Temp.bmp"), oDlg_temp:end()) 
ENDIF
IF nDirection = 2
   DEFINE DIALOG oDlg_temp FROM 0,0 TO aRect [3], aRect[4] PIXEL STYLE nOr(WS_POPUP,4)
   ACTIVATE DIALOG oDlg_temp ; 
   ON PAINT ( GradientFill( oDlg_temp:hDC, 0, 0, 130, 180, aGrad, .F. ),; 
		            oDlg_temp:SaveToBmp("Temp.bmp"), oDlg_temp:end()) 
ENDIF

DEFINE BRUSH oNewbrush FILE "Temp.bmp"
FillRect( oBitmap:hDC, aRect, oNewbrush:hBrush )
RELEASE BRUSH oNewbrush
FERASE( "Temp.bmp" ) 

RETURN NIL


To show project-settings, I use a Image-Browser to show all kinds
of backgrounds. For gradient-preview I used before :

aRect := GETCLIENTRECT( oBitmap:hWnd )

IF nDirection = 1
   // Horizont.   
   nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .T. )   
ELSE
   // Vertical
   nGRADIENT := Gradient( hDC, aRect, nVColor, nBColor, .F. )  
ENDIF

DEFINE BRUSH oNewbrush COLOR nGRADIENT
FillRect( oBitmap:hDC, aRect, oNewbrush:hBrush )
RELEASE BRUSH oNewbrush


It works but doesn't support color-adjustment.



Because the gradient-colors must shown centered and
the 3. value < nMOVE > is not supported, I want to change from
<Gradient> to <Gradientfill> using :

aGrad := { { nMove, nVColor, nBColor }, ;
	         { nMove, nBColor, nVColor } }

aRect := GETCLIENTRECT( oBitmap:hWnd )

IF nDirection = 1
   // Horizont.   
   nGRADIENT := GradientFill( hDC, aRect, aGrad, .T. )   
ELSE
   // Vertical
   nGRADIENT := GradientFill( hDC, aRect, aGrad, .F. )  
ENDIF

DEFINE BRUSH oNewbrush COLOR nGRADIENT
FillRect( oBitmap:hDC, aRect, oNewbrush:hBrush )
RELEASE BRUSH oNewbrush


It doesn't work.
The exact preview ( windows and dialog ) looks like :



All other combinations are working :

Clear color



Predefined Brush



Tiled



Image



Is it possible to change from <Gradient> to <GradientFill> for BMP's,
to use the < move-color > option ?
( solved, if saving as BMP )

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.

Continue the discussion