3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 08/03/2010 Created this file. :-)
20 * Creates a default pen (black, solid, width 0).
22 RS_Pen::RS_Pen(): RS_Flags()
24 setColor(RS_Color(0, 0, 0));
25 setWidth(RS2::Width00);
26 setLineType(RS2::SolidLine);
31 * Creates a pen with the given attributes.
33 RS_Pen::RS_Pen(const RS_Color & c, RS2::LineWidth w, RS2::LineType t): RS_Flags()
42 * Creates a default pen with the given flags. This is
43 * usually used to create invalid pens.
47 * RS_Pen p(RS2::FlagInvalid);
50 RS_Pen::RS_Pen(unsigned int f): RS_Flags(f)
52 setColor(RS_Color(0, 0, 0));
53 setWidth(RS2::Width00);
54 setLineType(RS2::SolidLine);
58 /*virtual*/ RS_Pen::~RS_Pen()
62 RS2::LineType RS_Pen::getLineType() const
67 void RS_Pen::setLineType(RS2::LineType t)
72 RS2::LineWidth RS_Pen::getWidth() const
77 void RS_Pen::setWidth(RS2::LineWidth w)
82 double RS_Pen::getScreenWidth() const
87 void RS_Pen::setScreenWidth(double w)
92 const RS_Color & RS_Pen::getColor() const
97 void RS_Pen::setColor(const RS_Color & c)
102 bool RS_Pen::isValid()
104 return !getFlag(RS2::FlagInvalid);
107 bool RS_Pen::operator==(const RS_Pen & p) const
109 return (lineType == p.lineType && width == p.width && color == p.color);
112 bool RS_Pen::operator!=(const RS_Pen & p) const
114 return !(*this == p);
117 /*friend*/ std::ostream & operator<<(std::ostream & os, const RS_Pen & p)
119 //os << "style: " << p.style << std::endl;
120 os << " pen color: " << p.getColor()
121 << " pen width: " << p.getWidth()
122 << " pen screen width: " << p.getScreenWidth()
123 << " pen line type: " << p.getLineType()
124 << " flags: " << (p.getFlag(RS2::FlagInvalid) ? "INVALID" : "")