2018-02-03 22:04:43 +08:00
|
|
|
#include "..\eshape.h"
|
2017-10-26 17:17:30 +08:00
|
|
|
#include "..\enodes.h"
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
e2d::Rect::Rect()
|
2017-10-28 18:48:21 +08:00
|
|
|
: m_pD2dRectangle(nullptr)
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-27 21:07:43 +08:00
|
|
|
e2d::Rect::Rect(double x, double y, double width, double height)
|
2017-12-15 21:51:07 +08:00
|
|
|
: m_pD2dRectangle(nullptr)
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
this->_setRect(x, y, x + width, y + height);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
e2d::Rect::Rect(Node * node)
|
2017-12-15 21:51:07 +08:00
|
|
|
: m_pD2dRectangle(nullptr)
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
this->_setRect(
|
2017-10-29 23:48:32 +08:00
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
node->getRealWidth(),
|
|
|
|
|
node->getRealHeight()
|
2017-10-26 17:17:30 +08:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
e2d::Rect::~Rect()
|
2017-10-29 23:48:32 +08:00
|
|
|
{
|
|
|
|
|
SafeReleaseInterface(&m_pD2dRectangle);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-27 21:07:43 +08:00
|
|
|
void e2d::Rect::_setRect(double left, double top, double right, double bottom)
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
SafeReleaseInterface(&m_pD2dRectangle);
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
Renderer::getID2D1Factory()->CreateRectangleGeometry(
|
2018-02-27 21:07:43 +08:00
|
|
|
D2D1::RectF(
|
|
|
|
|
static_cast<float>(left),
|
|
|
|
|
static_cast<float>(top),
|
|
|
|
|
static_cast<float>(right),
|
|
|
|
|
static_cast<float>(bottom)),
|
2017-10-26 17:17:30 +08:00
|
|
|
&m_pD2dRectangle
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-07 16:37:12 +08:00
|
|
|
ID2D1RectangleGeometry * e2d::Rect::_getD2dGeometry() const
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
return m_pD2dRectangle;
|
|
|
|
|
}
|