TImage zoom
Re: TImage zoom
look samples\ximage01.prg
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Re: TImage zoom
Cristobal,
it is \samples\BMPALPHA.prg testing ZOOM and ALPHALEVEL.
![Image](http://www.pflegeplus.com/IMAGES/Zoom3.jpg)
best regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
it is \samples\BMPALPHA.prg testing ZOOM and ALPHALEVEL.
![Image](http://www.pflegeplus.com/IMAGES/Zoom3.jpg)
best regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: TImage zoom
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Re: TImage zoom
Cristobal YES as well the same functions but the question was :
His question :
There is a TImage object (not xImage). As you can zoom/unzoom it ?
I think the solution he is looking for ( from : BMPALPHA.prg ) :
@ 0,0 BITMAP oBmp FILENAME cFile OF oWnd ;
PIXEL SCROLL
oBmp:nAlphaLevel := 100
oBmp:bAlphaLevel := {| oBmp | if( oBmp:nZoom > 2, oBmp:nAlphaLevel := 255, oBmp:nAlphaLevel:= oBmp:hAlphaLevel ) }
oBmp:bLDblClick = {|| SAVE2PNGFILE( oBmp:hBitmap, "prueba.png" ), MsgInfo( "saved to prueba.png") }
// ------------ or
#include "Image.ch"
@ 0,0 IMAGE oImg FILENAME cFile OF oWnd ;
// -------------
best regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
His question :
There is a TImage object (not xImage). As you can zoom/unzoom it ?
I think the solution he is looking for ( from : BMPALPHA.prg ) :
@ 0,0 BITMAP oBmp FILENAME cFile OF oWnd ;
PIXEL SCROLL
oBmp:nAlphaLevel := 100
oBmp:bAlphaLevel := {| oBmp | if( oBmp:nZoom > 2, oBmp:nAlphaLevel := 255, oBmp:nAlphaLevel:= oBmp:hAlphaLevel ) }
oBmp:bLDblClick = {|| SAVE2PNGFILE( oBmp:hBitmap, "prueba.png" ), MsgInfo( "saved to prueba.png") }
// ------------ or
#include "Image.ch"
@ 0,0 IMAGE oImg FILENAME cFile OF oWnd ;
// -------------
best regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Last edited by ukoenig on Wed Apr 06, 2016 7:59 pm, edited 6 times in total.
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: TImage zoom
Uwe, Sorry, I have not understood your message
With Scroll mouse
Uwe, YES, you are right,
Regards
With Scroll mouse
Natter wrote:There is a TImage object (not xImage). As you can zoom/unzoom it ?
Uwe, YES, you are right,
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Regards
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Re: TImage zoom
Not possible using :
define button prompt "+ zoom" of oBar action( oImg:nZoom++, oImg:refresh() ) CENTER
define button prompt "- zoom" of oBar action( oImg:nZoom--, oImg:refresh() ) CENTER
OR :
local oImage, oBrush, aRect := oDlg:GetRect()
DEFINE IMAGE oImage FILENAME "..\bitmaps\pngs\chart.png"
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) ) // 1 = stretch, 2 : fitoutside, 3:fitinside
oImage:End()
oDlg:SetBrush( oBrush )
oBrush:End()
define a new size and
REDO using the original aRect
best regards
Uwe![Question :?:](./images/smilies/icon_question.gif)
define button prompt "+ zoom" of oBar action( oImg:nZoom++, oImg:refresh() ) CENTER
define button prompt "- zoom" of oBar action( oImg:nZoom--, oImg:refresh() ) CENTER
OR :
local oImage, oBrush, aRect := oDlg:GetRect()
DEFINE IMAGE oImage FILENAME "..\bitmaps\pngs\chart.png"
oBrush := TBrush():new( ,,,, ResizeBmp( oImage:hBitmap, aRect[4], aRect[3], .T. ) ) // 1 = stretch, 2 : fitoutside, 3:fitinside
oImage:End()
oDlg:SetBrush( oBrush )
oBrush:End()
define a new size and
REDO using the original aRect
best regards
Uwe
![Question :?:](./images/smilies/icon_question.gif)
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: TImage zoom
oImg:nZoom++/oImg:nZoom++, oImg:refresh() - for TImage not work
Use a brush good idea, but I was not able to interactively change its size.
Probably for zoom/unzoom you can use SaveWindow. Save need rectangl context in BMP, and then load in TImage
Use a brush good idea, but I was not able to interactively change its size.
Probably for zoom/unzoom you can use SaveWindow. Save need rectangl context in BMP, and then load in TImage
Re: TImage zoom
I remember some month ago,
I created a tool to zoom a image on top of another image
It works fine with TImage
ZOOM and RESET on buttonaction
The complete download :
http://www.pflegeplus.com/DOWNLOADS/Imgzoom3.zip
My tests RESET, ZOOM + and ZOOM -
![Image](http://www.pflegeplus.com/IMAGES/Zoom4.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom5.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom6.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom7.jpg)
best regards
Uwe![Very Happy :D](./images/smilies/icon_biggrin.gif)
I created a tool to zoom a image on top of another image
It works fine with TImage
ZOOM and RESET on buttonaction
The complete download :
http://www.pflegeplus.com/DOWNLOADS/Imgzoom3.zip
My tests RESET, ZOOM + and ZOOM -
![Image](http://www.pflegeplus.com/IMAGES/Zoom4.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom5.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom6.jpg)
![Image](http://www.pflegeplus.com/IMAGES/Zoom7.jpg)
best regards
Uwe
![Very Happy :D](./images/smilies/icon_biggrin.gif)
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.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: TImage zoom
Beautiful, but not exactly what I wanted. My TImage stretch to fit the dialog. I would like to cut, more or less, TImage rectangle and stretch it to fit the dialog.
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: TImage zoom
There is a TImage object (not xImage). As you can zoom/unzoom it ?
Yes, TImage has a Method Zoom( nZoom )
not exactly what I wanted. My TImage stretch to fit the dialog. I would like to cut, more or less, TImage rectangle and stretch it to fit the dialog.
Keep aside classes like TImage or TXImage. Please explain what exactly you want to do. May be there is totally a different and simpler way to achieve what you want.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: TImage zoom
There is a picture. It is larger than the screen (so I show it in TImage stretch to full screen) . I would like to cut a larger or smaller rectangle of the picture and stretch it to fit the window (something similar is done in the example zoom2.prg)
- nageswaragunupudi
- Posts: 10721
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Been thanked: 8 times
- Contact:
Re: TImage zoom
Please try the idea of brush again but this way.
1) The image is zoomed/unzoomed just enough to cover the entire area of the window or dialog without distorting the proportion and crops the image to the extent required.
2) When used on window, the image is also resized automatically when the window is resized.
Please try the code first and decide if this serves your purpose.
Code: Select all | Expand
DEFINE BRUSH oBrush FILE "olga1.jpg" RESIZE // use your image file
DEFINE WINDOW oWnd BRUSH oBrush // window or dialog of your specified size
ACTIVATE WINDOW oWnd CENTERED
RELEASE BRUSH oBrush
1) The image is zoomed/unzoomed just enough to cover the entire area of the window or dialog without distorting the proportion and crops the image to the extent required.
2) When used on window, the image is also resized automatically when the window is resized.
Please try the code first and decide if this serves your purpose.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: TImage zoom
Thanks for the help. This program is quite normal increases/decreases the image
oImg:=TImage():New(...)
oImg:Progress(.F.)
oImg:Cargo:=0
oImg:bMouseWheel = {| nKey, nDelta, nXPos, nYPos | Test()}
procedure Test(nDelta)
local cnt
local nWidth, nHeight // The sizes TImage on dialog
local hDC
if (nDelta<0.and.oImg:Cargo-1>=0).or. (nDelta>0.and.oImg:Cargo+1<=14)
if oImg:Cargo!=0.and.nDelta<0
oImg:Refresh()
Vrt_Dlg()
endif
hDC:=GetDC(oImg:hWnd)
cnt:=oImg:Cargo+=iif(nDelta<0, -1, 1)
StretchBlt( hDC, 0, 0, nWidth, nHeight, ;
hDC, ;
30*cnt, 30*cnt, ;
nWidth-(30*cnt*2), ;
nHeight-(30*cnt*2), 13369376 )
oImg:ReleaseDC()
endif
RETURN
procedure Vrt_Dlg
local oVrt
DEFINE DIALOG oVrt FROM 0,0 TO 0,0 PIXEL
ACTIVATE DIALOG oVrt ON INIT oVrt:End()
return
oImg:=TImage():New(...)
oImg:Progress(.F.)
oImg:Cargo:=0
oImg:bMouseWheel = {| nKey, nDelta, nXPos, nYPos | Test()}
procedure Test(nDelta)
local cnt
local nWidth, nHeight // The sizes TImage on dialog
local hDC
if (nDelta<0.and.oImg:Cargo-1>=0).or. (nDelta>0.and.oImg:Cargo+1<=14)
if oImg:Cargo!=0.and.nDelta<0
oImg:Refresh()
Vrt_Dlg()
endif
hDC:=GetDC(oImg:hWnd)
cnt:=oImg:Cargo+=iif(nDelta<0, -1, 1)
StretchBlt( hDC, 0, 0, nWidth, nHeight, ;
hDC, ;
30*cnt, 30*cnt, ;
nWidth-(30*cnt*2), ;
nHeight-(30*cnt*2), 13369376 )
oImg:ReleaseDC()
endif
RETURN
procedure Vrt_Dlg
local oVrt
DEFINE DIALOG oVrt FROM 0,0 TO 0,0 PIXEL
ACTIVATE DIALOG oVrt ON INIT oVrt:End()
return