67 #ifndef _graphicsproceduralsharpenmodifier_cpp
68 #define _graphicsproceduralsharpenmodifier_cpp
70 #include "Graphics/Procedural/Texture/sharpenmodifier.h"
71 #include "Graphics/Procedural/Texture/convolutionmodifier.h"
73 #include "MathTools/mathtools.h"
108 Real Min = MathTools::Exp( static_cast<Real>(2 * Radius * Radius) / (-2.0 * fSigma * fSigma) ) / (MathTools::GetTwoPi() * fSigma * fSigma);
117 Kernel[ i * this->SharpenBlockSize + j ] =
static_cast<Integer>( ( MathTools::Exp( static_cast<Real>( X * X + Y * Y ) / ( -2.0 * fSigma * fSigma ) ) / ( MathTools::GetTwoPi() * fSigma * fSigma ) ) / Min );
118 Sum += Kernel[ i * this->SharpenBlockSize + j ];
129 if( (i == c) && (j == c) ) {
130 Kernel[ i * this->SharpenBlockSize + j ] = 2 * Sum - Kernel[ i * this->SharpenBlockSize + j ];
132 Kernel[ i * this->SharpenBlockSize + j ] = -Kernel[ i * this->SharpenBlockSize + j ];
134 Divisor += Kernel[ i * this->SharpenBlockSize + j ];
146 {
return "SharpenModifier"; }
152 { this->
Type = Sharpen;
return *
this; }
This is a 3x3 Matrix class used for representing rotations and scaling in an object.
virtual String GetName() const
Gets the name of this modifier.
int Integer
A datatype used to represent any integer close to.
UInt8 SharpenSigma
The weight surrounding pixels of the processing pixel have, with further pixels in the sample block g...
uint8_t UInt8
An 8-bit unsigned integer.
virtual ~SharpenModifier()
Class destructor.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
float Real
A Datatype used to represent a real floating point number.
A modifier that will attempt to add detail to a texture.
UInt8 SharpenBlockSize
The size of the block of pixels around each pixel to be processed that will be sampled.
SharpenType Type
The type of Sharpening 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.
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...
SharpenModifier & SetSharpenType(const SharpenType Sharpen)
Sets the type of sharpening operation to be used.
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...
Use a gaussian filter to sharpen the image.
ConvolutionModifier & SetKernel(const UInt8 Size, Real *Data)
Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel...
SharpenModifier & SetSigma(const UInt8 Sigma)
Sets the sigma for each each pixel to be processed.
SharpenModifier & SetBlockSize(const UInt8 Size)
Sets the sample size for each pixel to be processed.
Use a simple block filter to sharpen the image.
std::string String
A datatype used to a series of characters.
SharpenType
An enum used to describe the type of sharpening operation to be performed.
SharpenModifier()
Blank constructor.