Change <Gradient>to<GradientFill> ? (solved)

Change <Gradient>to<GradientFill> ? (solved)

Postby ukoenig » Tue Nov 04, 2008 9:35 pm

Hello

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

Code: Select all  Expand view
//------------- 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 :

Code: Select all  Expand view
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.

Image

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

Code: Select all  Expand view

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 :

Image

All other combinations are working :

Clear color

Image

Predefined Brush

Image

Tiled

Image

Image

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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests