Rezise Bitmaps

Rezise Bitmaps

Postby Silvio » Mon Jan 26, 2009 7:19 pm

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

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

Re: Rezise Bitmaps

Postby Daniel Garcia-Gil » Mon Jan 26, 2009 7: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...
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Rezise Bitmaps

Postby MGA » Mon Jan 26, 2009 7:54 pm

ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Rezise Bitmaps

Postby Antonio Linares » Mon Jan 26, 2009 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41320
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Rezise Bitmaps

Postby ukoenig » 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 %
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 view

//-------------  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.
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 15 guests

cron