sdl_blendmode.odin 2.6 KB

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