#include "fivewin.ch"
//----------------------------------------------------------------------------//
function Main()
local aImages, oWnd, oFont, oBrush, oBrw, oImage
FW_SetUnicode( .t. )
HB_SETCODEPAGE( "UTF8" ) // Harbour (not xHarbour) to display unicode filenames
aImages := ReadFolder()
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
DEFINE BRUSH oBrush FILE "..\bitmaps\backgrnd\stone.bmp"
DEFINE WINDOW oWnd
oWnd:SetFont( oFont )
DEFINE BUTTONBAR oWnd:oBar SIZE 100,32 2007
SET MESSAGE OF oWnd TO "" 2007
DEFINE BUTTON OF oWnd:oBar PROMPT "Center" CENTER ACTION ( oImage:Center(), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Width" CENTER ACTION ( oImage:FitWidth(), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Height" CENTER ACTION ( oImage:FitHeight(), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Rect" CENTER ACTION ( oImage:FitRect(), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Rotate" CENTER ACTION ( oImage:Rotate(), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Zoom" CENTER ACTION ( MsgInfo( "Zoom/Unzoom with Mouse Wheel" ), oImage:SetFocus() )
DEFINE BUTTON OF oWnd:oBar PROMPT "Pan/Move" CENTER ACTION ( MsgInfo( "Drag with Mouse" ), oImage:SetFocus() )
@ oWnd:oBar:nHeight,0 XBROWSE oBrw SIZE 300,-oWnd:oMsgBar:nHeight ;
PIXEL OF oWnd DATASOURCE aImages COLUMNS 1 ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nStretchCol := 1
:bChange := { || oImage:Refresh() }
//
:CreateFromCode()
END
@ oWnd:oBar:nHeight,300 XIMAGE oImage SIZE 0,-oWnd:oMsgBar:nHeight ;
OF oWnd SOURCE MEMOREAD( oBrw:aRow[ 2 ] )
oImage:SetBrush( oBrush )
WITH OBJECT oWnd
:nWidth := ScreenWidth() * 0.6
:nHeight := ScreenHeight() * 0.6
END
ACTIVATE WINDOW oWnd CENTERED
RELEASE FONT oFont
RELEASE BRUSH oBrush
return nil
//----------------------------------------------------------------------------//
static function ReadFolder
local aImages := {}
local aSub := { "AlphaBmp\", "hires\", "pngs\" }
local c, cPath, aDir
for each c in aSub
cPath := "..\bitmaps\" + c
aDir := Directory( cPath + "*.*" )
AEval( aDir, { |a| If( a[ 2 ] > 32000, AAdd( aImages, { a[ 1 ], TrueName( cPath + a[ 1 ] ) } ), nil ) } )
next
ASort( aImages,,,{ |x,y| Lower( x[ 1 ] ) < Lower( y[ 1 ] ) } )
return aImages
//----------------------------------------------------------------------------//
cmsoft wrote:Asi es, ximage te da muchas buenas opciones.
// C:\FWH\SAMPLES\TESTIMG2.PRG
#include "FiveWin.ch"
FUNCTION Main()
LOCAL oDlg, oImage
DEFINE DIALOG oDlg SIZE 800, 600 PIXEL TRUEPIXEL RESIZABLE TITLE "XIMAGE"
@ 00, 30 BUTTON "SELECT" SIZE 80, 30 PIXEL OF oDlg ACTION SetImage( oImage )
@ 50, 30 XIMAGE oImage SIZE 500, 500 OF oDlg
oImage:lCanPaste := .T.
ACTIVATE DIALOG oDlg CENTERED
RETURN NIL
FUNCTION SetImage( oImage )
LOCAL cFile := cGetFile( "|*.tif|" )
LOCAL hIco, hBmp
oImage:SetSource( cFile )
RETURN NIL
/*
FUNCTION Main() // usando IMAGE
LOCAL oDlg, oImg
// DEFINE IMAGE oImg FILENAME "..\bitmaps\olga1.jpg"
DEFINE IMAGE oImg FILENAME "image.tif"
DEFINE DIALOG oDlg TITLE "Image background"
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oDlg:SetSize( oImg:nWidth, oImg:nHeight ), oDlg:Center() ) ;
ON PAINT PalBmpDraw( hDC, 0, 0, oImg:hBitmap )
oImg:End()
RETURN NIL
*/
karinha wrote:Concentra, compare você mesmo. Eu prefiro usar IMAGE.
Maurício Ventura Faria
P.S. Vai Curinthia!
And the original image is this Tiff image http://farmacia.com.br/lixo/Image.tif.
nageswaragunupudi wrote:And the original image is this Tiff image http://farmacia.com.br/lixo/Image.tif.
I am not able to get the image from this address.
if possible can you send the Tif file to my email
nageswaragunupudi [at] gmail [dot] com
#include "Fivewin.ch"
FUNCTION MAIN()
Local oWnd
LOCAL oImage
LOCAL oXImage
PARAMETER cFile
IF EMPTY(cFile)
cFile := "Image.tif"
ENDIF
DEFINE WINDOW oWnd FROM 1,1 TO GetSysMetrics(1)-400,GetSysMetrics(0)-1200 TITLE "FiveWin Images" PIXEL
@ 1,1 IMAGE oImage SIZE (oWnd:nWidth/2)-30,oWnd:nHeight-90 FILE cFile OF oWnd
oImage:nZoom := ( (oWnd:nWidth/2)-30 ) / nBmpWidth( oImage:hBitmap )
@ 14,(GetSysMetrics(0)-1200)/2 XIMAGE oXImage SIZE (oWnd:nWidth/2)-30,oWnd:nHeight-90 FILE cFile OF oWnd
oXImage:FitWidth()
ACTIVATE WINDOW oWnd
oImage:End()
Return nil
nageswaragunupudi wrote:I would like to test with TImage and TXImage and see what can be done to improve the quality.
#include "Fivewin.ch"
FUNCTION MAIN()
Local oWnd
LOCAL oImage
LOCAL oImage2
LOCAL oXImage
PARAMETER cFile
IF EMPTY(cFile)
cFile := "Image.tif"
ENDIF
DEFINE WINDOW oWnd FROM 1,1 TO GetSysMetrics(1)-400,GetSysMetrics(0)-1200 TITLE "FiveWin Images" PIXEL
@ 1,1 IMAGE oImage SIZE (oWnd:nWidth/2)-30,oWnd:nHeight-90 FILE cFile OF oWnd
oImage:nZoom := ( (oWnd:nWidth/2)-30 ) / nBmpWidth( oImage:hBitmap )
oImage2 := TImage():New(,,,,, cFile, .F., oWnd,,, .F., .F.,,, .F.,, .F.,, .F., "oImage2" )
@ 14,(GetSysMetrics(0)-1200)/2 XIMAGE oXImage SIZE (oWnd:nWidth/2)-30,oWnd:nHeight-90 SOURCE oImage2:hBitmap OF oWnd
oXImage:FitWidth()
ACTIVATE WINDOW oWnd
oImage:End()
Return nil
concentra wrote:
- Code: Select all Expand view
PARAMETER cFile
with XIMAGE and found no difference between the results using IMAGE and XIMAGE. How to reproduce the problem?
Enrico Maria Giordano wrote:concentra wrote:
- Code: Select all Expand view
PARAMETER cFile
This is a very old statement that you should never use anymore. Replace it with a LOCAL statement. Anyway, I just tested your sample with XIMAGE and found no difference between the results using IMAGE and XIMAGE. How to reproduce the problem?
// C:\FWH\SAMPLES\CONCENT4.PRG
#Include "Fivewin.ch"
STATIC oWnd
FUNCTION Main()
LOCAL oImage, oXImage, cFile := "Image.tif", oSay, oSay2
DEFINE WINDOW oWnd FROM 1, 1 TO GetSysMetrics(1)-100, GetSysMetrics(0)-200 ;
TITLE "FiveWin Images" PIXEL
@ 1, 1 SAY oSay PROMPT "This a Test: IMAGE" OF oWnd SIZE 140, 12 UPDATE ;
COLOR CLR_RED TRANSPARENT ADJUST
@ 3, 1 IMAGE oImage SIZE ( oWnd:nWidth / 2 ) - 30, oWnd:nHeight - 90 ;
FILE cFile OF oWnd // ADJUST
oImage:nZoom := ( ( oWnd:nWidth / 2 ) - 30 ) / nBmpWidth( oImage:hBitmap )
oImage:lTransparent := .T.
@ 1, 69 SAY oSay2 PROMPT "This a Test: XIMAGE" OF oWnd SIZE 140, 12 UPDATE ;
COLOR CLR_RED TRANSPARENT ADJUST
@ 40, ( GetSysMetrics( 0 ) - 200 ) / 2 XIMAGE oXImage ;
SIZE ( oWnd:nWidth / 2 ) - 30, oWnd:nHeight - 90 ;
FILE cFile OF oWnd UPDATE // NOBORDER
oXImage:FitWidth()
oXImage:nUserControl := 0
oXImage:Shadow()
oXImage:lTransparent := .T.
ACTIVATE WINDOW oWnd CENTERED
oImage:End()
RETURN NIL
// FIN / END
Enrico Maria Giordano wrote:I tested your sample and found no "white stains" on my result. Do you want to see a screenshot?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 72 guests