Is it possible to save a resized BMP from resource to Disk ?
I need this for the new xBrowse-options, to paint gradient-bmp's
and save them to disk for use as background-display ( streched to the xBrowse data-erea).
I know, there have been some questions about BMP-saving.
I use for display :
- Code: Select all Expand view
// Gradient-Resource
// -----------------------------------------------------------
REDEFINE BITMAP oBmp30 ID 130 ADJUST RESOURCE "Blanc" OF oFld:aDialogs[8]
oBmp30:bPainted := { |hDC|DRAW_GRAD( oBMP30, nDIRECTION, nGRADIENT1, nGRADIENT2, ;
nGRADMOVE, nValue1, nValue2 ) }
// Solved, calling < oBMP30:SaveToBmp( "Test.bmp" ) > from a Button
// after resizing.
// --------------------------------------------------------------------------------
REDEFINE BUTTONBMP oBtn24 ID 30 OF oFld:aDialogs[8] ;
ACTION ( oBMP30:SaveToBmp( "Test.bmp" ) ) ;
BITMAP "Write1" PROMPT " &Save and Preview" TEXTRIGHT
oBtn24:cToolTip = { "Click the Button" + CRLF + ;
"for information","2. Gradient-Color", 1, CLR_BLACK, 14089979 }
//------------- GRADIENT HOR / VERT -----------
FUNCTION DRAW_GRAD( oBitmap, nDirection,nVColor, nBColor, nMove, nVERT, nHORZ )
LOCAL aGrad := { { nMove, nVColor, nBColor },{ nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, hDC := oBitmap:GETDC()
newHORZ := (aRect[3] / 100) * nHORZ
newVERT := (aRect[4] / 100) * nVERT
IF nDirection = 1
DEFINE BRUSH oNewBrush COLOR ;
GradientFill( hDC,0,0, newHORZ, newVERT, aGrad, .T. )
ELSE
DEFINE BRUSH oNewBrush COLOR ;
GradientFill( hDC,0,0, newHORZ, newVERT, aGrad, .F. )
ENDIF
FillRect( hDC, aRect, oNewBrush:hBrush )
// --------------------------
// Save to Disk solved !!!
// --------------------------
oBitmap:ReleaseDC()
RELEASE BRUSH oNewbrush
RETURN NIL
Regards
Uwe