FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour change the size of a bitmap
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
change the size of a bitmap
Posted: Sun Aug 09, 2009 04:42 PM
If I define on init a bitmap with :

#define BMP_H 40
#define BMP_V 40

and then on my application make bitmaps with this size

For nX := 1 To TOTX
@ nrow, ncol BITMAP aBmps[ nY, nX ] RESOURCE "VUOTO" OF oDlg;
SIZE BMP_H, BMP_V PIXEL ADJUST NOBORDER
ncol:=ncol+BMP_V
Next nX

If I want chage the size from user
How I can make ?
sample:



#define BMP_H 40
#define BMP_V 40

function config()
Local odlgconfig, lsave,oBtn
Local oGet[2]
Local nBMP_H := BMP_H
Local nBMP_V := BMP_V



DEFINE DIALOG oDlgConfig TITLE "Configurazione griglia" ;
FROM 2, 2 TO 13, 40

@ 10, 5 say "File :" SIZE 40, 13 pixel OF oDlgConfig
@ 30, 5 say "Colonne :" SIZE 40, 13 pixel OF oDlgConfig

@ 10, 30 GET nBMP_H VAR oGet[1] SIZE 40, 13 pixel OF oDlgConfig

@ 30, 30 GET nBMP_V VAR oGet[2] SIZE 40, 13 pixel OF oDlgConfig


@ 3, 4 BUTTON oBtn PROMPT "&Ok" SIZE 45, 12 OF oDlgConfig ;
ACTION ( oDlgConfig:End(), lsave:=.t. ) DEFAULT

@ 3, 14 BUTTON "&Cancel" SIZE 45, 12 OF oDlgConfig ;
ACTION ( oDlgConfig:End(), lsave:=.f. )


ACTIVATE DIALOG oDlgConfig CENTERED

* BMP_H := nBMP_H
* BMP_V := nBMP_V
RETURN NIL


First
Why I cannot write into the get ?

Second
then How I refresh a defined variable ?
Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 05:12 PM
Hello Sylvio,

Code (fw): Select all Collapse
For nX := 1 To TOTX
     aBmp[ nY, nX ]:nWidth() := nHORZ // new Value
     aBmp[ nY, nX ]:nHeight() := nVERT // new Value
     aBmp[ nY, nX ]:Refresh()
Next nX


Best 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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 05:30 PM
Uwe I try it but then all bitmaps are moved look it please

First





then



this is the function :
Code (fw): Select all Collapse
#define ZOOM_H    5
#define ZOOM_V    5

STATIC  function ZoomIn()
  Local nY, nX
  lOCAL nRow
  Local nCol
  local nNewHeigth
  local nBottom
  local nRight

  nRow := aBmps[ 1, 1 ]:nTop
  nCol := aBmps[ 1, 1 ]:nLeft
  nBottom := aBmps[ 1, 1 ]:nBottom
  nRight := aBmps[ 1, 1 ]:nRight

For nY := 1 to TOTY
  For nX := 1 To TOTX
    aBmps[ nY, nX ]:nTop := nRow
    aBmps[ nY, nX ]:nLeft := nCol
    aBmps[ nY, nX ]:nWidth  += ZOOM_V
    aBmps[ nY, nX ]:nHeight += ZOOM_H
    ncol += aBmps[ nY, nX ]:nWidth +ZOOM_V
    nNewHeigth := aBmps[ nY, nX ]:nHeight +ZOOM_H
  Next nX
  nCol := 0
  nRow += nNewHeigth
Next nY

   aBmps[ nY, nX ]:refresh()

return nil
Best Regards, Saludos



Falconi Silvio
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 06:04 PM

Silvio,

I had a look at Your Screenshots,
There is a defined Gridsize ( Position Left, Upper ) where You paint the BMP's.
In case You change the Size of the BMP, the Grid must be adjusted as well, before the new BMP
is painted with a new Size.
If You don't resize the Grid, the BMP's are shown interleaved, because the Left- Upper-Position of the BMP is defined in Relation to the Grid.
That means, at first the Grid-Size must be changed ( zoomed ) to the new Size.

Best 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.
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 09:46 PM

there is none grid !!
they are all bitmaps ....!!!!!
I you see a grid is only a eye game

Best Regards, Saludos



Falconi Silvio
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 10:19 PM

What Uwe is saying is still somewhat true if you are using a browse or not.

If you change the size of the bitmaps you are going to have to compensate for this by changing where they are drawn on the screen.

If you were using a browse then the browse would figure out the new locations as long as the row height and column width was adjusted to the new dimensions. However, I seem to remember that there was a reason that you couldn't use a browse for this.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 10:25 PM
James,

I think after resizing, a new calculation is needed for the BMP-positions like You can see
on the Screenshot-part.



Best 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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: change the size of a bitmap
Posted: Sun Aug 09, 2009 10:31 PM

Uwe,

>I think after resizing, a new calculation is needed for the BMP-positions like You can see
on the Screenshot-part.

Yes, that is what I was trying to say. New row and col positions will be needed for each bitmap. This may be less complicated than it seems, since you can do it two loops.

for nRow
for nCol = 1 to ...
...
next nCol
next nRow

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
Re: change the size of a bitmap
Posted: Mon Aug 10, 2009 07:10 PM

this is the function draw the bitmaps
oPanel is a dialog

STATIC FUNCTION AssegnaBitmaps_NEW ( aBmps, aData, oPanel, nItem)
Local nY, nX
lOCAL nRow:=20
Local nCol:=BMP_V
Local oGet[TOTY]
local nFila:=1,x:=1

nY := 1
nX := 1

@ 5, 5 say "Fila" OF oApp:oPanel PIXEL SIZE BMP_H,BMP_V

For nY := 1 to TOTY
oGet[ nY ] := tget():new(nRow, nCol-BMP_V, SetGet( nY ), oApp:oPanel, BMP_H, BMP_V, "99",,,,,,,.t. )
oGet[ nY ]:lReadOnly:=.t.
For nX := 1 To TOTX
@ nrow, ncol BITMAP aBmps[ nY, nX ] RESOURCE "VUOTO" OF oApp:oPanel ;
SIZE BMP_H, BMP_V PIXEL ADJUST NOBORDER
ncol:=ncol+BMP_V
Next nX
@ nRow, nCol say ny OF oApp:oPanel PIXEL SIZE BMP_V,BMP_V COLOR CLR_BLACK,nRGB( 240, 232, 188 ) BORDER

nRow += BMP_H
nCol := BMP_V
Next nY

nCol:=BMP_V
For t=1 to Totx
@ nRow, nCol say t OF oApp:oPanel PIXEL SIZE BMP_H,BMP_V COLOR nRGB( 3, 56, 147 ),nRGB( 255, 255, 220 ) BORDER
nCol:=nCol+BMP_V

Next t

return nil

How I can resolve it ?

Best Regards, Saludos



Falconi Silvio

Continue the discussion