|
|
|
|
#pragma once
|
|
|
|
|
#include "GlobalDrawMgr.h"
|
|
|
|
|
#include "SequentialPoint.h"
|
|
|
|
|
#include "ObjCircle.h"
|
|
|
|
|
#include "DrawSimpleShape.h"
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һЩ<D2BB><EFBFBD>ͼ<EFBFBD><CDBC>
|
|
|
|
|
inline void DrawRect(CDC* pDC,CPen&Pen,Dbxy pt1,Dbxy pt2,bool bXor = true)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer;
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt1.x,pt2.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt2.x,pt2.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt2.x,pt1.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
|
|
|
|
|
if(bXor)
|
|
|
|
|
{
|
|
|
|
|
int old_rop = pDC->SetROP2(R2_XORPEN);
|
|
|
|
|
PtContainer.Draw( pDC, Pen);
|
|
|
|
|
pDC->SetROP2(old_rop);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PtContainer.Draw( pDC, Pen);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
inline void DrawRect(CDC* pDC,CPen&Pen,DbRect rect,bool bXor = true)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(rect.L,rect.T);
|
|
|
|
|
Dbxy pt2(rect.R,rect.B);
|
|
|
|
|
DrawRect(pDC,Pen,pt1,pt2,bXor);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
inline void DrawRect(CDC* pDC,CPen&Pen,Dbxy pt,double size,bool bXor = true)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(pt.x-size,pt.y+size);
|
|
|
|
|
Dbxy pt2(pt.x+size,pt.y-size);
|
|
|
|
|
DrawRect(pDC,Pen,pt1,pt2,bXor);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>һ<EFBFBD><D2BB>X ʮ<><CAAE>
|
|
|
|
|
inline void XorDrawCrossX(CDC* pDC,CPen&Pen,Dbxy pt1,Dbxy pt2)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer1,PtContainer2;
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt2.x,pt2.y));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt2.x,pt1.y));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt1.x,pt2.y));
|
|
|
|
|
|
|
|
|
|
int old_rop = pDC->SetROP2(R2_XORPEN);
|
|
|
|
|
PtContainer1.Draw( pDC, Pen);
|
|
|
|
|
PtContainer2.Draw( pDC, Pen);
|
|
|
|
|
pDC->SetROP2(old_rop);
|
|
|
|
|
}
|
|
|
|
|
inline void XorDrawCrossX(CDC* pDC,CPen&Pen,DbRect rect)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(rect.L,rect.T);
|
|
|
|
|
Dbxy pt2(rect.R,rect.B);
|
|
|
|
|
XorDrawCrossX(pDC,Pen,pt1,pt2);
|
|
|
|
|
}
|
|
|
|
|
inline void DrawCrossX(CDC* pDC,CPen&Pen,Dbxy pt1,Dbxy pt2)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer1,PtContainer2;
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt2.x,pt2.y));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt2.x,pt1.y));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt1.x,pt2.y));
|
|
|
|
|
|
|
|
|
|
PtContainer1.Draw( pDC, Pen);
|
|
|
|
|
PtContainer2.Draw( pDC, Pen);
|
|
|
|
|
}
|
|
|
|
|
inline void DrawCrossX(CDC* pDC,CPen&Pen,DbRect rect)
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(rect.L,rect.T);
|
|
|
|
|
Dbxy pt2(rect.R,rect.B);
|
|
|
|
|
DrawCrossX(pDC,Pen,pt1,pt2);
|
|
|
|
|
}
|
|
|
|
|
inline void XorDrawCross(CDC* pDC,bool bXor,CPen&Pen,Dbxy pt,double size)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer1,PtContainer2;
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt.x,pt.y+size));
|
|
|
|
|
PtContainer1.AddDataPoint(Dbxy(pt.x,pt.y-size));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt.x-size,pt.y));
|
|
|
|
|
PtContainer2.AddDataPoint(Dbxy(pt.x+size,pt.y));
|
|
|
|
|
|
|
|
|
|
int old_rop;
|
|
|
|
|
if(bXor)
|
|
|
|
|
old_rop = pDC->SetROP2(R2_XORPEN);
|
|
|
|
|
PtContainer1.Draw( pDC, Pen);
|
|
|
|
|
PtContainer2.Draw( pDC, Pen);
|
|
|
|
|
if(bXor)
|
|
|
|
|
pDC->SetROP2(old_rop);
|
|
|
|
|
}
|
|
|
|
|
//<2F><>һ<EFBFBD><D2BB>ʵ<EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
|
|
|
|
|
inline void DrawSolidRect(CDC* pDC,COLORREF color,DbRect rect)
|
|
|
|
|
{
|
|
|
|
|
CBrush brush,*pOldBrush;
|
|
|
|
|
brush.CreateSolidBrush(color);
|
|
|
|
|
pOldBrush=pDC->SelectObject(&brush);
|
|
|
|
|
pDC->Rectangle(&gDraw->DbRect2CRect(rect));
|
|
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
|
|
}
|
|
|
|
|
inline void XorDrawLine(CDC* pDC,CPen&Pen,Dbxy pt1,Dbxy pt2)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer;
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt2.x,pt2.y));
|
|
|
|
|
|
|
|
|
|
int old_rop = pDC->SetROP2(R2_XORPEN);
|
|
|
|
|
PtContainer.Draw( pDC, Pen);
|
|
|
|
|
pDC->SetROP2(old_rop);
|
|
|
|
|
}
|
|
|
|
|
inline void DrawLine(CDC* pDC,CPen&Pen,Dbxy pt1,Dbxy pt2)
|
|
|
|
|
{
|
|
|
|
|
CSequentialPoint PtContainer;
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt1.x,pt1.y));
|
|
|
|
|
PtContainer.AddDataPoint(Dbxy(pt2.x,pt2.y));
|
|
|
|
|
PtContainer.Draw( pDC, Pen);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD><C8A1>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
inline COLORREF GetXorColor(COLORREF color)
|
|
|
|
|
{
|
|
|
|
|
BYTE r = GetRValue(color);
|
|
|
|
|
BYTE g = GetGValue(color);
|
|
|
|
|
BYTE b = GetBValue(color);
|
|
|
|
|
|
|
|
|
|
COLORREF clr = RGB(255-r,255-g,255-b);
|
|
|
|
|
return clr;
|
|
|
|
|
}
|
|
|
|
|
inline void DrawCircle(CDC* pDC,CPen&Pen,Dbxy pt,double R,int DEdgeCnt)
|
|
|
|
|
{
|
|
|
|
|
CObjCircle ObjCircle;
|
|
|
|
|
CCirclePar par;
|
|
|
|
|
par.CenterPt = pt;
|
|
|
|
|
par.Radius = R;
|
|
|
|
|
par.DEdgeCnt = DEdgeCnt;
|
|
|
|
|
ObjCircle.Creat(par);
|
|
|
|
|
ObjCircle.Draw(pDC,Pen);
|
|
|
|
|
}
|
|
|
|
|
inline void DrawSolidCircle(CDC* pDC,COLORREF color,Dbxy pt,double R)
|
|
|
|
|
{
|
|
|
|
|
CBrush brush,*pOldBrush;
|
|
|
|
|
brush.CreateSolidBrush(color);
|
|
|
|
|
pOldBrush=pDC->SelectObject(&brush);
|
|
|
|
|
pDC->Ellipse(&gDraw->DbRect2CRect(DbRect(pt,R)));
|
|
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
|
|
}
|
|
|
|
|
//<2F>ھ<EFBFBD><DABE>η<EFBFBD>Χ<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(gap <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵļ<DFB5><C4BC><EFBFBD>)
|
|
|
|
|
inline void Drawgridding(CDC* pDC,CPen&Pen,DbRect rect,double gap)
|
|
|
|
|
{
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(rect.L,rect.B);
|
|
|
|
|
Dbxy pt2(rect.R,rect.B);
|
|
|
|
|
double CurY = rect.B;
|
|
|
|
|
while(CurY<rect.T)
|
|
|
|
|
{
|
|
|
|
|
pt1.y = pt2.y = CurY;
|
|
|
|
|
DrawLine(pDC,Pen,pt1,pt2);
|
|
|
|
|
CurY += gap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
Dbxy pt1(rect.L,rect.B);
|
|
|
|
|
Dbxy pt2(rect.L,rect.T);
|
|
|
|
|
double CurX = rect.L;
|
|
|
|
|
while(CurX<rect.R)
|
|
|
|
|
{
|
|
|
|
|
pt1.x = pt2.x = CurX;
|
|
|
|
|
DrawLine(pDC,Pen,pt1,pt2);
|
|
|
|
|
CurX += gap;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|