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).
24 setColor(Color(0, 0, 0));
25 setWidth(RS2::Width00);
26 setLineType(RS2::SolidLine);
31 * Creates a pen with the given attributes.
33 Pen::Pen(const Color & c, RS2::LineWidth w, RS2::LineType t): Flags()
42 * Creates a default pen with the given flags. This is
43 * usually used to create invalid pens.
47 * Pen p(RS2::FlagInvalid);
50 Pen::Pen(unsigned int f): Flags(f)
52 setColor(Color(0, 0, 0));
53 setWidth(RS2::Width00);
54 setLineType(RS2::SolidLine);
58 /*virtual*/ Pen::~Pen()
62 RS2::LineType Pen::getLineType() const
67 void Pen::setLineType(RS2::LineType t)
72 RS2::LineWidth Pen::getWidth() const
77 void Pen::setWidth(RS2::LineWidth w)
82 double Pen::getScreenWidth() const
87 void Pen::setScreenWidth(double w)
92 const Color & Pen::getColor() const
97 void Pen::setColor(const Color & c)
104 return !getFlag(RS2::FlagInvalid);
107 bool Pen::operator==(const Pen & p) const
109 return (lineType == p.lineType && width == p.width && color == p.color);
112 bool Pen::operator!=(const Pen & p) const
114 return !(*this == p);
117 /*friend*/ std::ostream & operator<<(std::ostream & os, const 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" : "")