sdl_blendmode.odin 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package sdl2
  2. import "core:c"
  3. when ODIN_OS == "windows" { foreign import lib "SDL2.lib" }
  4. when ODIN_OS == "linux" { foreign import lib "system:SDL2" }
  5. when ODIN_OS == "darwin" { foreign import lib "system:SDL2" }
  6. when ODIN_OS == "freebsd" { foreign import lib "system:SDL2" }
  7. /**
  8. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
  9. */
  10. BlendMode :: enum c.int {
  11. NONE = 0x00000000, /**< no blending
  12. dstRGBA = srcRGBA */
  13. BLEND = 0x00000001, /**< alpha blending
  14. dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
  15. dstA = srcA + (dstA * (1-srcA)) */
  16. ADD = 0x00000002, /**< additive blending
  17. dstRGB = (srcRGB * srcA) + dstRGB
  18. dstA = dstA */
  19. MOD = 0x00000004, /**< color modulate
  20. dstRGB = srcRGB * dstRGB
  21. dstA = dstA */
  22. MUL = 0x00000008, /**< color multiply
  23. dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
  24. dstA = (srcA * dstA) + (dstA * (1-srcA)) */
  25. INVALID = 0x7FFFFFFF,
  26. /* Additional custom blend modes can be returned by ComposeCustomBlendMode() */
  27. }
  28. /**
  29. * \brief The blend operation used when combining source and destination pixel components
  30. */
  31. BlendOperation :: enum c.int {
  32. ADD = 0x1, /**< dst + src: supported by all renderers */
  33. SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
  34. REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
  35. MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
  36. MAXIMUM = 0x5, /**< max(dst, src) : supported by D3D11 */
  37. }
  38. /**
  39. * \brief The normalized factor used to multiply pixel components
  40. */
  41. BlendFactor :: enum c.int {
  42. ZERO = 0x1, /**< 0, 0, 0, 0 */
  43. ONE = 0x2, /**< 1, 1, 1, 1 */
  44. SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
  45. ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
  46. SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
  47. ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
  48. DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
  49. ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
  50. DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
  51. ONE_MINUS_DST_ALPHA = 0xA, /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
  52. }
  53. @(default_calling_convention="c", link_prefix="SDL_")
  54. foreign lib {
  55. ComposeCustomBlendMode :: proc(srcColorFactor, dstColorFactor: BlendFactor, colorOperation: BlendOperation,
  56. srcAlphaFactor, dstAlphaFactor: BlendFactor, alphaOperation: BlendOperation) -> BlendMode ---
  57. }