FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Rezise Bitmaps
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Rezise Bitmaps
Posted: Mon Jan 26, 2009 07:19 PM

HOe I can resize a bitmap and Know his height and with to insert a prompt text ?

Best Regards, Saludos



Falconi Silvio
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 PM
Re: Rezise Bitmaps
Posted: Mon Jan 26, 2009 07:37 PM

Silvio...

you can "stretch" bitmap into frame and use frame dimension ( height / width )

use BITMAP command or IMAGEN command and use ADJUST Clause...

Posts: 1286
Joined: Mon Feb 25, 2008 02:54 PM
Re: Rezise Bitmaps
Posted: Mon Jan 26, 2009 07:54 PM
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Rezise Bitmaps
Posted: Mon Jan 26, 2009 09:16 PM

Silvio,

It is is a bitmap control then you can do:

oBmp:SetSize( nNewWidth, nNewHeight )

to know its dimensions:

oBmp:nWidth
oBmp:nHeight

or is it a bitmap that you are managing in memory (and not a visible control) ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Rezise Bitmaps
Posted: Tue Jan 27, 2009 10:42 AM
Hello,

I want a Gradientfill on a resized BMP, but the results are not like expected :
The start-position of the 2. Color is not properly painted after resizing.
There is no change in the Grad-defines, only a resizing.

Given values with 100 %


Resize to 31 % is OK


Resize back to 80 % ( the white line must be centered but is shown twice )


//-------------  RESIZE BMP with  GRADIENT HOR / VERT -----------

// GRADIENT-BMP
// ---- only repainted if any Slider ( Horiz. or Vertical )- changed ----
REDEFINE BITMAP oBmp ID 130 ADJUST RESOURCE "Blanc" OF oFld:aDialogs[3]
oBmp:bPainted := { |hDC|  IIF( lHORZ = .T. .or. lVERT = .T., ;
     ( NEW_SIZE( oBMP ),lHORZ = .F., lVERT = .F. ), NIL ) } 

// ----------------- Horizont-Slider ---------------------

REDEFINE SLIDER oSLIDER3 VAR nGRADHORZ OF oFld:aDialogs[3] ID 710;
HORIZONTAL ;
RIGHT DIRECTION ;
RANGE 0, 100 ;
ON CHANGE ( lHORZ := .T., lVERT:= .T., ;
      oGRADHORZ:Refresh(), ;
      nHORZ  := 6.2 * nGRADHORZ, ;
      oBMP:nWidth() := nHORZ, ;
      oBMP:Refresh() ) ;
      COLORS 128, 15977281, 128 ;
      MARKS 49 ;
      UPDATE

// % - Field
// ---------
REDEFINE GET oGRADHORZ VAR nGRADHORZ ID 715 PICTURE "999" OF oFld:aDialogs[3] UPDATE ;
VALID ( ( oGRADHORZ:Refresh(), oSlider3:Set(nGRADHORZ ), oSlider3:Refresh(), ;
      nHORZ  := 6.2 * nGRADHORZ, ;
      oBMP:nWidth() := nHORZ, ;
      oBMP:Refresh() ), .T. )

// ----------------- Vertical-Slider ---------------------

REDEFINE SLIDER oSLIDER4  VAR  nGRADVERT OF oFld:aDialogs[3] ID 700;
VERTICAL ;
RIGHT DIRECTION ;
RANGE 0, 100 ;
ON CHANGE ( lHORZ := .T., lVERT:= .T., ;
      oGRADVERT:Refresh(), ;
      nVERT  := 4.9 * nGRADVERT,  ;  
      oBMP:nHeight() := nVERT, ;
      oBMP:Refresh() ) ;
      COLORS 128, 15977281, 128 ;
      MARKS 49 ;
      UPDATE

REDEFINE GET oGRADVERT VAR nGRADVERT ID 705 PICTURE "999" OF oFld:aDialogs[3] UPDATE ;
VALID ( ( oGRADVERT:Refresh(), oSlider4:Set(nGRADVERT), oSlider4:Refresh(), ;
      nVERT  := 4.9 * nGRADVERT, ;
      oBMP:nHeight() := nVERT, ;
      oBMP:Refresh() ), .T. )

////////////////////////

FUNCTION NEW_SIZE( oBitmap ) 
LOCAL hDC := oBitmap:GETDC()

// Both doing the same
// ------------------------
oBitmap:SetSize( nHORZ, nVERT )
*PalBmpDraw( hDC, 0, 0, oBitmap:hBitmap, , nVERT, nHORZ )

//aGrad and nDirection are defined !!!
// nMove = 2. Color start-position ( in this sample < 0.50 > centered )
// nVColor = 1. Color
// nBColor = 2. Color
// nDirection : 1 = Horiz., 2 = Vert.
// -------------------------------------
// aGrad := { { nMove, nVColor, nBColor }, ;
//       { nMove, nBColor, nVColor } }

IF nDirection = 1
   GradientFill( hDC,0,0, nVERT, nHORZ, aGrad, .T. )
ELSE
   GradientFill( hDC,0,0, nVERT, nHORZ, aGrad, .F. )
ENDIF

oBitmap:ReleaseDC()

RETURN NIL


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