67 #ifndef _graphicsproceduralsegmentmodifier_cpp
68 #define _graphicsproceduralsegmentmodifier_cpp
70 #include "Graphics/Procedural/Texture/segmentmodifier.h"
101 memset(Coverage, 0, Width * Height);
106 for(
Whole Y = 0 ; Y < Height ; ++Y )
108 for(
Whole X = 0 ; X < Width ; ++X )
114 Stack[StackPtr].
X = X;
115 Stack[StackPtr].
Y = Y;
119 while( StackPtr > 0 )
122 if( Coverage[Current.
X + Current.
Y * Width] != 0 ) {
126 PixelA = Buffer.
GetPixel(Current.
X, Current.
Y);
128 Stack[StackPtr].
X = Current.
X;
129 Stack[StackPtr].
Y = (Current.
Y + Height - 1) % Height;
131 Stack[StackPtr].
X = Current.
X;
132 Stack[StackPtr].
Y = (Current.
Y + 1) % Height;
134 Stack[StackPtr].
X = (Current.
X + 1) % Width;
135 Stack[StackPtr].
Y = Current.
Y ;
137 Stack[StackPtr].
X = (Current.
X + Width - 1) % Width;
138 Stack[StackPtr].
Y = Current.
Y ;
141 Coverage[Current.
X + Current.
Y * Width] = 1;
142 TempBuffer.
SetPixel(Current.
X, Current.
Y, PixelB);
146 if( Coverage[X + Y * Width] == 0 ) {
158 {
return "SegmentModifier"; }
167 { this->
Threshold = Thresh;
return *
this; }
ColourChannelType & GetPixel(const Whole X, const Whole Y, const UInt16 Component)
Gets access to the pixel at the specified position in this buffer. the X or Y location go beyond the ...
Whole GetWidth() const
Get the pixel width of this texture.
A modifier that will alter the colour of pixels above a certain luminous value.
SegmentModifier & SetColourSource(TextureBuffer *Source)
Sets the buffer to use to determine the colour to be placed.
virtual ~SegmentModifier()
Class destructor.
static ColourValue Black()
Creates a ColourValue representing the colour Black.
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...
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
Whole Y
Position on the Y axis.
Convenience class for pixel processing.
SegmentModifier & SetThreshold(const UInt8 Thresh)
Sets the threshold above which the colour from the set buffer will be copied.
virtual String GetName() const
Gets the name of this modifier.
TextureBuffer * ColourSource
The source image (buffer) to use for the replacing colour.
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.
Real BlueChannel
Value from 0.0 to 1.0 representing the amount of blue present in the colour. 1.0 if very blue...
void SetPixel(const Whole X, const Whole Y, const ColourValue &Colour)
Set colour of a specified pixel using a ColourValue. the X or Y location go beyond the set size of th...
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
SegmentModifier()
Blank constructor.
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.
UInt8 Threshold
The luminous threshold above which will have it's colour replaced.
Whole X
Position on the X axis.