67 #ifndef _graphicsproceduralgradientgenerator_cpp
68 #define _graphicsproceduralgradientgenerator_cpp
70 #include "Graphics/Procedural/Texture/gradientgenerator.h"
79 GenTopLeftColour(0.0,0.0,1.0,1.0),
80 GenTopRightColour(0.0,1.0,0.0,1.0),
81 GenBottomLeftColour(1.0,0.0,0.0,1.0),
82 GenBottomRightColour(0.0,1.0,1.0,1.0)
101 Real D =
static_cast<Real>( X * Y ) * finv_WH;
103 Buffer.
SetRedByte( X, Y, (
UInt8)( ( ( this->
GenTopLeftColour.
RedChannel * A ) + ( this->GenTopRightColour.RedChannel * B ) + ( this->GenBottomLeftColour.RedChannel * C ) + ( this->GenBottomRightColour.RedChannel * D ) ) * 255.0 ) );
104 Buffer.
SetGreenByte( X, Y, (
UInt8)( ( ( this->
GenTopLeftColour.
GreenChannel * A ) + ( this->GenTopRightColour.GreenChannel * B ) + ( this->GenBottomLeftColour.GreenChannel * C ) + ( this->GenBottomRightColour.GreenChannel * D ) ) * 255.0 ) );
105 Buffer.
SetBlueByte( X, Y, (
UInt8)( ( ( this->
GenTopLeftColour.
BlueChannel * A ) + ( this->GenTopRightColour.BlueChannel * B ) + ( this->GenBottomLeftColour.BlueChannel * C ) + ( this->GenBottomRightColour.BlueChannel * D ) ) * 255.0 ) );
106 Buffer.
SetAlphaByte( X, Y, (
UInt8)( ( ( this->
GenTopLeftColour.
AlphaChannel * A ) + ( this->GenTopRightColour.AlphaChannel * B ) + ( this->GenBottomLeftColour.AlphaChannel * C ) + ( this->GenBottomRightColour.AlphaChannel * D ) ) * 255.0 ) );
112 {
return "GradientGenerator"; }
ColourValue GenTopLeftColour
The colour of the top-left corner.
GradientGenerator & SetBottomLeftColour(const ColourValue &Colour)
Sets the colour of the bottom-left corner.
ColourValue GenTopRightColour
The colour of the top-right corner.
void SetRedByte(const Whole X, const Whole Y, const ColourChannelType Red)
Sets the red colour value of a specified pixel. the X or Y location go beyond the set size of this te...
GradientGenerator & SetTopRightColour(const ColourValue &Colour)
Sets the colour of the top-right corner.
Whole GetWidth() const
Get the pixel width of this texture.
GradientGenerator()
Class constructor.
ColourValue GenBottomRightColour
The colour of the bottom-right corner.
GradientGenerator & SetColours(const ColourValue &TopLeft, const ColourValue &TopRight, const ColourValue &BottomLeft, const ColourValue &BottomRight)
Sets the colours of the image corners.
uint8_t UInt8
An 8-bit unsigned integer.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
virtual void AddToTextureBuffer(TextureBuffer &Buffer) const
Replaces and populates the pixels as configured in this generator to a TextureBuffer.
ColourValue GenBottomLeftColour
The colour of the bottom-left corner.
float Real
A Datatype used to represent a real floating point number.
void SetGreenByte(const Whole X, const Whole Y, const ColourChannelType Green)
Sets the green colour value of a specified pixel. the X or Y location go beyond the set size of this ...
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
Fills full image with given colour gradients.
virtual String GetName() const
Gets the name of this generator.
Real AlphaChannel
Value from 0.0 to 1.0 representing the transparency of the colours. 1.0 is opaque and 0...
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
A convenience buffer that stores pixel colour values of a texture to be generated.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
GradientGenerator & SetBottomRightColour(const ColourValue &Colour)
Sets the colour of the bottom-right corner.
Whole GetHeight() const
Get the pixel height of this texture.
Real BlueChannel
Value from 0.0 to 1.0 representing the amount of blue present in the colour. 1.0 if very blue...
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
GradientGenerator & SetTopLeftColour(const ColourValue &Colour)
Sets the colour of the top-left corner.
virtual ~GradientGenerator()
Class destructor.
void SetAlphaByte(const Whole X, const Whole Y, const ColourChannelType Alpha)
Sets the alpha colour value of a specified pixel. the X or Y location go beyond the set size of this ...
void SetBlueByte(const Whole X, const Whole Y, const ColourChannelType Blue)
Sets the blue colour value of a specified pixel. the X or Y location go beyond the set size of this t...
std::string String
A datatype used to a series of characters.