Commit 5766dc1d authored by David Gobbi's avatar David Gobbi

Deprecate vtkColor::Red() getter in favor of GetRed() etc.

The Red(), Green(), Blue() methods don't follow the usual naming pattern.
If future wrappers see SetRed() and GetRed() methods, they can infer
the existence of a property called "Red", but if a method called "Red()"
already exists, this creates an ambiguity that the wrappers will have
to deal with if they do property-based wrapping.

Change-Id: I8a5fa13074512bf7b06e353a5fa7b73efe6ce039
parent ba93d90a
......@@ -119,9 +119,9 @@ int TestColorSeries( int argc, char* argv[] )
<< "i " << i << " j " << j << " c " << c << " p " << p
<< " off " << coord << " poff " << coord/3 << "\n";
*/
pix->SetValue( coord ++, color.Red() );
pix->SetValue( coord ++, color.Green() );
pix->SetValue( coord ++, color.Blue() );
pix->SetValue( coord ++, color.GetRed() );
pix->SetValue( coord ++, color.GetGreen() );
pix->SetValue( coord ++, color.GetBlue() );
}
}
}
......
......@@ -578,7 +578,7 @@ void vtkColorSeries::BuildLookupTable(vtkLookupTable* lkup)
{
vtkColor3ub colr = this->GetColor(i);
lkup->SetTableValue(
i, colr.Red() / 255., colr.Green() / 255., colr.Blue() / 255., 1.);
i, colr.GetRed()/255., colr.GetGreen()/255., colr.GetBlue()/255., 1.);
}
}
}
......
......@@ -23,6 +23,7 @@
#define __vtkColor_h
#include "vtkTuple.h"
#include "vtkObject.h" // for legacy macros
// .NAME vtkColor3 - templated base type for storage of 3 component colors.
//
......@@ -65,7 +66,6 @@ public:
// Description:
// Get the red component of the color, i.e. element 0.
const T& GetRed() const { return this->Data[0]; }
const T& Red() const { return this->Data[0]; }
// Description:
// Set the green component of the color, i.e. element 1.
......@@ -74,7 +74,6 @@ public:
// Description:
// Get the green component of the color, i.e. element 1.
const T& GetGreen() const { return this->Data[1]; }
const T& Green() const { return this->Data[1]; }
// Description:
// Set the blue component of the color, i.e. element 2.
......@@ -83,7 +82,18 @@ public:
// Description:
// Get the blue component of the color, i.e. element 2.
const T& GetBlue() const { return this->Data[2]; }
const T& Blue() const { return this->Data[2]; }
// Description:
// Legacy method for getting the red component.
VTK_LEGACY(const T& Red() const);
// Description:
// Legacy method for getting the green component.
VTK_LEGACY(const T& Green() const);
// Description:
// Legacy method for getting the blue component.
VTK_LEGACY(const T& Blue() const);
};
// .NAME vtkColor4 - templated base type for storage of 4 component colors.
......@@ -138,7 +148,6 @@ public:
// Description:
// Get the red component of the color, i.e. element 0.
const T& GetRed() const { return this->Data[0]; }
const T& Red() const { return this->Data[0]; }
// Description:
// Set the green component of the color, i.e. element 1.
......@@ -147,7 +156,6 @@ public:
// Description:
// Get the green component of the color, i.e. element 1.
const T& GetGreen() const { return this->Data[1]; }
const T& Green() const { return this->Data[1]; }
// Description:
// Set the blue component of the color, i.e. element 2.
......@@ -156,7 +164,6 @@ public:
// Description:
// Get the blue component of the color, i.e. element 2.
const T& GetBlue() const { return this->Data[2]; }
const T& Blue() const { return this->Data[2]; }
// Description:
// Set the alpha component of the color, i.e. element 3.
......@@ -165,7 +172,22 @@ public:
// Description:
// Get the alpha component of the color, i.e. element 3.
const T& GetAlpha() const { return this->Data[3]; }
const T& Alpha() const { return this->Data[3]; }
// Description:
// Legacy method for getting the red component.
VTK_LEGACY(const T& Red() const);
// Description:
// Legacy method for getting the green component.
VTK_LEGACY(const T& Green() const);
// Description:
// Legacy method for getting the blue component.
VTK_LEGACY(const T& Blue() const);
// Description:
// Legacy method for getting the alpha component.
VTK_LEGACY(const T& Alpha() const);
};
// Description:
......@@ -264,5 +286,56 @@ public:
: vtkColor4<double>(r, g, b, a) {}
};
#ifndef VTK_LEGACY_REMOVE
template<typename T>
const T& vtkColor3<T>::Red() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor3::Red, "VTK 6.0", vtkColor3::GetRed);
return this->GetRed();
}
template<typename T>
const T& vtkColor3<T>::Green() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor3::Green, "VTK 6.0", vtkColor3::GetGreen);
return this->GetGreen();
}
template<typename T>
const T& vtkColor3<T>::Blue() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor3::Blue, "VTK 6.0", vtkColor3::GetBlue);
return this->GetBlue();
}
template<typename T>
const T& vtkColor4<T>::Red() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor4::Red, "VTK 6.0", vtkColor4::GetRed);
return this->GetRed();
}
template<typename T>
const T& vtkColor4<T>::Green() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor4::Green, "VTK 6.0", vtkColor4::GetGreen);
return this->GetGreen();
}
template<typename T>
const T& vtkColor4<T>::Blue() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor4::Blue, "VTK 6.0", vtkColor4::GetBlue);
return this->GetBlue();
}
template<typename T>
const T& vtkColor4<T>::Alpha() const
{
VTK_LEGACY_REPLACED_BODY(vtkColor4::Alpha, "VTK 6.0", vtkColor4::GetAlpha);
return this->GetAlpha();
}
#endif // VTK_LEGACY_REMOVE
#endif // __vtkColor_h
// VTK-HeaderTest-Exclude: vtkColor.h
......@@ -50,7 +50,7 @@ void vtkGL2PSContextDevice2D::DrawPoly(float *f, int n, unsigned char *colors,
// Only draw the quad if custom colors are defined or alpha is non-zero.
// Postscript can't handle transparency, and the resulting output will have
// a border around every quad otherwise.
if ((colors || this->Pen->GetColorObject().Alpha() != 0) &&
if ((colors || this->Pen->GetColorObject().GetAlpha() != 0) &&
this->Pen->GetLineType() != vtkPen::NO_PEN)
{
this->Superclass::DrawPoly(f, n, colors, nc_comps);
......@@ -61,7 +61,7 @@ void vtkGL2PSContextDevice2D::DrawPoly(float *f, int n, unsigned char *colors,
void vtkGL2PSContextDevice2D::DrawPoints(float *points, int n,
unsigned char *colors, int nc_comps)
{
if (colors || this->Pen->GetColorObject().Alpha() != 0)
if (colors || this->Pen->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawPoints(points, n, colors, nc_comps);
}
......@@ -73,7 +73,7 @@ void vtkGL2PSContextDevice2D::DrawPointSprites(vtkImageData *sprite,
unsigned char *colors,
int nc_comps)
{
if (colors || this->Pen->GetColorObject().Alpha() != 0)
if (colors || this->Pen->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawPointSprites(sprite, points, n, colors, nc_comps);
}
......@@ -82,7 +82,7 @@ void vtkGL2PSContextDevice2D::DrawPointSprites(vtkImageData *sprite,
//-----------------------------------------------------------------------------
void vtkGL2PSContextDevice2D::DrawQuad(float *points, int n)
{
if (this->Brush->GetColorObject().Alpha() != 0)
if (this->Brush->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawQuad(points, n);
}
......@@ -91,7 +91,7 @@ void vtkGL2PSContextDevice2D::DrawQuad(float *points, int n)
//-----------------------------------------------------------------------------
void vtkGL2PSContextDevice2D::DrawQuadStrip(float *points, int n)
{
if (this->Brush->GetColorObject().Alpha() != 0)
if (this->Brush->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawQuadStrip(points, n);
}
......@@ -100,7 +100,7 @@ void vtkGL2PSContextDevice2D::DrawQuadStrip(float *points, int n)
//-----------------------------------------------------------------------------
void vtkGL2PSContextDevice2D::DrawPolygon(float *points, int n)
{
if (this->Brush->GetColorObject().Alpha() != 0)
if (this->Brush->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawPolygon(points, n);
}
......@@ -112,7 +112,7 @@ void vtkGL2PSContextDevice2D::DrawEllipseWedge(float x, float y,
float inRx, float inRy,
float startAngle, float stopAngle)
{
if (this->Brush->GetColorObject().Alpha() != 0)
if (this->Brush->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawEllipseWedge(x, y, outRx, outRy, inRx, inRy,
startAngle, stopAngle);
......@@ -124,7 +124,7 @@ void vtkGL2PSContextDevice2D::DrawEllipticArc(float x, float y,
float rX, float rY,
float startAngle, float stopAngle)
{
if (this->Brush->GetColorObject().Alpha() != 0)
if (this->Brush->GetColorObject().GetAlpha() != 0)
{
this->Superclass::DrawEllipticArc(x, y, rX, rY, startAngle, stopAngle);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment