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
|
|
|
|
{
|
|
|
|
|
|
this->_setRect(0, 0, 0, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
{
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͻ<EFBFBD><CFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
D2D1_POINT_2F upperLeftCorner = D2D1::Point2F(
|
2017-10-28 18:48:21 +08:00
|
|
|
|
node->getRealWidth() * node->getAnchorX(),
|
|
|
|
|
|
node->getRealHeight() * node->getAnchorY()
|
2017-10-26 17:17:30 +08:00
|
|
|
|
);
|
|
|
|
|
|
this->_setRect(
|
|
|
|
|
|
upperLeftCorner.x,
|
|
|
|
|
|
upperLeftCorner.y,
|
|
|
|
|
|
upperLeftCorner.x + node->getRealWidth(),
|
|
|
|
|
|
upperLeftCorner.y + node->getRealHeight()
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|