# SFML - Simple and Fast Multimedia Library

SFML 3.0.0

- Main Page
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
StencilMode.hpp
Go to the documentation of this file.
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#pragma once
26
28// Headers
30#include <SFML/Graphics/Export.hpp>
31
32
33namespace sf
34{
35
42 enum class StencilComparison
43{
44 Never,
45 Less,
46 LessEqual,
47 Greater,
48 GreaterEqual,
49 Equal,
50 NotEqual,
51 Always
52};
53
60 enum class StencilUpdateOperation
61{
62 Keep,
63 Zero,
64 Replace,
65 Increment,
66 Decrement,
67 Invert,
68};
69
74 struct SFML_GRAPHICS_API StencilValue
75{
82 StencilValue(int theValue);
83
90 StencilValue(unsigned int theValue);
91
96 template <typename T>
97 StencilValue(T) = delete;
98
99 unsigned int value{};
100};
101
106 struct SFML_GRAPHICS_API StencilMode
107{
108 StencilComparison stencilComparison{StencilComparison::Always};
109 StencilUpdateOperation stencilUpdateOperation{
110 StencilUpdateOperation::Keep};
111 StencilValue stencilReference{0};
112 StencilValue stencilMask{~0u};
113 bool stencilOnly{};
114};
115
126[[nodiscard]] SFML_GRAPHICS_API bool operator==(const StencilMode& left, const StencilMode& right);
127
138[[nodiscard]] SFML_GRAPHICS_API bool operator!=(const StencilMode& left, const StencilMode& right);
139
140} // namespace sf
141
142
Export.hpp
SFML_GRAPHICS_API
#define SFML_GRAPHICS_API
Definition Graphics/Export.hpp:42
sf
Definition AudioResource.hpp:36
sf::StencilComparison
StencilComparison
Enumeration of the stencil test comparisons that can be performed.
Definition StencilMode.hpp:43
sf::StencilComparison::NotEqual
@ NotEqual
The stencil test passes if the new value is strictly unequal to the value in the stencil buffer.
sf::StencilComparison::Less
@ Less
The stencil test passes if the new value is less than the value in the stencil buffer.
sf::StencilComparison::Always
@ Always
The stencil test always passes.
sf::StencilComparison::Never
@ Never
The stencil test never passes.
sf::StencilComparison::GreaterEqual
@ GreaterEqual
The stencil test passes if the new value is greater than or equal to the value in the stencil buffer.
sf::StencilComparison::Greater
@ Greater
The stencil test passes if the new value is greater than the value in the stencil buffer.
sf::StencilComparison::LessEqual
@ LessEqual
The stencil test passes if the new value is less than or equal to the value in the stencil buffer.
sf::StencilComparison::Equal
@ Equal
The stencil test passes if the new value is strictly equal to the value in the stencil buffer.
sf::StencilUpdateOperation
StencilUpdateOperation
Enumeration of the stencil buffer update operations.
Definition StencilMode.hpp:61
sf::StencilUpdateOperation::Keep
@ Keep
If the stencil test passes, the value in the stencil buffer is not modified.
sf::StencilUpdateOperation::Replace
@ Replace
If the stencil test passes, the value in the stencil buffer is set to the new value.
sf::StencilUpdateOperation::Decrement
@ Decrement
If the stencil test passes, the value in the stencil buffer is decremented and if required clamped.
sf::StencilUpdateOperation::Increment
@ Increment
If the stencil test passes, the value in the stencil buffer is incremented and if required clamped.
sf::StencilUpdateOperation::Invert
@ Invert
If the stencil test passes, the value in the stencil buffer is bitwise inverted.
sf::StencilUpdateOperation::Zero
@ Zero
If the stencil test passes, the value in the stencil buffer is set to zero.
sf::StencilMode
Stencil modes for drawing.
Definition StencilMode.hpp:107
sf::StencilMode::operator==
bool operator==(const StencilMode &left, const StencilMode &right)
Overload of the operator==
sf::StencilMode::operator!=
bool operator!=(const StencilMode &left, const StencilMode &right)
Overload of the operator!=
sf::StencilValue
Stencil value type (also used as a mask)
Definition StencilMode.hpp:75
sf::StencilValue::StencilValue
StencilValue(int theValue)
Construct a stencil value from a signed integer.
sf::StencilValue::StencilValue
StencilValue(T)=delete
Disable construction from any other type.
sf::StencilValue::StencilValue
StencilValue(unsigned int theValue)
Construct a stencil value from an unsigned integer.