67 #ifndef _graphicsproceduralellipsemodifier_cpp
68 #define _graphicsproceduralellipsemodifier_cpp
70 #include "Graphics/Procedural/Texture/ellipsemodifier.h"
79 FillColour(1.0,1.0,1.0,1.0),
95 if( XPos < 0 || XPos >= static_cast<Integer>( Buffer.
GetWidth() ) ) {
98 if( YPos < 0 || YPos >= static_cast<Integer>( Buffer.
GetHeight() ) ) {
115 const Integer SquaredXRadius = XRadius * XRadius;
116 const Integer SquaredYRadius = YRadius * YRadius;
120 const Integer SquaredDimensions = SquaredXRadius * SquaredYRadius;
124 for(
Integer CurrX = -XRadius ; CurrX <= XRadius ; ++CurrX )
126 this->
PutPixel(XPos + CurrX,XPos,Buffer);
130 for(
Integer CurrY = 1 ; CurrY <= YRadius ; ++CurrY )
132 Integer OuterMostXCheck = OuterMostX - ( PrevDelta - 1 );
133 for( ; OuterMostXCheck > 0 ; --OuterMostXCheck )
135 if( OuterMostXCheck * OuterMostXCheck * SquaredYRadius + CurrY * CurrY * SquaredXRadius <= SquaredDimensions ) {
139 PrevDelta = OuterMostX - OuterMostXCheck;
140 OuterMostX = OuterMostXCheck;
142 for(
Integer CurrX = -OuterMostX ; CurrX <= OuterMostX ; ++CurrX )
144 this->
PutPixel(XPos + CurrX,YPos - CurrY,Buffer);
145 this->
PutPixel(XPos + CurrX,YPos + CurrY,Buffer);
186 {
return "EllipseModifier"; }
198 { this->
FillColour.
SetValues(static_cast<Real>(Red) / 255.0,static_cast<Real>(Green) / 255.0,static_cast<Real>(Blue) / 255.0,static_cast<Real>(Alpha) / 255.0);
return *
this; }
void PutPixel(const Integer XPos, const Integer YPos, TextureBuffer &Buffer)
Convenience method for placing a pixel for the ellipse.
EllipseModifier & SetYPositionAdj(const Integer Y)
Sets the absolute component of the top edge.
EllipseModifier & SetYPositionRel(const Real Y)
Sets the relative component of the top edge.
EllipseModifier & SetXRadiusAdj(const Integer X)
Sets the absolute component for the horizontal radius.
EllipseModifier & SetPosition(const Real XPositionRel, const Real YPositionRel, const Integer XPositionAdj, const Integer YPositionAdj)
Sets the relative and offset values for the ellipse position.
EllipseModifier & SetYRadiusRel(const Real Y)
Sets the relative component of the vertical radius.
Whole GetWidth() const
Get the pixel width of this texture.
int Integer
A datatype used to represent any integer close to.
EllipseModifier & SetXPositionRel(const Real X)
Sets the relative component of the left edge.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
Integer RadiusXAdj
The horizontal radius adjustment of the ellipse after relative coordinates are calculated.
Real RadiusXRel
The horizontal radius of the ellipse in relative coordinates.
Integer RadiusYAdj
The vertical radius adjustment of the ellipse after relative coordinates are calculated.
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...
virtual ~EllipseModifier()
Class destructor.
EllipseModifier & SetXPositionAdj(const Integer X)
Sets the absolute component of the left edge.
float Real
A Datatype used to represent a real floating point number.
ColourValue FillColour
The colour of the ellipse to apply to the texture.
Integer PositionXAdj
The left edge adjustment of the ellipse after relative coordinates are calculated.
Real PositionYRel
The top edge of the ellipse in relative coordinates.
EllipseModifier & SetEllipse(const Real XPosition, const Real YPosition, const Real XRadius, const Real YRadius)
Sets the relative position and radius of this ellipse..
void SetValues(const Real Red, const Real Green, const Real Blue, const Real Alpha)
Sets each of the colour channels.
A modifier that draws a simple coloured ellipse onto the texture.
Real PositionXRel
The left edge of the ellipse in relative coordinates.
A convenience buffer that stores pixel colour values of a texture to be generated.
The bulk of the engine components go in this namspace.
Whole GetHeight() const
Get the pixel height of this texture.
EllipseModifier & SetRadius(const Real XRadiusRel, const Real YRadiusRel, const Integer XRadiusAdj, const Integer YRadiusAdj)
Sets the relative and offset values for the ellipse radius.
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...
EllipseModifier & SetXRadiusRel(const Real X)
Sets the relative component of the horizontal radius.
Real RadiusYRel
The vertical radius of the ellipse in relative coordinates.
EllipseModifier & SetColour(const ColourValue &Colour)
Sets the colour of the ellipse to be generated.
virtual String GetName() const
Gets the name of this modifier.
EllipseModifier()
Blank constructor.
std::string String
A datatype used to a series of characters.
Integer PositionYAdj
The top edge adjustment of the ellipse after relative coordinates are calculated. ...
EllipseModifier & SetYRadiusAdj(const Integer Y)
Sets the absolute component for the vertical radius.