2012-11-29 13:16 UTC+0100 Viktor Szakats (harbour syenar.net)

* contrib/hbgd/tests/hbmk.hbm
  * contrib/hbgd/tests/animgif.prg
  * contrib/hbgd/tests/antialia.prg
  * contrib/hbgd/tests/counter.prg
  * contrib/hbgd/tests/gdtest.prg
  * contrib/hbgd/tests/gdtestcl.prg
  * contrib/hbgd/tests/tostring.prg
  * contrib/hbgd/tests/tpoly.prg
    * experiment: instead of #including "simpleio.ch" in
      most tests, I added -u+simpleio.ch to hbmk.hbm so
      it's automatically enabled for all tests.
      (need to be careful about it f.e. in /tests/ where
      some code assumes that ?/?? goes to screen, not
      stdout)

  * contrib/hbwin/tests/testprn.prg
  * contrib/hbwin/tests/testprn2.prg
  * contrib/hbwin/win_tprn.prg
    * cleanups (names, avoid QUIT, use hb_StrFormat(), etc)
This commit is contained in:
Viktor Szakats
2012-11-29 12:19:10 +00:00
parent ea055643ba
commit c9253bf306
12 changed files with 85 additions and 78 deletions

View File

@@ -10,6 +10,27 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2012-11-29 13:16 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbgd/tests/hbmk.hbm
* contrib/hbgd/tests/animgif.prg
* contrib/hbgd/tests/antialia.prg
* contrib/hbgd/tests/counter.prg
* contrib/hbgd/tests/gdtest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/tostring.prg
* contrib/hbgd/tests/tpoly.prg
* experiment: instead of #including "simpleio.ch" in
most tests, I added -u+simpleio.ch to hbmk.hbm so
it's automatically enabled for all tests.
(need to be careful about it f.e. in /tests/ where
some code assumes that ?/?? goes to screen, not
stdout)
* contrib/hbwin/tests/testprn.prg
* contrib/hbwin/tests/testprn2.prg
* contrib/hbwin/win_tprn.prg
* cleanups (names, avoid QUIT, use hb_StrFormat(), etc)
2012-11-29 01:44 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/gtwvg/gtwvg.hbc
+ added all three headers as standard one

View File

@@ -12,8 +12,6 @@
#require "hbgd"
#include "simpleio.ch"
#define IMAGES_IN "imgs_in" + hb_ps()
#define IMAGES_OUT "imgs_out" + hb_ps()
@@ -23,12 +21,12 @@ PROCEDURE Main()
LOCAL black, trans
LOCAL hFile
/*
#if 0
// Check output directory
IF ! hb_DirExists( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
#endif
/* Create the image */
im := gdImageCreate( 100, 100 )

View File

@@ -10,8 +10,6 @@
#require "hbgd"
#include "simpleio.ch"
#define IMAGES_IN "imgs_in" + hb_ps()
#define IMAGES_OUT "imgs_out" + hb_ps()
@@ -20,12 +18,12 @@ PROCEDURE Main()
LOCAL im
LOCAL white, blue
/*
#if 0
// Check output directory
IF ! hb_DirExists( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
#endif
/*
This sample shows differences on use of antiliased command between a

View File

@@ -13,8 +13,6 @@
#require "hbgd"
#include "simpleio.ch"
/* Some digits images from:
http://www.digitmania.holowww.com/all.html */

View File

@@ -10,8 +10,6 @@
#require "hbgd"
#include "simpleio.ch"
#define IMAGES_IN "imgs_in" + hb_ps()
#define IMAGES_OUT "imgs_out" + hb_ps()
@@ -21,12 +19,12 @@ PROCEDURE Main()
LOCAL black, blue, red, green, cyan
LOCAL color, font
/*
#if 0
// Check output directory
IF ! hb_DirExists( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
#endif
? gdVersion()

View File

@@ -10,8 +10,6 @@
#require "hbgd"
#include "simpleio.ch"
#define IMAGES_IN "imgs_in" + hb_ps()
#define IMAGES_OUT "imgs_out" + hb_ps()
@@ -23,12 +21,12 @@ PROCEDURE Main()
LOCAL oI5
LOCAL oB
/*
#if 0
// Check output directory
IF ! hb_DirExists( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
#endif
/* Create an image in memory */
oI := GDImage():Create( 200, 200 )

View File

@@ -5,3 +5,5 @@
hbgd.hbc
-w3 -es2
-u+simpleio.ch

View File

@@ -10,8 +10,6 @@
#require "hbgd"
#include "simpleio.ch"
#define IMAGES_IN "imgs_in" + hb_ps()
#define IMAGES_OUT "imgs_out" + hb_ps()
@@ -19,12 +17,12 @@ PROCEDURE Main()
LOCAL oI
/*
#if 0
// Check output directory
IF ! hb_DirExists( IMAGES_OUT )
DirMake( IMAGES_OUT )
ENDIF
*/
#endif
/* Load an image from file */
oI := GDImage():LoadFromFile( IMAGES_IN + "conv_tst.jpg" )

View File

@@ -8,8 +8,6 @@
#require "hbgd"
#include "simpleio.ch"
#command TurnRight( <x> ) => s_nAngle += Pi() / 3 * <x>
#command TurnLeft( <x> ) => s_nAngle -= Pi() / 3 * <x>

View File

@@ -8,28 +8,26 @@ PROCEDURE Main( cPar1 )
LOCAL nPrn := 1
LOCAL cBMPFile := Space( 40 )
LOCAL aPrn := win_printerList()
LOCAL GetList := {}
CLS
LOCAL aPrn := win_printerList()
IF Empty( aPrn )
Alert( "No printers installed - Cannot continue" )
QUIT
ELSE
DO WHILE nPrn != 0
CLS
@ 0, 0 SAY "win_Prn() Class test program. Choose a printer to test"
@ 1, 0 SAY "Bitmap file name:" GET cBMPFile PICT "@K"
READ
@ 2, 0 TO MaxRow(), MaxCol()
nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
IF nPrn != 0
PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) )
ENDIF
ENDDO
ENDIF
DO WHILE nPrn != 0
CLS
@ 0, 0 SAY "win_Prn() Class test program. Choose a printer to test"
@ 1, 0 SAY "Bitmap file name" GET cBMPFile PICT "@K"
READ
@ 2, 0 TO MaxRow(), MaxCol()
nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
IF nPrn != 0
PrnTest( aPrn[ nPrn ], cBMPFile, iif( HB_ISSTRING( cPar1 ) .AND. Lower( cPar1 ) == "ask", .T., NIL ) )
ENDIF
ENDDO
RETURN
STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
@@ -56,7 +54,7 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
ELSE
oPrinter:SetPen( WIN_PS_SOLID, 1, HB_WIN_RGB_RED )
oPrinter:Bold( WIN_FW_EXTRABOLD )
oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + Str( oPrinter:MaxRow(), 4 ) + " MaxCol() = " + Str( oPrinter:MaxCol(), 4 ) )
oPrinter:TextOut( oPrinter:PrinterName + ": MaxRow() = " + hb_ntos( oPrinter:MaxRow() ) + " MaxCol() = " + hb_ntos( oPrinter:MaxCol() ) )
oPrinter:Bold( WIN_FW_DONTCARE )
oPrinter:NewLine()
oPrinter:TextOut( " Partial list of available fonts that are available for OEM_" )
@@ -89,7 +87,7 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
oPrinter:SetPos( nColTTF )
oPrinter:TextOut( iif( aFonts[ x, 3 ], "Yes", "No" ) )
oPrinter:SetPos( nColCharSet )
oPrinter:TextOut( Str( aFonts[ x, 4 ], 5 ) )
oPrinter:TextOut( hb_ntos( aFonts[ x, 4 ] ) )
oPrinter:SetPos( oPrinter:LeftMargin, oPrinter:PosY + ( oPrinter:CharHeight * 2 ) )
IF oPrinter:PRow() > oPrinter:MaxRow() - 16 // Could use "oPrinter:NewPage()" to start a new page
EXIT
@@ -102,9 +100,9 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
oPrinter:CharSet( 0 ) // Reset default charset
oPrinter:Bold( WIN_FW_EXTRABOLD )
oPrinter:NewLine()
oPrinter:TextOut( "This is on line" + Str( oPrinter:PRow(), 4 ) + ", Printed bold, " )
oPrinter:TextOut( "This is on line" + hb_ntos( oPrinter:PRow() ) + ", Printed bold, " )
oPrinter:TextOut( " finishing at Column: " )
oPrinter:TextOut( Str( oPrinter:PCol(), 4 ) )
oPrinter:TextOut( hb_ntos( oPrinter:PCol() ) )
oPrinter:SetPRC( oPrinter:PRow() + 3, 0 )
oPrinter:Bold( WIN_FW_DONTCARE )
oPrinter:TextOut( "Notice: UNDERLINE only prints correctly if there is a blank line after", .T. )
@@ -121,11 +119,11 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
oPrinter:Ellipse( 400, oPrinter:PosY + 100, 500, oPrinter:PosY + 200 )
oPrinter:FillRect( 600, oPrinter:PosY + 100, 700, oPrinter:PosY + 200, HB_WIN_RGB_RED )
// To print a barcode;
// Replace 'BCod39HN' with your own bar code font or any other font
// oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ), oPrinter:MM_TO_POSY( 60 ), "1234567890", "BCod39HN", 24, 0 )
// To print a barcode;
// Replace "BCod39HN" with your own bar code font or any other font
// oPrinter:TextAtFont( oPrinter:MM_TO_POSX( 30 ), oPrinter:MM_TO_POSY( 60 ), "1234567890", "BCod39HN", 24, 0 )
//
PrintBitMap( oPrinter, cBMPFile )
PrintBitmap( oPrinter, cBMPFile )
oPrinter:EndDoc()
ENDIF
@@ -134,26 +132,26 @@ STATIC PROCEDURE PrnTest( cPrinter, cBMPFile, lAsk )
RETURN
STATIC PROCEDURE PrintBitMap( oPrn, cBitFile )
STATIC PROCEDURE PrintBitmap( oPrn, cBitFile )
LOCAL oBMP
IF Empty( cBitFile )
//
ELSEIF ! hb_FileExists( cBitFile )
Alert( cBitFile + " not found " )
ELSE
oBMP := win_BMP():New()
IF oBmp:loadFile( cBitFile )
oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } )
// Note: Can also use this method to print bitmap
// oBmp:Rect := { 200, 200, 2000, 1500 }
// oPrn:DrawBitMap( oBmp )
IF ! Empty( cBitFile )
IF hb_FileExists( cBitFile )
oBMP := win_BMP():New()
IF oBmp:loadFile( cBitFile )
oBmp:Draw( oPrn, { 200, 200, 2000, 1500 } )
#if 0
/* Note: Can also use this method to print bitmap */
oBmp:Rect := { 200, 200, 2000, 1500 }
oPrn:DrawBitmap( oBmp )
#endif
ENDIF
oBMP:Destroy()
ELSE
Alert( hb_StrFormat( "%1$s not found ", cBitFile ) )
ENDIF
oBMP:Destroy()
ENDIF
RETURN

