2017-10-26 17:17:30 +08:00
|
|
|
#include "..\egeometry.h"
|
|
|
|
|
#include "..\enodes.h"
|
|
|
|
|
#include "..\Win\winbase.h"
|
|
|
|
|
|
|
|
|
|
e2d::ERectangle::ERectangle()
|
2017-10-28 18:48:21 +08:00
|
|
|
: m_pD2dRectangle(nullptr)
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e2d::ERectangle::ERectangle(float x, float y, float width, float height)
|
2017-10-28 18:48:21 +08:00
|
|
|
: ERectangle()
|
2017-10-26 17:17:30 +08:00
|
|
|
{
|
|
|
|
|
this->_setRect(x, y, x + width, y + height);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e2d::ERectangle::ERectangle(ENode * node)
|
2017-10-29 23:48:32 +08:00
|
|
|
: ERectangle()
|
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
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-29 23:48:32 +08:00
|
|
|
e2d::ERectangle::~ERectangle()
|
|
|
|
|
{
|
|
|
|
|
SafeReleaseInterface(&m_pD2dRectangle);
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-26 17:17:30 +08:00
|
|
|
void e2d::ERectangle::_setRect(float left, float top, float right, float bottom)
|
|
|
|
|
{
|
|
|
|
|
SafeReleaseInterface(&m_pD2dRectangle);
|
|
|
|
|
|
|
|
|
|
GetFactory()->CreateRectangleGeometry(
|
|
|
|
|
D2D1::RectF(left, top, right, bottom),
|
|
|
|
|
&m_pD2dRectangle
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ID2D1RectangleGeometry * e2d::ERectangle::_getD2dGeometry() const
|
|
|
|
|
{
|
|
|
|
|
return m_pD2dRectangle;
|
|
|
|
|
}
|