sdl_blendmode.odin 2.6 KB

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