🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
5.2 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_blendmode.h
  20. *
  21. * Header file declaring the SDL_BlendMode enumeration
  22. */
  23. #ifndef SDL_blendmode_h_
  24. #define SDL_blendmode_h_
  25. #include "begin_code.h"
  26. /* Set up for C function definitions, even when using C++ */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**
  31. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
  32. */
  33. typedef enum
  34. {
  35. SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
  36. dstRGBA = srcRGBA */
  37. SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending
  38. dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA))
  39. dstA = srcA + (dstA * (1-srcA)) */
  40. SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending
  41. dstRGB = (srcRGB * srcA) + dstRGB
  42. dstA = dstA */
  43. SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
  44. dstRGB = srcRGB * dstRGB
  45. dstA = dstA */
  46. SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
  47. dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
  48. dstA = (srcA * dstA) + (dstA * (1-srcA)) */
  49. SDL_BLENDMODE_INVALID = 0x7FFFFFFF
  50. /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
  51. } SDL_BlendMode;
  52. /**
  53. * \brief The blend operation used when combining source and destination pixel components
  54. */
  55. typedef enum
  56. {
  57. SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
  58. SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
  59. SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
  60. SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
  61. SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
  62. } SDL_BlendOperation;
  63. /**
  64. * \brief The normalized factor used to multiply pixel components
  65. */
  66. typedef enum
  67. {
  68. SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
  69. SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
  70. SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
  71. SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
  72. SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
  73. SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
  74. SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
  75. SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
  76. SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
  77. SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
  78. } SDL_BlendFactor;
  79. /**
  80. * \brief Create a custom blend mode, which may or may not be supported by a given renderer
  81. *
  82. * \param srcColorFactor source color factor
  83. * \param dstColorFactor destination color factor
  84. * \param colorOperation color operation
  85. * \param srcAlphaFactor source alpha factor
  86. * \param dstAlphaFactor destination alpha factor
  87. * \param alphaOperation alpha operation
  88. *
  89. * The result of the blend mode operation will be:
  90. * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
  91. * and
  92. * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
  93. */
  94. extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
  95. SDL_BlendFactor dstColorFactor,
  96. SDL_BlendOperation colorOperation,
  97. SDL_BlendFactor srcAlphaFactor,
  98. SDL_BlendFactor dstAlphaFactor,
  99. SDL_BlendOperation alphaOperation);
  100. /* Ends C function definitions when using C++ */
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #include "close_code.h"
  105. #endif /* SDL_blendmode_h_ */
  106. /* vi: set ts=4 sw=4 expandtab: */