Loading...
Searching...
No Matches
BlendMode.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 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#pragma once
26
28// Headers
31
32
33namespace sf
34{
35
126
137[[nodiscard]] SFML_GRAPHICS_API bool operator==(const BlendMode& left, const BlendMode& right);
138
149[[nodiscard]] SFML_GRAPHICS_API bool operator!=(const BlendMode& left, const BlendMode& right);
150
152// Commonly used blending modes
154// NOLINTBEGIN(readability-identifier-naming)
161// NOLINTEND(readability-identifier-naming)
162
163} // namespace sf
164
165
#define SFML_GRAPHICS_API
const BlendMode BlendMin
Take minimum between source and dest.
const BlendMode BlendAlpha
Blend source and dest according to dest alpha.
const BlendMode BlendAdd
Add source to dest.
const BlendMode BlendMax
Take maximum between source and dest.
const BlendMode BlendNone
Overwrite dest with source.
const BlendMode BlendMultiply
Multiply source and dest.
bool operator==(const BlendMode &left, const BlendMode &right)
Overload of the operator==
Factor colorSrcFactor
Source blending factor for the color channels.
BlendMode()=default
Default constructor.
Equation alphaEquation
Blending equation for the alpha channel.
BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor, Equation colorBlendEquation, Factor alphaSourceFactor, Factor alphaDestinationFactor, Equation alphaBlendEquation)
Construct the blend mode given the factors and equation.
BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation=Equation::Add)
Construct the blend mode given the factors and equation.
Equation
Enumeration of the blending equations.
Definition BlendMode.hpp:69
@ Subtract
Pixel = Src * SrcFactor - Dst * DstFactor.
Definition BlendMode.hpp:71
@ Max
Pixel = max(Dst, Src)
Definition BlendMode.hpp:74
@ Min
Pixel = min(Dst, Src)
Definition BlendMode.hpp:73
@ ReverseSubtract
Pixel = Dst * DstFactor - Src * SrcFactor.
Definition BlendMode.hpp:72
@ Add
Pixel = Src * SrcFactor + Dst * DstFactor.
Definition BlendMode.hpp:70
Factor alphaSrcFactor
Source blending factor for the alpha channel.
Factor alphaDstFactor
Destination blending factor for the alpha channel.
Factor colorDstFactor
Destination blending factor for the color channels.
Equation colorEquation
Blending equation for the color channels.
bool operator!=(const BlendMode &left, const BlendMode &right)
Overload of the operator!=
Factor
Enumeration of the blending factors.
Definition BlendMode.hpp:49
@ One
(1, 1, 1, 1)
Definition BlendMode.hpp:51
@ OneMinusSrcColor
(1, 1, 1, 1) - (src.r, src.g, src.b, src.a)
Definition BlendMode.hpp:53
@ OneMinusDstColor
(1, 1, 1, 1) - (dst.r, dst.g, dst.b, dst.a)
Definition BlendMode.hpp:55
@ SrcColor
(src.r, src.g, src.b, src.a)
Definition BlendMode.hpp:52
@ OneMinusDstAlpha
(1, 1, 1, 1) - (dst.a, dst.a, dst.a, dst.a)
Definition BlendMode.hpp:59
@ OneMinusSrcAlpha
(1, 1, 1, 1) - (src.a, src.a, src.a, src.a)
Definition BlendMode.hpp:57
@ SrcAlpha
(src.a, src.a, src.a, src.a)
Definition BlendMode.hpp:56
@ Zero
(0, 0, 0, 0)
Definition BlendMode.hpp:50
@ DstAlpha
(dst.a, dst.a, dst.a, dst.a)
Definition BlendMode.hpp:58
@ DstColor
(dst.r, dst.g, dst.b, dst.a)
Definition BlendMode.hpp:54