6 #if !defined(AFX_DRAWBASE_H__CA9A4F64_A587_44FB_A36B_8C173B304AA7__INCLUDED_)
7 #define AFX_DRAWBASE_H__CA9A4F64_A587_44FB_A36B_8C173B304AA7__INCLUDED_
11 #include "CgmObjects.h"
14 #include "Utility/wstring.h"
21 typedef struct matStr {
double m[3][3]; } matStr;
22 typedef struct mptStr {
double x, y, z; } mptStr;
24 typedef struct edgeInfo {
double y_max, y_min, Mi, B, x1, y1, x2, y2; } edgeInfo;
26 typedef struct emFillStruct {
28 double hatch_thickness,
35 long rx, ry, sx, sy, px, py;
42 long p1x, p1y, p2x, p2y;
43 double A[3], B[3], C[3], D0, dblpx, dblpy;
44 long r[3], g[3], b[3];
46 double ea, eb, ec, ed;
50 double lx1, ly1, lx2, ly2, ly_max;
65 DRect window, viewport;
99 virtual void drawDCline(CCgmBaseObj *pCgmBaseObj, DPoint *pPts,
long count,
bool close) = 0;
102 virtual void drawDCfill(CCgmBaseObj *pCgmBaseObj, DPoint *pPts,
long count) = 0;
105 virtual void drawDCGlyph(CCgmBaseObj *pCgmBaseObj, DPoint &charPos,
void* glyph,
bool fillChar,
double dScaleUp);
111 virtual void open() = 0;
114 virtual void close() = 0;
117 virtual void setDisplay(
void* pDisplay,
void* pOther = 0) = 0;
120 virtual void setTransform(DRect *window, DRect *viewport, DRect *clientRect,
double rotation = 0.0,
int originFlag = 0);
122 virtual void setHardclip(DRect *hardclip);
125 virtual void clear() = 0;
127 virtual void flush() = 0;
128 virtual void drawDCdots(CCgmBaseObj *pCgmBaseObj, DPoint *pPts,
long count) = 0;
129 virtual void unApplyClipping(CCgmBaseObj*) = 0;
130 virtual void eraseDCarea(DRect *area) = 0;
132 virtual void begAps(CAppStruct *) {
return; };
133 virtual void endAps(CAppStruct *) {
return; };
135 virtual DPoint *VdcToDPts(DPoint *pPts,
long *nPts,
bool removeDups =
false,
bool bNint =
false);
136 inline DPoint VdcToDPt(DPoint dPt,
bool bNint =
false)
145 DPt.x = ((VdcPt.x * m_vdcToCcMatrix[0][0]) + (VdcPt.y * m_vdcToCcMatrix[0][1]) + m_vdcToCcMatrix[0][2]);
146 DPt.y = ((VdcPt.x * m_vdcToCcMatrix[1][0]) + (VdcPt.y * m_vdcToCcMatrix[1][1]) + m_vdcToCcMatrix[1][2]);
156 inline DPoint VdcToDVec(DPoint dVec,
bool bNint =
false)
165 vec.x = ((vdcVec.x * m_vdcToCcMatrix[0][0]) + (vdcVec.y * m_vdcToCcMatrix[0][1]));
166 vec.y = ((vdcVec.x * m_vdcToCcMatrix[1][0]) + (vdcVec.y * m_vdcToCcMatrix[1][1]));
177 virtual LPoint *VdcToLPts(DPoint *pPts,
long *nPts,
bool removeDups =
false);
178 inline LPoint VdcToLPt(DPoint dPt)
188 LPt.x = NINT((
double)((VdcPt.x * m_vdcToCcMatrix[0][0]) + (VdcPt.y * m_vdcToCcMatrix[0][1]) +
189 m_vdcToCcMatrix[0][2]) );
190 LPt.y = NINT((
double)((VdcPt.x * m_vdcToCcMatrix[1][0]) + (VdcPt.y * m_vdcToCcMatrix[1][1]) +
191 m_vdcToCcMatrix[1][2]) );
195 inline LPoint VdcToLVec(DPoint dVec)
205 lVec.x = NINT((
double)((vdcVec.x * m_vdcToCcMatrix[0][0]) + (vdcVec.y * m_vdcToCcMatrix[0][1])) );
206 lVec.y = NINT((
double)((vdcVec.x * m_vdcToCcMatrix[1][0]) + (vdcVec.y * m_vdcToCcMatrix[1][1])) );
222 IPt.x = ININT((
double)((VdcPt.x * m_vdcToCcMatrix[0][0]) + (VdcPt.y * m_vdcToCcMatrix[0][1]) +
223 m_vdcToCcMatrix[0][2]) );
224 IPt.y = ININT((
double)((VdcPt.x * m_vdcToCcMatrix[1][0]) + (VdcPt.y * m_vdcToCcMatrix[1][1]) +
225 m_vdcToCcMatrix[1][2]) );
229 inline IPoint VdcToIVec(DPoint dVec)
239 IVec.x = ININT((
double)((vdcVec.x * m_vdcToCcMatrix[0][0]) + (vdcVec.y * m_vdcToCcMatrix[0][1])) );
240 IVec.y = ININT((
double)((vdcVec.x * m_vdcToCcMatrix[1][0]) + (vdcVec.y * m_vdcToCcMatrix[1][1])) );
245 virtual DPoint IPtToVdcPt(IPoint lPt);
246 virtual DPoint LPtToVdcPt(LPoint lPt);
247 virtual DPoint DPtToVdcPt(DPoint dcPt);
248 virtual DPoint DVecToVdcVec(DPoint dcVec);
250 virtual long WeightToCc(
double scale,
int specMode,
double scaleFactor = 1.0);
251 virtual double WeightToD(
double scale,
int specMode,
double scaleFactor = 1.0);
253 virtual double OneDcIsVdc();
255 virtual void PreProcess(CCgmObjects*,
enum ProcessFlag ) {
return; };
256 virtual void PostProcess(CCgmObjects*,
enum ProcessFlag ) {
return; };
258 void CalcTextExpFactors(CCgmText *pCgmText, CCgmText *pTextOwner, CTextExtent *pTotalExtent,
259 double *pHFac,
double *pEFac);
261 virtual void drawRect(CCgmRect *pCgmRect);
262 virtual void drawText(CCgmText *pCgmText);
263 virtual void drawPoly(CCgmPoly *pCgmPoly);
264 virtual void drawTrace(CCgmTrace *pCgmTrace);
265 virtual void drawTraceVariableAreaPos(CCgmTrace *pCgmTrace,
float m[2][3]);
266 virtual void drawTraceVariableAreaNeg(CCgmTrace *pCgmTrace,
float m[2][3]);
267 virtual void drawTraceBackground(CCgmTrace *pCgmTrace,
float m[2][3],
long flag);
268 virtual void drawEllipse(CCgmEllipse *pCgmEllipse);
269 virtual void drawCircle(CCgmCircle *pCgmCircle);
270 virtual void drawHyperbolicArc(CCgmHyperbolicArc *pCgmHyperbolicArc);
271 virtual void drawParabolicArc(CCgmParabolicArc *pCgmParabolicArc);
272 virtual void drawNurb(CCgmNurb *pCgmNurb);
273 virtual void drawTileArray(CCgmTileArray *pCgmTileArray);
274 virtual void drawFigure(CCgmFigure *pCgmFigure);
275 virtual void drawPath(CCgmBaseObj *pCgmBaseObj, Path *pPath,
bool fill);
277 virtual DPoint drawDCArrowHead(CCgmBaseObj*, DPoint* p1, DPoint* p2,
double width);
278 void emulDCline(CCgmBaseObj *pCgmBaseObj, DPoint *pDa,
long cnt,
bool close);
279 long emulDCfill(CCgmBaseObj *pCgmBaseObj, DPoint *pDa,
long cnt,
bool bCustomHatch =
false);
282 void drawDCdegen(CCgmBaseObj *pCgmBaseObj, DPoint *pts,
bool bOnePt =
true);
284 void traceBackgroundRun(CCgmTrace *pCgmTrace, DPoint P, DPoint Q, DPoint R);
286 void traceBackgroundInterpolated(CCgmTrace *pCgmTrace, DPoint P, DPoint Q, DPoint R,
float m[2][3],
bool group);
288 long traceBackgroundInterpolatedLeft2Center(CCgmTrace *pCgmTrace, DPoint P, DPoint Q, DPoint R,
289 long left,
unsigned long *left_list,
long oi,
long mid,
290 long cen,
unsigned long *cen_list,
long type,
long first,
long last,
long final,
long nC,
long nCl,
long nR,
292 long *ci,
long mc,
long cM,
long *gCol,
long nflg,
long nrep,
long csm,
long *last_cell);
294 long traceBackgroundInterpolatedCenter2Right(CCgmTrace *pCgmTrace, DPoint P, DPoint Q, DPoint R,
295 long cen,
unsigned long *cen_list,
long type,
long first,
long last,
296 long final,
long mid,
long right,
unsigned long *right_list,
long oi,
long nC,
long nCr,
long nR,
298 long *ci,
long mc,
long cM,
long *gCol,
long nflg,
long nrep,
long csm,
long *last_cell);
300 void traceBackgroundInterpolatedFlushCells(CCgmTrace *pCgmTrace,
long csm,
long *cell_count,
301 DPoint P, DPoint Q, DPoint R,
long nC,
long nR,
long *last_cell,
unsigned long *CA,
long type);
303 void setLineWidthControl(
double minimum,
double maximum,
double multiplier);
305 void setTempDir(std::wstring tempDir);
307 void setCanDrawBoth(
bool bCanDrawBoth) { m_bCanDrawBoth = bCanDrawBoth; };
309 double degreesToRadians(
double degrees);
310 double radiansToDegrees(
double radians);
311 void rotatePt(
double angle, DPoint *point);
312 void rotatePts(DPoint& center,
double angle, DPoint *points,
int npoints);
314 void setMinMarkerSize(
double size);
315 void setMinCharHeight(
double height);
317 CColor m_backgroundColor;
318 CDeviceColor m_deviceColor;
322 double m_vdcToCcMatrix[2][3];
323 double m_ccToVdcMatrix[2][3];
326 bool m_hardclipValid;
332 emFillStruct m_emFillStruct;
333 long m_nRotateHatchNPattern90;
335 long m_clippingPathIndex;
341 double m_dMultLineWidth;
351 double m_dBaseTextScaleUp;
357 std::wstring *m_psTempDir;
359 std::string encodingByType_n_Tail(
int type,
wchar_t tail);
361 long getNumCircleSegments(
double r,
long maxNum = 0);
362 DPoint* elCirclePolygon(DPoint,
double,
long*, DPoint*);
364 double m_dMaxPenDCwidth;
371 bool m_bINemulDCline;
375 bool m_bProcessingTraceGroup;
378 void elDrawDashedPolyline(
CCgmBaseObj*,
double,
long, DPoint*,
long,
float*,
bool);
379 void elDrawLineCap(
CCgmBaseObj*, DPoint*,
double,
double,
double,
long);
380 void elDrawLineJoin(
CCgmBaseObj*, DPoint*,
double,
double,
double);
381 long swrdst(
double,
double,
double,
double,
double,
double,
382 double,
double*,
double*,
double*,
double*,
double*,
double*);
383 long swrltl(
double,
double,
double,
double,
double,
double,
384 double,
double,
double*,
double*);
387 void efPolyInsert(
long);
389 void efPlotVect(
CCgmBaseObj*,
double,
double,
double);
395 void efMatSet(matStr*,
double,
double,
double,
double,
double,
double,
double,
double,
double);
396 void efMatMul(matStr*, matStr*, matStr*);
397 void efPtMul(mptStr*, matStr*, mptStr*);
504 #endif // !defined(AFX_DRAWBASE_H__CA9A4F64_A587_44FB_A36B_8C173B304AA7__INCLUDED_)
virtual void close()=0
close device and release memory
virtual void drawDCline(CCgmBaseObj *pCgmBaseObj, DPoint *pPts, long count, bool close)=0
draw a series of connected or unconnected lines specified by pPts in device coordinates ...
double m_dMinLineWidth
minimum line width in pixel units
Definition: DrawBase.h:338
double m_dDCmaxDrawableLineWidth
maximum DC line width that CDrawXXX can handle (0 => unlimited)
Definition: DrawBase.h:344
Definition: DrawBase.h:63
Definition: DrawBase.h:64
virtual void open()=0
open device for drawing
double m_dMinMarkerSize
minimum marker size in pixel units
Definition: DrawBase.h:347
double m_dMaxLineWidth
maximum line width in pixel units
Definition: DrawBase.h:340
CDrawBase – drawing base class from which all output specific draw classes are derived.
Definition: DrawBase.h:19
DPoint transformPt(DPoint point)
translate a point
Definition: Matrix.h:128
virtual long setFillAttr(CCgmBaseObj *)=0
apply fill attributes
virtual void setDisplay(void *pDisplay, void *pOther=0)=0
select target device
virtual long setLineAttr(CCgmBaseObj *)=0
apply line attributes
virtual void drawDCfill(CCgmBaseObj *pCgmBaseObj, DPoint *pPts, long count)=0
fill a polygonal area specified by pPts in device coordinates
virtual void clear()=0
clear display area and set to background color if indicated
CCgmBaseObj – graphical element container base class.
Definition: CgmObj.h:121
double m_dStrokeCharLargerThan
CDrawBase will stroke text characters who's height in pixel units exceeds.
Definition: DrawBase.h:353
CMatrix – transform matrix class.
Definition: Matrix.h:16
DPoint transformVec(DPoint vec)
translate a vector
Definition: Matrix.h:139
double m_dMinCharHeight
minimum character in pixel units
Definition: DrawBase.h:350
void drawDCdegen(CCgmBaseObj *pCgmBaseObj, DPoint *pts, bool bOnePt=true)
give 1 point or 2 draw the degenerate line (now a point) or fill (now a line or point) from the attri...
Definition: DrawBase.cpp:6796
virtual void drawCellArray(CCgmCellArray *pCCgmCellArray)
draw a cell array as specfied by pCCgmCellArray, points are in VDC units
Definition: DrawBase.cpp:1947
virtual bool applyClipping(CCgmBaseObj *, DRect *)=0
apply clipping rectangle and protection regions if either or both are indicated
virtual void setTransform(DRect *window, DRect *viewport, DRect *clientRect, double rotation=0.0, int originFlag=0)
set VDC to device coordinates transform
Definition: DrawBase.cpp:205