add: Canvas can draw geometry now
This commit is contained in:
parent
e435d94e4e
commit
57b528d67f
|
|
@ -22,6 +22,7 @@
|
||||||
#include "render.h"
|
#include "render.h"
|
||||||
#include "logs.h"
|
#include "logs.h"
|
||||||
#include "Image.h"
|
#include "Image.h"
|
||||||
|
#include "Geometry.h"
|
||||||
|
|
||||||
namespace easy2d
|
namespace easy2d
|
||||||
{
|
{
|
||||||
|
|
@ -247,7 +248,7 @@ namespace easy2d
|
||||||
|
|
||||||
void Canvas::DrawImage(spImage const & image, float opacity)
|
void Canvas::DrawImage(spImage const & image, float opacity)
|
||||||
{
|
{
|
||||||
if (image->GetBitmap())
|
if (image && image->GetBitmap())
|
||||||
{
|
{
|
||||||
render_target_->DrawBitmap(
|
render_target_->DrawBitmap(
|
||||||
image->GetBitmap().Get(),
|
image->GetBitmap().Get(),
|
||||||
|
|
@ -293,6 +294,20 @@ namespace easy2d
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::DrawGeometry(spGeometry const & geo)
|
||||||
|
{
|
||||||
|
if (geo && geo->geo_)
|
||||||
|
{
|
||||||
|
render_target_->DrawGeometry(
|
||||||
|
geo->geo_.Get(),
|
||||||
|
stroke_brush_.Get(),
|
||||||
|
stroke_width_,
|
||||||
|
outline_join_style_.Get()
|
||||||
|
);
|
||||||
|
cache_expired_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::FillCircle(const Point & center, float radius)
|
void Canvas::FillCircle(const Point & center, float radius)
|
||||||
{
|
{
|
||||||
render_target_->FillEllipse(
|
render_target_->FillEllipse(
|
||||||
|
|
@ -357,6 +372,18 @@ namespace easy2d
|
||||||
cache_expired_ = true;
|
cache_expired_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Canvas::FillGeometry(spGeometry const & geo)
|
||||||
|
{
|
||||||
|
if (geo && geo->geo_)
|
||||||
|
{
|
||||||
|
render_target_->FillGeometry(
|
||||||
|
geo->geo_.Get(),
|
||||||
|
fill_brush_.Get()
|
||||||
|
);
|
||||||
|
cache_expired_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::BeginPath(Point const& begin_pos)
|
void Canvas::BeginPath(Point const& begin_pos)
|
||||||
{
|
{
|
||||||
current_geometry_ = nullptr;
|
current_geometry_ = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,11 @@ namespace easy2d
|
||||||
Point const& point /* 文字位置 */
|
Point const& point /* 文字位置 */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 뺌섯부暠近긋움
|
||||||
|
void DrawGeometry(
|
||||||
|
spGeometry const& geo
|
||||||
|
);
|
||||||
|
|
||||||
// 填充圆形
|
// 填充圆形
|
||||||
void FillCircle(
|
void FillCircle(
|
||||||
const Point& center,
|
const Point& center,
|
||||||
|
|
@ -120,6 +125,11 @@ namespace easy2d
|
||||||
float radius_y
|
float radius_y
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 輕념섯부暠近
|
||||||
|
void FillGeometry(
|
||||||
|
spGeometry const& geo
|
||||||
|
);
|
||||||
|
|
||||||
// 开始绘制路径
|
// 开始绘制路径
|
||||||
void BeginPath(
|
void BeginPath(
|
||||||
Point const& begin_pos /* 路径起始点 */
|
Point const& begin_pos /* 路径起始点 */
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ namespace easy2d
|
||||||
class Geometry
|
class Geometry
|
||||||
: public Unit
|
: public Unit
|
||||||
{
|
{
|
||||||
|
friend class Canvas;
|
||||||
friend class GeometryNode;
|
friend class GeometryNode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue