I found, that printing graphics made from GDI+ are ugly when using transparent modes. GDI+ has a own EMF-format. Maybe we should use it for this!?
//----------------------------------------------------------------------------//
function png150()
local oWnd, oBar
local cPng := "http://byte-one.com/150.png"
local aPalBmp
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 80,32
DEFINE BUTTON OF oBar PROMPT "Print" CENTER ACTION PrintPng( cPng )
aPalBmp := oWnd:ReadPalBmpEx( cPng, , .t. )
ACTIVATE WINDOW oWnd ON PAINT oWnd:SayPalBmp( aPalBmp )
PalBmpFree( aPalBmp )
return nil
function PrintPng( cPng )
local oPrn
PRINT oPrn PREVIEW
PAGE
@ 4,2 PRINT TO oPrn IMAGE cPng SIZE 5,5 INCHES
ENDPAGE
ENDPRINT
return nil
But to write to a printer-hDc (oPrint-class) the same transparent circles is not possible!
function TestShapes()
local oWnd
local aShapes := {}
local aShape
// Triangle
aShape := { "Line", NARGB( 180, CLR_YELLOW ), 0, 1024, 1024, 0, 0, 1023, 0, 1023, 1023, .T. }
AAdd( aShapes, aShape )
aShape := { "Line", CLR_HRED, 3, 1024, 1024, 0, 0, 1023, 0, 1023, 1023, .T. }
AAdd( aShapes, aShape )
// Circle
aShape := { "Elli", NARGB( 128, CLR_HGREEN ), 0, 1024, 1024, 32, 32, 1023-32, 1023-32 }
AAdd( aShapes, aShape )
aShape := { "Elli", CLR_GREEN, 3, 1024, 1024, 32, 32, 1023-32, 1023-32 }
AAdd( aShapes, aShape )
// Rectangle
aShape := { "Rect", NARGB( 128, CLR_BLACK ), 0, 1024, 1024, 484, 256, 640, 1023 }
AAdd( aShapes, aShape )
aShape := { "Rect", CLR_WHITE, 6, 1024, 1024, 484, 256, 640, 1023 }
AAdd( aShapes, aShape )
DEFINE WINDOW oWnd TITLE "FWH GDI+ SHAPES"
oWnd:nHeight := 500
oWnd:nWidth := 400
@ 400,40 BUTTON "Print" SIZE 100,30 PIXEL OF oWnd ;
ACTION PrintShapes( aShapes )
ACTIVATE WINDOW oWnd CENTERED ;
ON PAINT oWnd:DrawShapes( aShapes, { 40, 40, 340, 340 } )
return nil
function PrintShapes( aShapes )
local oPrn
local hBmp
hBmp := FW_CreateBitmap( { 1024, 1024, aShapes } )
PRINT oPrn PREVIEW
PAGE
// GDI+ draw on oPrn:hDCOut
FW_DrawShapes( oPrn:hDCOut, aShapes, { 50,50,300,300 } )
// Print as GDI Bitmap
@ 4,1 PRINT TO oPrn IMAGE hBmp SIZE 4,4 INCHES
ENDPAGE
ENDPRINT
DeleteObject( hBmp )
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 79 guests