added some convinience functions to handle rgb_color additionally to RGBColor

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10898 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-01-20 14:10:11 +00:00
parent 56b6de0768
commit 7ca3c69091
2 changed files with 50 additions and 1 deletions

View File

@ -96,16 +96,22 @@ class PatternHandler {
PatternHandler(const uint64& p);
PatternHandler(const Pattern& p);
PatternHandler(const PatternHandler& other);
virtual ~PatternHandler(void);
virtual ~PatternHandler(void);
void SetPattern(const int8* p);
void SetPattern(const uint64& p);
void SetPattern(const Pattern& p);
void SetPattern(const pattern& p);
void SetColors(const RGBColor& high, const RGBColor& low);
void SetHighColor(const RGBColor& color);
void SetLowColor(const RGBColor& color);
void SetColors(const rgb_color& high, const rgb_color& low);
void SetHighColor(const rgb_color& color);
void SetLowColor(const rgb_color& color);
RGBColor HighColor() const
{ return fHighColor; }
RGBColor LowColor() const
@ -114,6 +120,8 @@ class PatternHandler {
RGBColor ColorAt(const BPoint& pt) const;
RGBColor ColorAt(float x, float y) const;
inline RGBColor ColorAt(int x, int y) const;
// TODO: any ideas for a better name of the rgb_color version of this function?
inline rgb_color R5ColorAt(int x, int y) const;
bool IsHighColor(const BPoint& pt) const;
inline bool IsHighColor(int x, int y) const;
@ -138,6 +146,18 @@ PatternHandler::ColorAt(int x, int y) const
return IsHighColor(x, y) ? fHighColor : fLowColor;
}
/*!
\brief Obtains the color in the pattern at the specified coordinates
\param x X coordinate to get the color for
\param y Y coordinate to get the color for
\return Color for the coordinates
*/
inline rgb_color
PatternHandler::R5ColorAt(int x, int y) const
{
return IsHighColor(x, y) ? fHighColor.GetColor32() : fLowColor.GetColor32();
}
/*!
\brief Obtains the value of the pattern at the specified coordinates
\param pt Coordinates to get the value for

View File

@ -179,6 +179,35 @@ void PatternHandler::SetLowColor(const RGBColor& color)
fLowColor = color;
}
/*!
\brief Set the colors for the pattern to use
\param high High color for the handler
\param low Low color for the handler
*/
void PatternHandler::SetColors(const rgb_color& high, const rgb_color& low)
{
fHighColor = high;
fLowColor = low;
}
/*!
\brief Set the high color for the pattern to use
\param color High color for the handler
*/
void PatternHandler::SetHighColor(const rgb_color& color)
{
fHighColor = color;
}
/*!
\brief Set the low color for the pattern to use
\param color Low color for the handler
*/
void PatternHandler::SetLowColor(const rgb_color& color)
{
fLowColor = color;
}
/*!
\brief Obtains the color in the pattern at the specified coordinates
\param pt Coordinates to get the color for