67 #ifndef _graphicsproceduraloilpaintmodifier_cpp
68 #define _graphicsproceduraloilpaintmodifier_cpp
70 #include "Graphics/Procedural/Texture/oilpaintmodifier.h"
95 Whole IntensitiesArray[256];
97 Whole GreenArray[256];
104 memset(IntensitiesArray, 0,
sizeof(IntensitiesArray));
105 memset(RedArray, 0,
sizeof(RedArray));
106 memset(GreenArray, 0,
sizeof(GreenArray));
107 memset(BlueArray, 0,
sizeof(BlueArray));
113 UInt16 Red = Buffer.
GetRedByte( static_cast<Whole>(X + i), static_cast<Whole>(Y + j) );
114 UInt16 Green = Buffer.
GetGreenByte( static_cast<Whole>(X + i), static_cast<Whole>(Y + j) );
115 UInt16 Blue = Buffer.
GetBlueByte( static_cast<Whole>(X + i), static_cast<Whole>(Y + j) );
118 if( CurrIntensity > 255 ) {
121 IntensitiesArray[CurrIntensity]++;
123 RedArray[CurrIntensity] += Red;
124 GreenArray[CurrIntensity] += Green;
125 BlueArray[CurrIntensity] += Blue;
129 Whole MaxIntensity = 0;
131 for(
Whole i = 0 ; i < 256 ; ++i )
133 if( IntensitiesArray[i] > MaxIntensity ) {
134 MaxIntensity = IntensitiesArray[i];
139 TempBuffer.
SetPixelByte( static_cast<Whole>(X), static_cast<Whole>(Y),
140 static_cast<UInt8>(RedArray[MaxIndex] / MaxIntensity),
141 static_cast<UInt8>(GreenArray[MaxIndex] / MaxIntensity),
142 static_cast<UInt8>(BlueArray[MaxIndex] / MaxIntensity) );
150 {
return "OilPaintModifier"; }
159 { this->
Radius = SampleRadius;
return *
this; }
OilPaintModifier & SetIntensityLevels(const Real Intensity)
Sets the allowed range of intensity levels to be used.
void SetPixelByte(const Whole X, const Whole Y, const ColourChannelType Red, const ColourChannelType Green, const ColourChannelType Blue, const ColourChannelType Alpha=255)
Set colour of a specified pixel using a 0-255 range. the X or Y location go beyond the set size of th...
Whole GetWidth() const
Get the pixel width of this texture.
OilPaintModifier()
Blank constructor.
ColourChannelType GetBlueByte(const Whole X, const Whole Y) const
Gets the blue colour value of a specified pixel. the X or Y location go beyond the set size of this t...
int Integer
A datatype used to represent any integer close to.
uint8_t UInt8
An 8-bit unsigned integer.
virtual ~OilPaintModifier()
Class destructor.
float Real
A Datatype used to represent a real floating point number.
OilPaintModifier & SetRadius(const UInt8 SampleRadius)
Sets the sample size for each processed pixel.
uint16_t UInt16
An 16-bit unsigned integer.
A modifier that will group similiar pixels together and normalize their colour.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
virtual String GetName() const
Gets the name of this modifier.
UInt8 Radius
The radius of pixels to sample for each pixel processed.
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.
Whole GetHeight() const
Get the pixel height of this texture.
ColourChannelType GetGreenByte(const Whole X, const Whole Y) const
Gets the green colour value of a specified pixel. the X or Y location go beyond the set size of this ...
std::string String
A datatype used to a series of characters.
void SetData(const TextureBuffer &Other)
Copies image data from another buffer into this buffer.
Real IntensityLevels
The range of allowed intensity levels to be allowed during processing.
ColourChannelType GetRedByte(const Whole X, const Whole Y) const
Gets the red colour value of a specified pixel. the X or Y location go beyond the set size of this te...