67 #ifndef _graphicsproceduralcombinemodifier_cpp
68 #define _graphicsproceduralcombinemodifier_cpp
70 #include "Graphics/Procedural/Texture/combinemodifier.h"
79 CombineFilterColour(1.0,1.0,1.0,1.0)
103 for(
Whole Y = 0 ; Y < Height ; ++Y )
105 for(
Whole X = 0 ; X < Width ; ++X )
109 Whole Red =
static_cast<Whole>( TargetColour.
RedChannel * 255.0 ) + ( ( static_cast<Whole>( LayerColour.
RedChannel * 255.0 ) * RedPercent ) >> 8 );
112 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>((Red < 255) ? Red : 255), static_cast<UInt8>((Green < 255) ? Green : 255), static_cast<UInt8>((Blue < 255) ? Blue : 255), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
119 for(
Whole Y = 0 ; Y < Height ; ++Y )
121 for(
Whole X = 0 ; X < Width ; ++X )
125 Whole Red =
static_cast<Whole>( TargetColour.
RedChannel * 255.0 ) + ( ( static_cast<Whole>( LayerColour.
RedChannel * 255.0 ) * RedPercent ) >> 8 );
128 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>(Red % 255), static_cast<UInt8>(Green % 255), static_cast<UInt8>(Blue % 255), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
135 for(
Whole Y = 0 ; Y < Height ; ++Y )
137 for(
Whole X = 0 ; X < Width ; ++X )
144 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>((Red > 0) ? Red : 0), static_cast<UInt8>((Green > 0) ? Green : 0), static_cast<UInt8>((Blue > 0) ? Blue : 0), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
151 for(
Whole Y = 0 ; Y < Height ; ++Y )
153 for(
Whole X = 0 ; X < Width ; ++X )
160 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>(Red % 255), static_cast<UInt8>(Green % 255), static_cast<UInt8>(Blue % 255), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
167 for(
Whole Y = 0 ; Y < Height ; ++Y )
169 for(
Whole X = 0 ; X < Width ; ++X )
173 Whole Red =
static_cast<Whole>( TargetColour.
RedChannel * 255.0 ) * ( ( static_cast<Whole>( LayerColour.
RedChannel * 255.0 ) * RedPercent ) >> 8 );
176 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>(Red >> 8), static_cast<UInt8>(Green >> 8), static_cast<UInt8>(Blue >> 8), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
183 for(
Whole Y = 0 ; Y < Height ; ++Y )
185 for(
Whole X = 0 ; X < Width ; ++X )
189 Whole Red =
static_cast<Whole>( TargetColour.
RedChannel * 255.0 ) * ( ( static_cast<Whole>( LayerColour.
RedChannel * 255.0 ) * RedPercent ) >> 8 );
195 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>((Red < 255) ? Red : 255), static_cast<UInt8>((Green < 255) ? Green : 255), static_cast<UInt8>((Blue < 255) ? Blue : 255), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
202 for(
Whole Y = 0 ; Y < Height ; ++Y )
204 for(
Whole X = 0 ; X < Width ; ++X )
208 Whole Red =
static_cast<Whole>( TargetColour.
RedChannel * 255.0 ) + ( ( static_cast<Whole>( LayerColour.
RedChannel * 255.0 ) * RedPercent ) >> 8 );
211 Buffer.
SetPixelByte(X,Y, static_cast<UInt8>(Red >> 1), static_cast<UInt8>(Green >> 1), static_cast<UInt8>(Blue >> 1), static_cast<UInt8>( TargetColour.
AlphaChannel * 255.0 ));
218 for(
Whole Y = 0 ; Y < Height ; ++Y )
220 for(
Whole X = 0 ; X < Width ; ++X )
225 Buffer.
SetAlphaByte(X,Y,static_cast<UInt8>( Alpha >> 1 ));
233 for(
Whole Y = 0 ; Y < Height ; ++Y )
235 for(
Whole X = 0 ; X < Width ; ++X )
264 {
return "CombineModifier"; }
271 if( Layer != NULL ) {
274 NewLayer.
Mode = Mode;
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 ...
Simple addition of colours. This will generally make the result image brighter. Overflowing colour ch...
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...
Simple addition of colours. This can make the image brighter or darker, because overflowing colour ch...
CombineModifier & SetFilterColour(const ColourValue &Colour)
Sets which colour channels to filter (and by how much) from each layer texture.
As CM_Blend, but only performs the operation on the Alpha channel. Leaves other channels unmodified...
For each colour channel, add them together and divide by two. Produces the average of both textures...
Whole GetWidth() const
Get the pixel width of this texture.
Multiplication of colours. Results are then divided by 256. This can make the image brighter or darke...
int Integer
A datatype used to represent any integer close to.
CombineModifier()
Blank constructor.
virtual String GetName() const
Gets the name of this modifier.
CombineModifier & AddTexture(TextureBuffer *Layer, const CombineMode Mode)
Adds a texture to the end of the sequence to be processed.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
CombineModifier & RemoveAllTextures()
Removes all textures from all layers.
TextureBuffer * TextureLayer
A pointer to the texture that will be combined with the target texture in the modifier.
float Real
A Datatype used to represent a real floating point number.
Real GreenChannel
Value from 0.0 to 1.0 representing the amount of green present in the colour. 1.0 if very green...
CombineLayerContainer CombineLayers
A container of all the layers to be applied to the target texture in sequence.
A modifier that will attempt to combine the content of multiple textures.
CombineMode
An enum used to describe how a texture is to be combined with the other textures in the queue...
Simple subtraction of colours. This can make the image brighter or darker, because underflowing colou...
Real AlphaChannel
Value from 0.0 to 1.0 representing the transparency of the colours. 1.0 is opaque and 0...
virtual ~CombineModifier()
Class destructor.
ColourValue CombineFilterColour
The amount of colour from each layer that is to be used when combining textures.
Whole Mode
The mode that will be used to combine the specified texture with the target texture being processed b...
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
CombineLayerContainer::iterator CombineLayerIterator
Iterator type for CombineLayer instances stored by this class.
Simple subtraction of colours. This will generally make the result image darker. Underflowing colour ...
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
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...
Convenience class used by the CombineModifier class to describe what action to take with a specific t...
Real RedChannel
Value from 0.0 to 1.0 representing the amount of red present in the colour. 1.0 if very red...
void SetAlphaByte(const Whole X, const Whole Y, const ColourChannelType Alpha)
Sets the alpha 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 ProcessLayer(const CombineLayer &Layer, TextureBuffer &Buffer)
Processes a single layer to combine it with the target image.