67 #ifndef _graphicsproceduralblurmodifier_cpp
68 #define _graphicsproceduralblurmodifier_cpp
70 #include "Graphics/Procedural/Texture/blurmodifier.h"
71 #include "Graphics/Procedural/Texture/convolutionmodifier.h"
73 #include "MathTools/mathtools.h"
101 Real BlurKernel[25] = { 1, 2, 3, 2, 1, 2, 4, 5, 4, 2, 3, 5, 6, 5, 3, 2, 4, 5, 4, 2, 1, 2, 3, 2, 1 };
114 Real Min = MathTools::Exp( static_cast<Real>( 2 * Radius * Radius ) / ( -2.0 * fSigma * fSigma ) ) / ( MathTools::GetTwoPi() * fSigma * fSigma );
123 Kernel[i * this->BlurBlockSize + j] =
static_cast<Integer>( ( MathTools::Exp( (
Real)( X * X + Y * Y ) / ( -2.0 * fSigma * fSigma ) ) / ( MathTools::GetTwoPi() * fSigma * fSigma ) ) / Min );
124 Divisor += Kernel[i * this->BlurBlockSize + j];
138 {
return "BlurModifier"; }
This is a 3x3 Matrix class used for representing rotations and scaling in an object.
UInt8 BlurBlockSize
The size of the block of pixels around each pixel to be processed that will be sampled.
int Integer
A datatype used to represent any integer close to.
BlurModifier & SetBlockSize(const UInt8 Size)
Sets the sample size for each pixel to be processed.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
BlurModifier()
Blank constructor.
uint8_t UInt8
An 8-bit unsigned integer.
UInt8 BlurSigma
The weight surrounding pixels of the processing pixel have, with further pixels in the sample block g...
A modifier that will attempt to reduce the sharpness of the texture.
float Real
A Datatype used to represent a real floating point number.
BlurModifier & SetSigma(const UInt8 Sigma)
Sets the sigma for each each pixel to be processed.
virtual ~BlurModifier()
Class destructor.
BlurType Type
The type of Blur operation that will be performed.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
ConvolutionModifier & SetIncludeAlphaChannel(const Boole IncludeAlpha)
Sets if the alpha channel of each pixel should be processed.
BlurModifier & SetBlurType(const BlurType Blur)
Sets the type of bluring operation to be used.
ConvolutionModifier & SetDivisor(const Real Div)
Sets a custom divisor that will be applied to the result of the pixel to help keep the value within a...
BlurType
An enum used to describe the Blur algorithm to use.
A convenience buffer that stores pixel colour values of a texture to be generated.
ConvolutionModifier & CalculateDivisor()
Automatically generates a sane divisor for pixel processing.
The bulk of the engine components go in this namspace.
A modifier that will calculate each pixel in an image to be a weighed sum of itself and it's neighbor...
ConvolutionModifier & SetKernel(const UInt8 Size, Real *Data)
Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel...
virtual String GetName() const
Gets the name of this modifier.
std::string String
A datatype used to a series of characters.