Rezise Bitmaps

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Rezise Bitmaps

Post by Silvio »

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

Falconi Silvio
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: Rezise Bitmaps

Post by Daniel Garcia-Gil »

Silvio...

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

use BITMAP command or IMAGEN command and use ADJUST Clause...
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
MGA
Posts: 1258
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Re: Rezise Bitmaps

Post by MGA »

ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
User avatar
Antonio Linares
Site Admin
Posts: 42560
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 80 times
Contact:

Re: Rezise Bitmaps

Post by Antonio Linares »

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

Re: Rezise Bitmaps

Post by ukoenig »

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 %
Image

Resize to 31 % is OK
Image

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

Code: Select all | Expand


//-------------  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 :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.
Post Reply