haiku/src/servers/app/RGBColor.h

78 lines
1.8 KiB
C
Raw Normal View History

/*
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
*/
#ifndef RGB_COLOR_H
#define RGB_COLOR_H
#include <GraphicsDefs.h>
class RGBColor {
public:
RGBColor(uint8 r,
uint8 g,
uint8 b,
uint8 a = 255);
RGBColor(int r,
int g,
int b,
int a = 255);
RGBColor(const rgb_color& color);
RGBColor(uint16 color);
RGBColor(uint8 color);
RGBColor(const RGBColor& color);
RGBColor();
uint8 GetColor8() const;
uint16 GetColor15() const;
uint16 GetColor16() const;
rgb_color GetColor32() const;
void SetColor(uint8 r,
uint8 g,
uint8 b,
uint8 a = 255);
void SetColor(int r,
int g,
int b,
int a = 255);
void SetColor(uint16 color16);
void SetColor(uint8 color8);
void SetColor(const rgb_color& color);
void SetColor(const RGBColor& color);
const RGBColor& operator=(const RGBColor& color);
const RGBColor& operator=(const rgb_color& color);
bool operator==(const rgb_color& color) const;
bool operator==(const RGBColor& color) const;
bool operator!=(const rgb_color& color) const;
bool operator!=(const RGBColor& color) const;
* completed my changes to DrawState handling, the current DrawingState of the active ViewLayer is now always mirrored in the Painter instance of a ServerWindow, so that it doesn't need to be synced on every drawing command, this was previously incomplete for font handling * removed the DrawState parameter from all the DrawingEngine functions * adjusted ServerWindow and ServerPicture accordingly * made sure that string related functions used by non-drawing related parts (ServerApp, Decorator) don't interfere with the current drawing state * moved AS_SYNC handling from _DispatchViewMessage to _DispatchMessage, it is actually a window message and doesn't require fCurrentLayer to be valid * fixed bug #1300, fCurrentLayer was not updated when a ViewLayer was deleted by client request which happened to be fCurrentLayer (I am now handling it so that the parent becomes the current layer, could be wrong) * AGGTextRenderer is no longer using it's own scanline, which should save a few bytes RAM, the Painter already had such an object * StringWidth() in AGGTextRenderer is now taking the escapement_delta into account * Painter::StrokeLine() doesn't need to check the clipping as much, since that is already done in DrawingEngine * if a ServerWindow message is not handled because fCurrentLayer is NULL, a reply is sent in case the messages needs it (client window could freeze otherwise, waiting for the reply for ever) * removed unused AS_SET_FONT and AS_SET_FONT_SIZE * added automatic RGBColor -> rgb_color conversion to RGBColor.h * minor cleanup for 80 char/line limit git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21685 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-22 23:48:27 +04:00
// conversion to rgb_color
operator rgb_color() const
{ return fColor32; }
bool IsTransparentMagic() const;
void PrintToStream() const;
protected:
rgb_color fColor32;
// caching
mutable uint16 fColor16;
mutable uint16 fColor15;
mutable uint8 fColor8;
mutable bool fUpdate8;
mutable bool fUpdate15;
mutable bool fUpdate16;
};
#endif // RGB_COLOR_H