SFML 2.6.1

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
BlendMode.hpp
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#ifndef SFML_BLENDMODE_HPP
26#define SFML_BLENDMODE_HPP
27
29// Headers
31#include <SFML/Graphics/Export.hpp>
32
33
34 namespace sf
35{
36
41 struct SFML_GRAPHICS_API BlendMode
42{
49 enum Factor
50 {
51 Zero,
52 One,
53 SrcColor,
54 OneMinusSrcColor,
55 DstColor,
56 OneMinusDstColor,
57 SrcAlpha,
58 OneMinusSrcAlpha,
59 DstAlpha,
60 OneMinusDstAlpha
61 };
62
69 enum Equation
70 {
71 Add,
72 Subtract,
73 ReverseSubtract,
74 Min,
75 Max
76 };
77
84 BlendMode();
85
97 BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = Add);
98
110 BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor,
111 Equation colorBlendEquation, Factor alphaSourceFactor,
112 Factor alphaDestinationFactor, Equation alphaBlendEquation);
113
115 // Member Data
117 Factor colorSrcFactor;
118 Factor colorDstFactor;
119 Equation colorEquation;
120 Factor alphaSrcFactor;
121 Factor alphaDstFactor;
122 Equation alphaEquation;
123};
124
135SFML_GRAPHICS_API bool operator ==(const BlendMode& left, const BlendMode& right);
136
147SFML_GRAPHICS_API bool operator !=(const BlendMode& left, const BlendMode& right);
148
150// Commonly used blending modes
152SFML_GRAPHICS_API extern const BlendMode BlendAlpha;
153SFML_GRAPHICS_API extern const BlendMode BlendAdd;
154SFML_GRAPHICS_API extern const BlendMode BlendMultiply;
155SFML_GRAPHICS_API extern const BlendMode BlendMin;
156SFML_GRAPHICS_API extern const BlendMode BlendMax;
157SFML_GRAPHICS_API extern const BlendMode BlendNone;
158
159} // namespace sf
160
161
162#endif // SFML_BLENDMODE_HPP
163
164
sf::BlendMode
Blending modes for drawing.
Definition BlendMode.hpp:42
sf::BlendMode::BlendMode
BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation=Add)
Construct the blend mode given the factors and equation.
sf::BlendMode::colorSrcFactor
Factor colorSrcFactor
Source blending factor for the color channels.
Definition BlendMode.hpp:117
sf::BlendMode::alphaEquation
Equation alphaEquation
Blending equation for the alpha channel.
Definition BlendMode.hpp:122
sf::BlendMode::BlendMode
BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor, Equation colorBlendEquation, Factor alphaSourceFactor, Factor alphaDestinationFactor, Equation alphaBlendEquation)
Construct the blend mode given the factors and equation.
sf::BlendMode::Equation
Equation
Enumeration of the blending equations.
Definition BlendMode.hpp:70
sf::BlendMode::Subtract
@ Subtract
Pixel = Src * SrcFactor - Dst * DstFactor.
Definition BlendMode.hpp:72
sf::BlendMode::ReverseSubtract
@ ReverseSubtract
Pixel = Dst * DstFactor - Src * SrcFactor.
Definition BlendMode.hpp:73
sf::BlendMode::Add
@ Add
Pixel = Src * SrcFactor + Dst * DstFactor.
Definition BlendMode.hpp:71
sf::BlendMode::Min
@ Min
Pixel = min(Dst, Src)
Definition BlendMode.hpp:74
sf::BlendMode::BlendMode
BlendMode()
Default constructor.
sf::BlendMode::alphaSrcFactor
Factor alphaSrcFactor
Source blending factor for the alpha channel.
Definition BlendMode.hpp:120
sf::BlendMode::alphaDstFactor
Factor alphaDstFactor
Destination blending factor for the alpha channel.
Definition BlendMode.hpp:121
sf::BlendMode::colorDstFactor
Factor colorDstFactor
Destination blending factor for the color channels.
Definition BlendMode.hpp:118
sf::BlendMode::colorEquation
Equation colorEquation
Blending equation for the color channels.
Definition BlendMode.hpp:119
sf::BlendMode::Factor
Factor
Enumeration of the blending factors.
Definition BlendMode.hpp:50
sf::BlendMode::DstColor
@ DstColor
(dst.r, dst.g, dst.b, dst.a)
Definition BlendMode.hpp:55
sf::BlendMode::OneMinusSrcColor
@ OneMinusSrcColor
(1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
Definition BlendMode.hpp:54
sf::BlendMode::DstAlpha
@ DstAlpha
(dst.a, dst.a, dst.a, dst.a)
Definition BlendMode.hpp:59
sf::BlendMode::One
@ One
(1, 1, 1, 1)
Definition BlendMode.hpp:52
sf::BlendMode::OneMinusSrcAlpha
@ OneMinusSrcAlpha
(1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
Definition BlendMode.hpp:58
sf::BlendMode::SrcAlpha
@ SrcAlpha
(src.a, src.a, src.a, src.a)
Definition BlendMode.hpp:57
sf::BlendMode::OneMinusDstColor
@ OneMinusDstColor
(1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
Definition BlendMode.hpp:56
sf::BlendMode::SrcColor
@ SrcColor
(src.r, src.g, src.b, src.a)
Definition BlendMode.hpp:53
sf::BlendMode::Zero
@ Zero
(0, 0, 0, 0)
Definition BlendMode.hpp:51