🛠️🐜 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.

120 lines
5.0 KiB

  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2019 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_INVALID = 0x7FFFFFFF
  47. /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
  48. } SDL_BlendMode;
  49. /**
  50. * \brief The blend operation used when combining source and destination pixel components
  51. */
  52. typedef enum
  53. {
  54. SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
  55. SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
  56. SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
  57. SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */
  58. SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */
  59. } SDL_BlendOperation;
  60. /**
  61. * \brief The normalized factor used to multiply pixel components
  62. */
  63. typedef enum
  64. {
  65. SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
  66. SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
  67. SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */
  68. SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */
  69. SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */
  70. SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */
  71. SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */
  72. SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */
  73. SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */
  74. SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */
  75. } SDL_BlendFactor;
  76. /**
  77. * \brief Create a custom blend mode, which may or may not be supported by a given renderer
  78. *
  79. * \param srcColorFactor source color factor
  80. * \param dstColorFactor destination color factor
  81. * \param colorOperation color operation
  82. * \param srcAlphaFactor source alpha factor
  83. * \param dstAlphaFactor destination alpha factor
  84. * \param alphaOperation alpha operation
  85. *
  86. * The result of the blend mode operation will be:
  87. * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
  88. * and
  89. * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
  90. */
  91. extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor,
  92. SDL_BlendFactor dstColorFactor,
  93. SDL_BlendOperation colorOperation,
  94. SDL_BlendFactor srcAlphaFactor,
  95. SDL_BlendFactor dstAlphaFactor,
  96. SDL_BlendOperation alphaOperation);
  97. /* Ends C function definitions when using C++ */
  98. #ifdef __cplusplus
  99. }
  100. #endif
  101. #include "close_code.h"
  102. #endif /* SDL_blendmode_h_ */
  103. /* vi: set ts=4 sw=4 expandtab: */