9 * A pen stores attributes for painting such as line width,
10 * linetype, color, ...
12 * @author Andrew Mustun
14 class RS_Pen: public RS_Flags
18 * Creates a default pen (black, solid, width 0).
20 RS_Pen() : RS_Flags() {
21 setColor(RS_Color(0,0,0));
22 setWidth(RS2::Width00);
23 setLineType(RS2::SolidLine);
27 * Creates a pen with the given attributes.
29 RS_Pen(const RS_Color& c,
31 RS2::LineType t) : RS_Flags() {
38 * Creates a default pen with the given flags. This is
39 * usually used to create invalid pens.
43 * RS_Pen p(RS2::FlagInvalid);
46 RS_Pen(unsigned int f) : RS_Flags(f) {
47 setColor(RS_Color(0,0,0));
48 setWidth(RS2::Width00);
49 setLineType(RS2::SolidLine);
52 //RS_Pen(const RS_Pen& pen) : RS_Flags(pen.getFlags()) {
53 // lineType = pen.lineType;
59 RS2::LineType getLineType() const {
62 void setLineType(RS2::LineType t) {
65 RS2::LineWidth getWidth() const {
68 void setWidth(RS2::LineWidth w) {
71 double getScreenWidth() const {
74 void setScreenWidth(double w) {
77 const RS_Color& getColor() const {
80 void setColor(const RS_Color& c) {
84 return !getFlag(RS2::FlagInvalid);
87 //RS_Pen& operator = (const RS_Pen& p) {
88 // lineType = p.lineType;
91 // setFlags(p.getFlags());
96 bool operator == (const RS_Pen& p) const {
97 return (lineType==p.lineType && width==p.width && color==p.color);
100 bool operator != (const RS_Pen& p) const {
104 friend std::ostream& operator << (std::ostream& os, const RS_Pen& p) {
105 //os << "style: " << p.style << std::endl;
106 os << " pen color: " << p.getColor()
107 << " pen width: " << p.getWidth()
108 << " pen screen width: " << p.getScreenWidth()
109 << " pen line type: " << p.getLineType()
110 << " flags: " << (p.getFlag(RS2::FlagInvalid) ? "INVALID" : "")
116 RS2::LineType lineType;
117 RS2::LineWidth width;