2DDrawing functions for windows
Posted: Mon Oct 10, 2005 3:31 pm
Code updated For 5.20+
i'll try to add more functions ^^
seems to work with any kind of surface (windows, images, sprites, printers...)
small example :
one more example :
Dri 
i'll try to add more functions ^^
seems to work with any kind of surface (windows, images, sprites, printers...)
Code: Select all
Procedure IsDrawing()
CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
!extern _PB_2DDrawing_Pointer
CompilerElse
!extrn _PB_2DDrawing_Pointer
CompilerEndIf
!MOV eax, dword [_PB_2DDrawing_Pointer]
ProcedureReturn
EndProcedure
Procedure DrawingSurfaceWidth()
Protected Width.l, Box.Rect
If GetClipBox_(IsDrawing(), @Box)
Width = Box\right - Box\left
EndIf
ProcedureReturn Width
EndProcedure
Procedure DrawingSurfaceHeight()
Protected Height.l, Box.Rect
If GetClipBox_(IsDrawing(), @Box)
Height = Box\bottom - Box\top
EndIf
ProcedureReturn Height
EndProcedure
Procedure Triangle(x1.l, y1.l, x2.l, y2.l, x3.l, y3.l)
ProcedureReturn Polygon_(IsDrawing(), @x1, 3)
EndProcedure
Code: Select all
OpenWindow(0, 0, 0, 320, 240, "", 0)
If StartDrawing( WindowOutput(0) )
Debug DrawingSurfaceWidth()
Debug DrawingSurfaceHeight()
StopDrawing()
EndIf
Code: Select all
If PrintRequester()
If StartPrinting("test")
If StartDrawing( PrinterOutput() )
Debug DrawingSurfaceWidth()
Debug DrawingSurfaceHeight()
Debug "---"
Debug PrinterPageWidth()
Debug PrinterPageHeight()
StopDrawing()
EndIf
StopPrinting()
EndIf
EndIf
