class EE::Graphics::BlendMode

Overview

#include <blendmode.hpp>

class BlendMode {
public:
    // enums

    enum Equation;
    enum Factor;

    // fields

    Factor colorSrcFactor;
    Factor colorDstFactor;
    Equation colorEquation;
    Factor alphaSrcFactor;
    Factor alphaDstFactor;
    Equation alphaEquation;

    // construction

    BlendMode();
    BlendMode(Factor sourceFactor, Factor destinationFactor, Equation blendEquation = BlendMode::Equation::Add);
    BlendMode(Factor colorSourceFactor, Factor colorDestinationFactor, Equation colorBlendEquation, Factor alphaSourceFactor, Factor alphaDestinationFactor, Equation alphaBlendEquation);

    // methods

    static BlendMode Alpha();
    static BlendMode Add();
    static BlendMode Multiply();
    static BlendMode None();
    static std::string equationToString(const Equation& eq);
    static std::string factorToString(const Factor& fc);
    static void setMode(const BlendMode& mode, bool force = false);
    static BlendMode getPreBlendFunc();
    std::string toString() const;
};

Detailed Documentation

Fields

Factor colorDstFactor

Source blending factor for the color channels.

Equation colorEquation

Destination blending factor for the color channels.

Factor alphaSrcFactor

Blending equation for the color channels.

Factor alphaDstFactor

Source blending factor for the alpha channel.

Equation alphaEquation

Destination blending factor for the alpha channel.

Methods

static BlendMode Add()

Blend source and dest according to dest alpha.

static BlendMode Multiply()

Add source to dest.

static BlendMode None()

Multiply source and dest.

static std::string equationToString(const Equation& eq)

Overwrite dest with source.

static void setMode(const BlendMode& mode, bool force = false)

Set a Predefined Blend Function

Parameters:

mode

The Blend Mode

force

If force to apply the blend ( no matters if the last blend was the same blend )

static BlendMode getPreBlendFunc()

Returns:

The last used predefined blend func

std::string toString() const

Blending equation for the alpha channel.