BlendMode.hpp
1 //
3 // SFML - Simple and Fast Multimedia Library
4 // Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
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 CPP3DS_BLENDMODE_HPP
26 #define CPP3DS_BLENDMODE_HPP
27 
28 
29 namespace cpp3ds
30 {
31 
36 struct BlendMode
37 {
44  enum Factor
45  {
46  Zero,
47  One,
56  };
57 
64  enum Equation
65  {
66  Add,
68  };
69 
76  BlendMode();
77 
89  BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = Add);
90 
102  BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor,
103  Equation colorBlendEquation, Factor alphaSourceFactor,
104  Factor alphaDestinationFactor, Equation alphaBlendEquation);
105 
107  // Member Data
115 };
116 
127 bool operator ==(const BlendMode& left, const BlendMode& right);
128 
139 bool operator !=(const BlendMode& left, const BlendMode& right);
140 
142 // Commonly used blending modes
144 extern const BlendMode BlendAlpha;
145 extern const BlendMode BlendAdd;
146 extern const BlendMode BlendMultiply;
147 extern const BlendMode BlendNone;
148 
149 }
150 
151 
152 #endif
153 
154 
(1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
Definition: BlendMode.hpp:51
Blending modes for drawing.
Definition: BlendMode.hpp:36
(1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
Definition: BlendMode.hpp:55
Factor
Enumeration of the blending factors.
Definition: BlendMode.hpp:44
Factor alphaDstFactor
Destination blending factor for the alpha channel.
Definition: BlendMode.hpp:113
Factor alphaSrcFactor
Source blending factor for the alpha channel.
Definition: BlendMode.hpp:112
(1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
Definition: BlendMode.hpp:49
(src.r, src.g, src.b, src.a)
Definition: BlendMode.hpp:48
Equation
Enumeration of the blending equations.
Definition: BlendMode.hpp:64
Factor colorDstFactor
Destination blending factor for the color channels.
Definition: BlendMode.hpp:110
Factor colorSrcFactor
Source blending factor for the color channels.
Definition: BlendMode.hpp:109
(1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
Definition: BlendMode.hpp:53
Pixel = Src * SrcFactor - Dst * DstFactor.
Definition: BlendMode.hpp:67
(dst.a, dst.a, dst.a, dst.a)
Definition: BlendMode.hpp:54
Pixel = Src * SrcFactor + Dst * DstFactor.
Definition: BlendMode.hpp:66
(src.a, src.a, src.a, src.a)
Definition: BlendMode.hpp:52
(dst.r, dst.g, dst.b, dst.a)
Definition: BlendMode.hpp:50
Equation alphaEquation
Blending equation for the alpha channel.
Definition: BlendMode.hpp:114
Equation colorEquation
Blending equation for the color channels.
Definition: BlendMode.hpp:111
BlendMode()
Default constructor.