Changeset 1886 in Sophya for trunk/SophyaPI/PI/pigraphgen.h
- Timestamp:
- Jan 28, 2002, 12:33:12 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PI/pigraphgen.h
r1851 r1886 15 15 #include "picolist.h" // enum PIColors 16 16 17 18 enum PILineAtt { PI_NotDefLineAtt = -1, 19 PI_NormalLine = 0, PI_ThinLine = 1, PI_ThickLine = 2 , 20 PI_DashedLine = 64, PI_ThinDashedLine = 65, PI_ThickDashedLine = 66 , 21 PI_DottedLine = 128, PI_ThinDottedLine = 129, PI_ThickDottedLine = 130 }; 22 17 // Line drawing attributes 18 enum PILineJoin { PI_JoinMiter=0, PI_JoinRound=1, PI_JoinBevel=2}; 19 enum PILineCap { PI_CapButt=0, PI_CapRound=1, PI_CapProjecting=2}; 20 enum PILineDash { PI_LineSolid, PI_LineDashed, PI_LineDotted, 21 PI_LineDashedDotted}; 22 // Predefined line types 23 enum PILineTyp { PI_NotDefLineAtt = -1, 24 PI_NormalLine, PI_ThinLine, PI_ThickLine, 25 PI_DashedLine, PI_ThinDashedLine, PI_ThickDashedLine, 26 PI_DottedLine, PI_ThinDottedLine, PI_ThickDottedLine }; 27 28 // Marker types 23 29 enum PIMarker { PI_NotDefMarker = -1, 24 30 PI_DotMarker = 0, PI_PlusMarker=1, PI_CrossMarker=2, … … 28 34 PI_StarMarker=9, PI_FStarMarker=10 }; 29 35 30 36 // ArrowMarker types (oriented markers) 37 enum PIArrowMarker { PI_NotDefArrowMarker, PI_BasicArrowMarker, 38 PI_TriangleArrowMarker, PI_FTriangleArrowMarker, 39 PI_ArrowShapedArrowMarker, PI_FArrowShapedArrowMarker }; 40 41 // Flag de positionnement 31 42 enum PIGrPosHorizontal // Flags de positionnement horizontal 32 43 // PI_HorizontalPosition regroupe l'ensemble des bits utilisables … … 66 77 }; 67 78 79 // Classe pour gerer les attributs de lignes 80 class PILineAtt { 81 public: 82 inline PILineAtt(int width=1, PILineDash dash=PI_LineSolid, 83 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt) 84 { _lwidth = width*8; _ldash=dash; _ljoincap=join+cap*256; } 85 inline PILineAtt(double width, PILineDash dash=PI_LineSolid, 86 PILineJoin join=PI_JoinMiter, PILineCap cap=PI_CapButt) 87 { _lwidth = (unsigned short)(width*8.); _ldash=dash; _ljoincap=join+cap*256; } 88 inline PILineAtt(PILineAtt const& b) 89 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; } 90 91 PILineAtt(PILineTyp ltyp); 92 93 inline ~PILineAtt() {} 94 95 inline PILineAtt& operator = (PILineAtt const& b) 96 { _lwidth=b._lwidth; _ldash=b._ldash; _ljoincap=b._ljoincap; return(*this); } 97 inline bool operator == (PILineAtt const& b) 98 { return ((_lwidth==b._lwidth)&&(_ldash==b._ldash)&&(_ljoincap==b._ljoincap)); } 99 inline bool operator == (PILineTyp ltyp) 100 { return ((*this) == PILineAtt(ltyp)); } 101 inline bool operator != (PILineAtt const& b) 102 { return (!(_lwidth==b._lwidth)&&(_ldash==b._ldash)&&(_ljoincap==b._ljoincap)); } 103 inline bool operator != (PILineTyp ltyp) 104 { return ((*this) != PILineAtt(ltyp)); } 105 106 inline int GetLineWidth() const { return (_lwidth/8); } 107 inline int GetLineWidthx8() const { return (_lwidth); } 108 inline double GetLineWidthD() const { return ((double)_lwidth/8.); } 109 inline PILineDash GetLineDash() const { return _ldash; } 110 inline PILineJoin GetLineJoin() const { return (PILineJoin)(_ljoincap%256); } 111 inline PILineCap GetLineCap() const { return (PILineCap)(_ljoincap/256); } 112 113 inline void SetLineWidth(int lw) { _lwidth = lw*8; } 114 inline void SetLineWidth(double lw) { _lwidth = (unsigned short)(lw*8.); } 115 inline void SetLineDash(PILineDash ld) { _ldash = ld; } 116 inline void SetLineJoin(PILineJoin lj) { _ljoincap = lj+(_ljoincap&0xFF00); } 117 inline void SetLineCap(PILineCap lc) { _ljoincap = lc*256+(_ljoincap&0x00FF); } 118 119 protected: 120 unsigned short _lwidth; // en 1/8 de pixels (ou points) 121 unsigned short _ljoincap; 122 PILineDash _ldash; 123 }; 124 125 // Les differents types de classes PIGraphic 68 126 enum PIGraphicsType { PI_UnknownGraphics = 0, 69 127 PI_ScrWindowGraphics = 2, PI_ScrBufferGraphics = 3, … … 88 146 // Trace graphiques 89 147 virtual void Erase(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; 148 90 149 virtual void DrawString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) = 0; 91 150 virtual void DrawOpaqueString(PIGrCoord x, PIGrCoord y, const char* s, int pos = 0) = 0; 151 virtual void DrawCompString(PIGrCoord x, PIGrCoord y, const char* s, 152 const char* s_up, const char* s_dn, int pos = 0); 153 92 154 virtual void DrawLine(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2) = 0; 93 155 virtual void DrawBox(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy) = 0; … … 103 165 virtual void DrawFArc(PIGrCoord x0, PIGrCoord y0, PIGrCoord dx, PIGrCoord dy, 104 166 double degdeb, double degfin) = 0; 167 105 168 virtual void DrawMarker(PIGrCoord x0, PIGrCoord y0) = 0; 106 169 virtual void DrawMarkers(PIGrCoord *x, PIGrCoord *y, int n) = 0; 170 virtual void DrawArrowMarker(PIGrCoord x1, PIGrCoord y1, PIGrCoord x2, PIGrCoord y2); 171 107 172 virtual void DrawPixmap(PIGrCoord x, PIGrCoord y, unsigned char *pix, 108 173 int sx, int sy, PIColorMap* cmap) = 0; … … 115 180 virtual void SelGOMode(PIGOMode mod=PI_GOCopy) = 0; 116 181 virtual void SelLine(PILineAtt att=PI_NormalLine) = 0; 182 inline void SelLine(PILineTyp lt) { SelLine(PILineAtt(lt)); } 117 183 virtual void SelMarker(int msz=3, PIMarker mrk=PI_DotMarker) = 0; 184 virtual void SelArrowMarker(int arrsz=5, 185 PIArrowMarker arrmrk=PI_BasicArrowMarker); 118 186 // Modifications de fonte 119 187 virtual void SelFont(PIFont & fnt) = 0; … … 133 201 virtual PIMarker GetMarker() = 0; 134 202 virtual int GetMarkerSize() = 0; 203 virtual PIArrowMarker GetArrowMarker(); 204 virtual int GetArrowMarkerSize(); 135 205 136 206 // Acces a la fonte et ses attributs … … 151 221 152 222 PIFont myFont; 223 PIArrowMarker myArrowMrk; 224 int myArrowMrkSz; 153 225 PIColors sFCol, sBCol; 154 226 PIGOMode sGOm; … … 158 230 PIMarker sMrk; 159 231 int sMrkSz; 232 PIArrowMarker sArrowMrk; 233 int sArrowMrkSz; 234 160 235 }; 161 236
Note:
See TracChangeset
for help on using the changeset viewer.