View File

@@ -8,28 +8,28 @@ PROCEDURE Main()
LOCAL nPrn := 1
LOCAL cFileName := Space( 40 )
LOCAL aPrn := win_printerList()
LOCAL GetList := {}
LOCAL aPrn := win_printerList()
CLS
IF Empty( aPrn )
Alert( "No printers installed - Cannot continue" )
QUIT
ELSE
DO WHILE nPrn != 0
CLS
@ 0, 0 SAY "win_PrintFileRaw() test program. Choose a printer to test"
@ 1, 0 SAY "File name:" GET cFileName PICT "@!K"
READ
@ 2, 0 TO MaxRow(), MaxCol()
nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
IF nPrn != 0
PrnTest( aPrn[ nPrn ], cFileName )
ENDIF
ENDDO
ENDIF
DO WHILE nPrn != 0
CLS
@ 0, 0 SAY "win_PrintFileRaw() test program. Choose a printer to test"
@ 1, 0 SAY "File name" GET cFileName PICT "@!K"
READ
@ 2, 0 TO MaxRow(), MaxCol()
nPrn := AChoice( 3, 1, MaxRow() - 1, MaxCol() - 1, aPrn, .T.,, nPrn )
IF nPrn != 0
PrnTest( aPrn[ nPrn ], cFileName )
ENDIF
ENDDO
RETURN
STATIC PROCEDURE PrnTest( cPrinter, cFileName )

View File

@@ -124,7 +124,7 @@ CREATE CLASS win_Prn
METHOD GetCharHeight()
METHOD GetTextWidth( cString )
METHOD GetTextHeight( cString )
METHOD DrawBitMap( oBmp )
METHOD DrawBitmap( oBmp )
/* Clipper compatible functions. */
METHOD SetPRC( nRow, nCol ) // Based on ::LineHeight and current ::CharWidth
@@ -798,7 +798,7 @@ METHOD GetTextWidth( cString ) CLASS win_Prn
METHOD GetTextHeight( cString ) CLASS win_Prn
RETURN win_GetTextSize( ::hPrinterDC, cString, Len( cString ), .F. ) // Return Height in device units
METHOD DrawBitMap( oBmp ) CLASS win_Prn
METHOD DrawBitmap( oBmp ) CLASS win_Prn
LOCAL lResult := .F.