X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_pen.h;fp=src%2Fbase%2Frs_pen.h;h=4d6c9c07dad228b8a2b64885b035198d45d3c11d;hb=e5a77a32dbe17d9534d3099f1fd3fdacba199516;hp=21b3729c299d5d467034728a9789c28447e7c96b;hpb=d86611a87f46873819dfae63f1112b248ba9aca1;p=architektonas diff --git a/src/base/rs_pen.h b/src/base/rs_pen.h index 21b3729..4d6c9c0 100644 --- a/src/base/rs_pen.h +++ b/src/base/rs_pen.h @@ -9,114 +9,36 @@ * A pen stores attributes for painting such as line width, * linetype, color, ... * + * @author James Hammons * @author Andrew Mustun */ class RS_Pen: public RS_Flags { -public: - /** - * Creates a default pen (black, solid, width 0). - */ - RS_Pen() : RS_Flags() { - setColor(RS_Color(0,0,0)); - setWidth(RS2::Width00); - setLineType(RS2::SolidLine); - setScreenWidth(0); - } - /** - * Creates a pen with the given attributes. - */ - RS_Pen(const RS_Color& c, - RS2::LineWidth w, - RS2::LineType t) : RS_Flags() { - setColor(c); - setWidth(w); - setLineType(t); - setScreenWidth(0); - } - /** - * Creates a default pen with the given flags. This is - * usually used to create invalid pens. - * - * e.g.: - *
-     *   RS_Pen p(RS2::FlagInvalid);
-     * 
- */ - RS_Pen(unsigned int f) : RS_Flags(f) { - setColor(RS_Color(0,0,0)); - setWidth(RS2::Width00); - setLineType(RS2::SolidLine); - setScreenWidth(0); - } - //RS_Pen(const RS_Pen& pen) : RS_Flags(pen.getFlags()) { - // lineType = pen.lineType; - // width = pen.width; - // color = pen.color; - //} - virtual ~RS_Pen() {} - - RS2::LineType getLineType() const { - return lineType; - } - void setLineType(RS2::LineType t) { - lineType = t; - } - RS2::LineWidth getWidth() const { - return width; - } - void setWidth(RS2::LineWidth w) { - width = w; - } - double getScreenWidth() const { - return screenWidth; - } - void setScreenWidth(double w) { - screenWidth = w; - } - const RS_Color& getColor() const { - return color; - } - void setColor(const RS_Color& c) { - color = c; - } - bool isValid() { - return !getFlag(RS2::FlagInvalid); - } - - //RS_Pen& operator = (const RS_Pen& p) { - // lineType = p.lineType; - // width = p.width; - // color = p.color; - // setFlags(p.getFlags()); - - // return *this; - //} - - bool operator == (const RS_Pen& p) const { - return (lineType==p.lineType && width==p.width && color==p.color); - } - - bool operator != (const RS_Pen& p) const { - return !(*this==p); - } - - friend std::ostream& operator << (std::ostream& os, const RS_Pen& p) { - //os << "style: " << p.style << std::endl; - os << " pen color: " << p.getColor() - << " pen width: " << p.getWidth() - << " pen screen width: " << p.getScreenWidth() - << " pen line type: " << p.getLineType() - << " flags: " << (p.getFlag(RS2::FlagInvalid) ? "INVALID" : "") - << std::endl; - return os; - } - -protected: - RS2::LineType lineType; - RS2::LineWidth width; - double screenWidth; - RS_Color color; + public: + RS_Pen(); + RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t); + RS_Pen(unsigned int f); + virtual ~RS_Pen(); + + RS2::LineType getLineType() const; + void setLineType(RS2::LineType t); + RS2::LineWidth getWidth() const; + void setWidth(RS2::LineWidth w); + double getScreenWidth() const; + void setScreenWidth(double w); + const RS_Color & getColor() const; + void setColor(const RS_Color & c); + bool isValid(); + bool operator==(const RS_Pen & p) const; + bool operator!=(const RS_Pen & p) const; + + friend std::ostream & operator<<(std::ostream & os, const RS_Pen & p); + + protected: + RS2::LineType lineType; + RS2::LineWidth width; + double screenWidth; + RS_Color color; }; #endif