driver.bmx 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. SuperStrict
  2. Import BRL.Pixmap
  3. Import BRL.Graphics
  4. 'modes for SetBlend
  5. Const MASKBLEND:Int=1
  6. Const SOLIDBLEND:Int=2
  7. Const ALPHABLEND:Int=3
  8. Const LIGHTBLEND:Int=4
  9. Const SHADEBLEND:Int=5
  10. 'flags for frames/images
  11. Const MASKEDIMAGE:Int= $1
  12. Const FILTEREDIMAGE:Int= $2
  13. Const MIPMAPPEDIMAGE:Int= $4
  14. Const DYNAMICIMAGE:Int= $8
  15. 'current driver
  16. Global _max2dDriver:TMax2DDriver
  17. Global _currentBoundRenderImage:TImageFrame
  18. Type TImageFrame
  19. Method Draw( x0:Float,y0:Float,x1:Float,y1:Float,tx:Float,ty:Float,sx:Float,sy:Float,sw:Float,sh:Float ) Abstract
  20. End Type
  21. Type TMax2DDriver Extends TGraphicsDriver
  22. 'Backend specific!
  23. 'implement this function in each TMax2D-extending type (OpenGL, DX, ..)
  24. Method CreateRenderImageContext:Object(g:TGraphics)
  25. Throw "Feature ~qRender2Texture~q not yet implemented in this graphics driver (" + _max2dDriver.ToString() + ")."
  26. Return Null
  27. End Method
  28. Method CreateFrameFromPixmap:TImageFrame( pixmap:TPixmap,flags:Int ) Abstract
  29. Method CreateRenderImageFrame:TImageFrame(width:UInt, height:UInt, flags:Int) Abstract
  30. Method SetBackBuffer() Abstract
  31. Method SetRenderImageFrame(RenderImageFrame:TImageFrame) Abstract
  32. Method SetBlend( blend:Int ) Abstract
  33. Method SetAlpha( alpha:Float ) Abstract
  34. Method SetColor( red:Int,green:Int,blue:Int ) Abstract
  35. Method SetClsColor( red:Int, green:Int, blue:Int, alpha:Float ) Abstract
  36. Method SetViewport( x:Int,y:Int,width:Int,height:Int ) Abstract
  37. Method SetTransform( xx:Float,xy:Float,yx:Float,yy:Float ) Abstract
  38. Method SetLineWidth( width:Float ) Abstract
  39. 'these methods rely on the abstract ones - no need to enable overriding
  40. 'them, so marked as "final"
  41. Method SetColor( color:SColor8 ) Final
  42. SetColor(color.r, color.g, color.b)
  43. End Method
  44. Method SetClsColor( color:SColor8, alpha:Float) Final
  45. SetClsColor(color.r, color.g, color.b, alpha)
  46. End Method
  47. Method Cls() Abstract
  48. Method Plot( x:Float,y:Float ) Abstract
  49. Method DrawLine( x0:Float,y0:Float,x1:Float,y1:Float,tx:Float,ty:Float ) Abstract
  50. Method DrawRect( x0:Float,y0:Float,x1:Float,y1:Float,tx:Float,ty:Float ) Abstract
  51. Method DrawOval( x0:Float,y0:Float,x1:Float,y1:Float,tx:Float,ty:Float ) Abstract
  52. Method DrawPoly( xy:Float[],handlex:Float,handley:Float,originx:Float,originy:Float, indices:Int[] ) Abstract
  53. Method DrawPixmap( pixmap:TPixmap,x:Int,y:Int ) Abstract
  54. Method GrabPixmap:TPixmap( x:Int,y:Int,width:Int,height:Int ) Abstract
  55. Method SetResolution( width:Float,height:Float ) Abstract
  56. End Type