1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| class Fr2D { public: void DrawLine(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width);
void DrawRectangle(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width); void FillRectangle(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom); void DrawEllipse(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width); void FillEllipse(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom); void DrawTriangle(Fr2DBrush &fr2dbrush, float x1, float y1, float x2, float y2, float x3, float y3, float width); private: HWND * hwndptr; ID2D1Factory * d2dFactory; ID2D1HwndRenderTarget* hdl; };
void Fr2D::DrawLine(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width) { hdl->DrawLine(D2D1::Point2F(left, top), D2D1::Point2F(right, bottom), fr2dbrush.GetBrush(), width); }
void Fr2D::DrawRectangle(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width) { hdl->DrawRectangle( D2D1::RectF(left, top, right, bottom), fr2dbrush.GetBrush(), width ); }
void Fr2D::FillRectangle(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom) { hdl->FillRectangle( D2D1::RectF(left, top, right, bottom), fr2dbrush.GetBrush() ); }
void Fr2D::DrawEllipse(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom, float width) { hdl->DrawEllipse( D2D1::Ellipse({ (left + right) / 2,(top + bottom) / 2 }, (right - left) / 2, (bottom - top) / 2), fr2dbrush.GetBrush(), width ); }
void Fr2D::FillEllipse(Fr2DBrush &fr2dbrush, float left, float top, float right, float bottom) { hdl->FillEllipse( D2D1::Ellipse({ (left + right) / 2,(top + bottom) / 2 }, (right - left) / 2, (bottom - top) / 2), fr2dbrush.GetBrush() ); }
void Fr2D::DrawTriangle(Fr2DBrush &fr2dbrush, float x1, float y1, float x2, float y2, float x3, float y3, float width) { hdl->DrawLine(D2D1::Point2F(x1, y1), D2D1::Point2F(x2, y2), fr2dbrush.GetBrush(), width); hdl->DrawLine(D2D1::Point2F(x2, y2), D2D1::Point2F(x3, y3), fr2dbrush.GetBrush(), width); hdl->DrawLine(D2D1::Point2F(x3, y3), D2D1::Point2F(x1, y1), fr2dbrush.GetBrush(), width); }
|