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