2017-09-27 17:56:28 +08:00
|
|
|
|
#include "..\..\easy2d.h"
|
2017-09-10 23:56:52 +08:00
|
|
|
|
#include "..\..\EasyX\easyx.h"
|
|
|
|
|
|
|
2017-09-12 12:53:34 +08:00
|
|
|
|
Shape::Shape() :
|
|
|
|
|
|
lineColor(Color::black),
|
2017-09-18 23:59:08 +08:00
|
|
|
|
fillColor(Color::white),
|
|
|
|
|
|
m_eStyle(SOLID)
|
2017-09-10 23:56:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Shape::~Shape()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Shape::_onDraw()
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><>״<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ
|
|
|
|
|
|
if (!m_bDisplay)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
|
|
|
|
|
|
setlinecolor(lineColor);
|
|
|
|
|
|
setfillcolor(fillColor);
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>в<EFBFBD>ͬ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD>
|
2017-09-18 23:59:08 +08:00
|
|
|
|
if (m_eStyle == Shape::STYLE::ROUND)
|
2017-09-10 23:56:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
roundShape();
|
|
|
|
|
|
}
|
2017-09-18 23:59:08 +08:00
|
|
|
|
else if (m_eStyle == Shape::STYLE::SOLID)
|
2017-09-10 23:56:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
solidShape();
|
|
|
|
|
|
}
|
2017-09-18 23:59:08 +08:00
|
|
|
|
else if (m_eStyle == Shape::STYLE::FILL)
|
2017-09-10 23:56:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
fillShape();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline COLORREF Shape::getFillColor() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return fillColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline COLORREF Shape::getLineColor() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return lineColor;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Shape::setFillColor(COLORREF color)
|
|
|
|
|
|
{
|
|
|
|
|
|
fillColor = color;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Shape::setLineColor(COLORREF color)
|
|
|
|
|
|
{
|
|
|
|
|
|
lineColor = color;
|
|
|
|
|
|
}
|
2017-09-18 23:59:08 +08:00
|
|
|
|
|
|
|
|
|
|
void Shape::setStyle(STYLE style)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_eStyle = style;
|
|
|
|
|
|
}
|