// C:\FWH..\SAMPLES\PRNIMAG1.PRG
#include "FiveWin.ch"
#include "Image.ch"
FUNCTION Main()
LOCAL oDlg, oImage, lSetAlpha := .T., cTitle, oFont
// SetAlpha( .f. )
SkinButtons()
cTitle := FWDESCRIPTION + ": .JPG, .JIF, .GIF, .BMP, .DIB, .RLE, .TGA, .PNG."
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 00, -12 BOLD
DEFINE DIALOG oDlg FROM 0, 0 TO 22, 60 TITLE cTitle ;
COLORS CLR_BLACK, CLR_WHITE TRANSPARENT FONT oFont
oDlg:lHelpIcon := .F.
@ 0, 0 IMAGE oImage SIZE 150, 150 OF oDlg SCROLL // ADJUST
oImage:Progress( .F. )
@ 1, 28 BUTTON "Select Image" SIZE 50, 10 ;
OF oDlg ACTION GetImage( oImage )
@ 2, 28 BUTTON "Print" SIZE 50, 10 OF oDlg ;
ACTION PrintImage( oImage )
@ 3, 28 BUTTON "Copy" SIZE 50, 10 OF oDlg ;
ACTION oImage:CopyToClipboard()
@ 4, 28 BUTTON "Paste" SIZE 50, 10 OF oDlg ;
ACTION ( oImage:LoadFromClipboard(), oImage:Refresh() )
@ 5, 28 BUTTON "Save" SIZE 50, 10 OF oDlg ;
ACTION ( oImage:SaveImage( "SAVED.JPG", 2, 25 ), ;
MsgInfo( "saved as saved.jpg" ) )
@ 6, 28 BUTTON "Exit" SIZE 50, 10 OF oDlg ACTION( oDlg:End() ) CANCEL
@ 10, 23 CHECKBOX oImage:lStretch PROMPT "Stretch" SIZE 50, 10 OF oDlg ;
ON CHANGE ( oImage:ScrollAdjust(), oImage:Refresh() )
@ 11, 23 CHECKBOX lSetAlpha PROMPT "Set Alpha Channel" SIZE 90, 10 OF oDlg ;
ON CHANGE ( SetAlpha( lSetAlpha ), oImage:Refresh() )
ACTIVATE DIALOG oDlg CENTERED
oFont:End()
RETURN NIL
FUNCTION GetImage( oImage )
LOCAL gcFile := cGetFile( "Bitmap (*.bmp)| *.bmp|" + ;
"DIB (*.dib)| *.dib|" + ;
"PCX (*.pcx)| *.pcx|" + ;
"JPEG (*.jpg)| *.jpg|" + ;
"GIF (*.gif)| *.gif|" + ;
"TARGA (*.tga)| *.tga|" + ;
"RLE (*.rle)| *.rle|" + ;
"All Files (*.*)| *.*" ;
, "Please select a image file", 4 )
IF .NOT. EMPTY( gcFile ) .AND. File( gcFile )
oImage:LoadBmp( gcFile )
ENDIF
RETURN NIL
FUNCTION PrintImage( oImage )
LOCAL oPrn, nRow := 1.00
LOCAL nLinLogo := 1.00, nColLogo := 600, nLargLogo := 650, nAltLogo := 650
PRINT oPrn NAME "Image Printing" PREVIEW MODAL
oPrn:SetPage(9)
oPrn:SetPortrait()
PAGE
/*
oPrn:PrintImage( 50, 50, oImage )
*/
/*
// oPrn:SayImage( nLinLogo, nColLogo, "LOGO.JPG", nLargLogo, nAltLogo )
*/
@ nLinLogo, nColLogo PRINT TO oPrn IMAGE oImage SIZE nLargLogo, nAltLogo LASTROW nRow
ENDPAGE
ENDPRINT
RETURN NIL
// FIN / END