Improved documentation
This commit is contained in:
parent
fab46cdfd7
commit
330db58bc1
@ -45,6 +45,8 @@ struct SFML_GRAPHICS_API BlendMode
|
|||||||
/// \ingroup graphics
|
/// \ingroup graphics
|
||||||
/// \brief Enumeration of the blending factors
|
/// \brief Enumeration of the blending factors
|
||||||
///
|
///
|
||||||
|
/// The factors are mapped directly to their OpenGL equivalents,
|
||||||
|
/// specified by glBlendFunc() or glBlendFuncSeparate().
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
enum Factor
|
enum Factor
|
||||||
{
|
{
|
||||||
@ -64,6 +66,8 @@ struct SFML_GRAPHICS_API BlendMode
|
|||||||
/// \ingroup graphics
|
/// \ingroup graphics
|
||||||
/// \brief Enumeration of the blending equations
|
/// \brief Enumeration of the blending equations
|
||||||
///
|
///
|
||||||
|
/// The equations are mapped directly to their OpenGL equivalents,
|
||||||
|
/// specified by glBlendEquation() or glBlendEquationSeparate().
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
enum Equation
|
enum Equation
|
||||||
{
|
{
|
||||||
@ -148,27 +152,42 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone;
|
|||||||
/// \class sf::BlendMode
|
/// \class sf::BlendMode
|
||||||
/// \ingroup graphics
|
/// \ingroup graphics
|
||||||
///
|
///
|
||||||
/// sf::BlendMode is a class that represents a blend mode. A
|
/// sf::BlendMode is a class that represents a blend mode. A blend
|
||||||
/// blend mode is composed of 6 components:
|
/// mode determines how the colors of an object you draw are
|
||||||
/// \li %Color Source Factor (colorSrcFactor)
|
/// mixed with the colors that are already in the buffer.
|
||||||
/// \li %Color Destination Factor (colorDstFactor)
|
///
|
||||||
/// \li %Color Blend Equation (colorEquation)
|
/// The class is composed of 6 components, each of which has its
|
||||||
/// \li Alpha Source Factor (alphaSrcFactor)
|
/// own public member variable:
|
||||||
/// \li Alpha Destination Factor (alphaDstFactor)
|
/// \li %Color Source Factor (@ref colorSrcFactor)
|
||||||
/// \li Alpha Blend Equation (alphaEquation)
|
/// \li %Color Destination Factor (@ref colorDstFactor)
|
||||||
|
/// \li %Color Blend Equation (@ref colorEquation)
|
||||||
|
/// \li Alpha Source Factor (@ref alphaSrcFactor)
|
||||||
|
/// \li Alpha Destination Factor (@ref alphaDstFactor)
|
||||||
|
/// \li Alpha Blend Equation (@ref alphaEquation)
|
||||||
|
///
|
||||||
|
/// The source factor specifies how the pixel you are drawing contributes
|
||||||
|
/// to the final color. The destination factor specifies how the pixel
|
||||||
|
/// already drawn in the buffer contributes to the final color.
|
||||||
///
|
///
|
||||||
/// Each component has its own public member variable. These make
|
/// The color channels RGB (red, green, blue; simply referred to as
|
||||||
/// modifying a blending mode rather easy:
|
/// color) and A (alpha; the transparency) can be treated separately. This
|
||||||
|
/// separation can be useful for specific blend modes, but most often you
|
||||||
|
/// won't need it and will simply treat the color as a single unit.
|
||||||
///
|
///
|
||||||
|
/// The blend factors and equations correspond to their OpenGL equivalents.
|
||||||
|
/// In general, the color of the resulting pixel is calculated according
|
||||||
|
/// to the following formula (\a src is the color of the source pixel, \a dst
|
||||||
|
/// the color of the destination pixel, the other variables correspond to the
|
||||||
|
/// public members, with the equations being + or - operators):
|
||||||
/// \code
|
/// \code
|
||||||
/// sf::BlendMode blendMode; // Standard alpha blending
|
/// dst.rgb = colorSrcFactor * src.rgb (colorEquation) colorDstFactor * dst.rgb
|
||||||
/// blendMode.colorSrcFactor = sf::BlendMode::One; // Pre-multiplied alpha blending
|
/// dst.a = alphaSrcFactor * src.a (alphaEquation) alphaDstFactor * dst.a
|
||||||
/// blendMode.colorEquation = sf::BlendMode::Subtract; // An exotic subtraction blending mode
|
|
||||||
/// \endcode
|
/// \endcode
|
||||||
|
/// All factors and colors are represented as floating point numbers between
|
||||||
|
/// 0 and 1. Where necessary, the result is clamped to fit in that range.
|
||||||
///
|
///
|
||||||
/// The most common blending modes are defined as constants
|
/// The most common blending modes are defined as constants
|
||||||
/// in the sf namespace, for convenience and compatibility with
|
/// in the sf namespace:
|
||||||
/// older code:
|
|
||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
/// sf::BlendMode alphaBlending = sf::BlendAlpha;
|
/// sf::BlendMode alphaBlending = sf::BlendAlpha;
|
||||||
@ -177,4 +196,10 @@ SFML_GRAPHICS_API extern const BlendMode BlendNone;
|
|||||||
/// sf::BlendMode noBlending = sf::BlendNone;
|
/// sf::BlendMode noBlending = sf::BlendNone;
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
|
/// In SFML, a blend mode can be specified every time you draw a sf::Drawable
|
||||||
|
/// object to a render target. It is part of the sf::RenderStates compound
|
||||||
|
/// that is passed to the member function sf::RenderTarget::draw().
|
||||||
|
///
|
||||||
|
/// \see sf::RenderStates, sf::RenderTarget
|
||||||
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
Loading…
Reference in New Issue
Block a user