Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Attributes | List of all members
Mezzanine::Graphics::Procedural::ConvolutionModifier Class Reference

A modifier that will calculate each pixel in an image to be a weighed sum of itself and it's neighbors. More...

#include <convolutionmodifier.h>

+ Inheritance diagram for Mezzanine::Graphics::Procedural::ConvolutionModifier:
+ Collaboration diagram for Mezzanine::Graphics::Procedural::ConvolutionModifier:

Public Member Functions

 ConvolutionModifier ()
 Blank constructor.
 
virtual ~ConvolutionModifier ()
 Class destructor.
 
ConvolutionModifierCalculateDivisor ()
 Automatically generates a sane divisor for pixel processing. More...
 
virtual String GetName () const
 Gets the name of this modifier. More...
 
virtual void Modify (TextureBuffer &Buffer)
 Alters the generated pixels in a TextureBuffer. More...
 
ConvolutionModifierSetCalculateEdgeDivisor (const Boole CalculateEdge)
 Sets if a custom divisor should be use or one automatically generated during pixel processing. More...
 
ConvolutionModifierSetDivisor (const Real Div)
 Sets a custom divisor that will be applied to the result of the pixel to help keep the value within a range. More...
 
ConvolutionModifierSetIncludeAlphaChannel (const Boole IncludeAlpha)
 Sets if the alpha channel of each pixel should be processed. More...
 
ConvolutionModifierSetKernel (const UInt8 Size, Real *Data)
 Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel. More...
 
ConvolutionModifierSetKernel (const UInt8 Size, Integer *Data)
 Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel. More...
 
ConvolutionModifierSetKernel (const Matrix3x3 &Data)
 Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel. More...
 
ConvolutionModifierSetThreshold (const UInt8 Thresh)
 Sets a threshold that will force the colours of each pixel further to white or black. More...
 
- Public Member Functions inherited from Mezzanine::Graphics::Procedural::TextureModifier
 TextureModifier ()
 Blank constructor.
 
virtual ~TextureModifier ()
 Class destructor.
 

Protected Attributes

Boole CalculateEdgeDivisor
 Whether or not a dynamic divisor from pixel processing is to be used or the explicitly set divisor. More...
 
Real Divisor
 The custom value to divide the pixel result by. More...
 
Boole IncludeAlphaChannel
 Whether or not the Alpha channel is to be processed with the rest of the pixel. More...
 
RealKernelData
 The matricy to use for per-pixel processing. More...
 
UInt8 KernelSize
 The size of the set kernel. More...
 
UInt8 Threshold
 A value over 128 will force a colour closer to White, lower will force a colour closer to black. More...
 

Detailed Description

A modifier that will calculate each pixel in an image to be a weighed sum of itself and it's neighbors.

Definition at line 84 of file convolutionmodifier.h.

Member Function Documentation

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::CalculateDivisor ( )

Automatically generates a sane divisor for pixel processing.

Remarks
This method will loop over every element of the kernal and assign the sum of all it's elements to the divisor. If for any reason the sum is zero a value of 1.0 will be assigned.
Returns
Returns a reference to this.

Definition at line 267 of file convolutionmodifier.cpp.

String Mezzanine::Graphics::Procedural::ConvolutionModifier::GetName ( ) const
virtual

Gets the name of this modifier.

Returns
Returns a string containing the name of this modifier.

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 195 of file convolutionmodifier.cpp.

void Mezzanine::Graphics::Procedural::ConvolutionModifier::Modify ( TextureBuffer Buffer)
virtual

Alters the generated pixels in a TextureBuffer.

Parameters
BufferThe buffer to be modified.
Todo:
The X and Y here was originally swapped when I transposed the code from Ogre Procedural. It didn't seem right so I changed it. Who is wronger?

Implements Mezzanine::Graphics::Procedural::TextureModifier.

Definition at line 110 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetCalculateEdgeDivisor ( const Boole  CalculateEdge)

Sets if a custom divisor should be use or one automatically generated during pixel processing.

Parameters
CalculateEdgeWhether or not a dynamic divisor from pixel processing is to be used or the explicitly set divisor.
Returns
Returns a reference to this.

Definition at line 261 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::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 range.

Parameters
DivThe custom value to divide the pixel result by.
Returns
Returns a reference to this.

Definition at line 255 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetIncludeAlphaChannel ( const Boole  IncludeAlpha)

Sets if the alpha channel of each pixel should be processed.

Parameters
IncludeAlphaWhether or not the Alpha channel is to be processed with the rest of the pixel.
Returns
Returns a reference to this.

Definition at line 264 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetKernel ( const UInt8  Size,
Real Data 
)

Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel.

Remarks
This method calls CalculateDivisor() after updating the kernel. If you want to have a custom divisor set be sure to call CalculateDivisor() AFTER the call to this method.
Parameters
SizeThe row size of the square kernel to be set.
DataThe matricy to use for per-pixel processing.
Returns
Returns a reference to this.

Definition at line 201 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetKernel ( const UInt8  Size,
Integer Data 
)

Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel.

Remarks
This method calls CalculateDivisor() after updating the kernel. If you want to have a custom divisor set be sure to call CalculateDivisor() AFTER the call to this method.
Parameters
SizeThe row size of the square kernel to be set.
DataThe matricy to use for per-pixel processing.
Returns
Returns a reference to this.

Definition at line 220 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetKernel ( const Matrix3x3 Data)

Sets the matrix that determines how each pixel neighbor is to be weighed when processing each pixel.

Remarks
This method calls CalculateDivisor() after updating the kernel. If you want to have a custom divisor set be sure to call CalculateDivisor() AFTER the call to this method.
Parameters
DataA 3x3 matrix to use for per-pixel processing.
Returns
Returns a reference to this.

Definition at line 239 of file convolutionmodifier.cpp.

ConvolutionModifier & Mezzanine::Graphics::Procedural::ConvolutionModifier::SetThreshold ( const UInt8  Thresh)

Sets a threshold that will force the colours of each pixel further to white or black.

Parameters
ThreshThe threshold to use. Values over 128 will force a colour closer to White, lower will force a colour closer to black.
Returns
Returns a reference to this.

Definition at line 258 of file convolutionmodifier.cpp.

Member Data Documentation

Boole Mezzanine::Graphics::Procedural::ConvolutionModifier::CalculateEdgeDivisor
protected

Whether or not a dynamic divisor from pixel processing is to be used or the explicitly set divisor.

Definition at line 101 of file convolutionmodifier.h.

Real Mezzanine::Graphics::Procedural::ConvolutionModifier::Divisor
protected

The custom value to divide the pixel result by.

Definition at line 92 of file convolutionmodifier.h.

Boole Mezzanine::Graphics::Procedural::ConvolutionModifier::IncludeAlphaChannel
protected

Whether or not the Alpha channel is to be processed with the rest of the pixel.

Definition at line 104 of file convolutionmodifier.h.

Real* Mezzanine::Graphics::Procedural::ConvolutionModifier::KernelData
protected

The matricy to use for per-pixel processing.

Definition at line 89 of file convolutionmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::ConvolutionModifier::KernelSize
protected

The size of the set kernel.

Definition at line 95 of file convolutionmodifier.h.

UInt8 Mezzanine::Graphics::Procedural::ConvolutionModifier::Threshold
protected

A value over 128 will force a colour closer to White, lower will force a colour closer to black.

Definition at line 98 of file convolutionmodifier.h.


The documentation for this class was generated from the following files: