Hi,
Now everyone who use WIN_PRN class has to link his code
with PNG library even if it's unnecessary.
PNG library is used in win_BitMapDimensions, now is not used in WIN_PRN class
to print win_BMPs class.
Note that now it's a RAW implementation driver dependent and some drivers don't
need the original dimensions to work.
Unfortunately the PNG support is few used in win drivers.
win_BitMapDimensions works fine and can be nice changed win_BMP class with
attache sample prg.
Perhaps in future, we can change it to not RAW driver dependent and convert these formats into DIB plane but now, I don't know
how do it and if this is correct.
What do you think about?
Best regards,
Xavi
CREATE CLASS WIN_BMP
EXPORTED:
METHOD New()
METHOD LoadFile( cFileName, aDimXY )
METHOD Create()
METHOD Destroy()
METHOD IsSupported( oPrn, nError )
METHOD Draw( oPrn, aRectangle, nError )
VAR Type INIT 0 // Type BitMap: 1 == BM, 2 == JPEG, 3
== PNG
VAR DimXY INIT { 0, 0 } // Image Dimensions X Y pixels
VAR Rect INIT { 0, 0, 0, 0 } // Coordinates to print BitMap
// XDest, //
x-coord of destination upper-left corner
// YDest, //
y-coord of destination upper-left corner
// nDestWidth, // width
of destination rectangle
// nDestHeight, //
height of destination rectangle
// See WinApi StretchDIBits()
VAR BitMap INIT ""
VAR FileName INIT ""
ENDCLASS
METHOD New() CLASS WIN_BMP
RETURN Self
METHOD LoadFile( cFileName, aDimXY ) CLASS WIN_BMP
::FileName := cFileName
::Bitmap := win_LoadBitMapFile( ::FileName )
IF Empty( ::Bitmap )
::Type := 0
::DimXY := { 0, 0 }
ELSE
::Type := win_bitmapType( ::Bitmap )
IF ISARRAY( aDimXY )
::DimXY := aDimXY
ELSEIF ! win_BitMapDimensions( ::Bitmap, @::DimXY[1], @::DimXY[2] )
::DimXY := { 1, 1 } // Driver may use the original dimensions
ENDIF
ENDIF
RETURN ::Type != HB_WIN_BITMAP_UNKNOWN
METHOD Create() CLASS WIN_BMP // Compatibility function for Alaska Xbase++
RETURN Self
METHOD Destroy() CLASS WIN_BMP // Compatibility function for Alaska Xbase++
RETURN NIL
METHOD IsSupported( oPrn, nError ) CLASS WIN_BMP
RETURN ( nError := win_BitmapIsSupported( oPrn:hPrinterDc, ::Bitmap ) ) == 0
METHOD Draw( oPrn, aRectangle, nError ) CLASS WIN_BMP // Pass a WIN_PRN object
reference & Rectangle array
IF ISARRAY( aRectangle )
::Rect := aRectangle
ENDIF
RETURN IIF( ::IsSupported( oPrn, @nError ), oPrn:DrawBitMap( Self ), .F. )
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour