}
ShapeTizen::ShapeTizen()
+: mFillGradient(),
+ mStrokeGradient()
#ifdef THORVG_SUPPORT
-: mTvgShape(nullptr)
+ ,
+ mTvgShape(nullptr)
#endif
{
Initialize();
Drawable::Create();
Drawable::SetObject(static_cast<void*>(mTvgShape));
+ Drawable::SetType(Drawable::Types::SHAPE);
#endif
}
bool ShapeTizen::AddRect(Rect<float> rect, Vector2 roundedCorner)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null [%p]\n", this);
return false;
bool ShapeTizen::AddCircle(Vector2 center, Vector2 radius)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null [%p]\n", this);
return false;
bool ShapeTizen::AddArc(Vector2 center, float radius, float startAngle, float sweep, bool pie)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
bool ShapeTizen::AddMoveTo(Vector2 point)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
bool ShapeTizen::AddLineTo(Vector2 line)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
bool ShapeTizen::AddCubicTo(Vector2 controlPoint1, Vector2 controlPoint2, Vector2 endPoint)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
bool ShapeTizen::Close()
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
#endif
}
+bool ShapeTizen::ResetPath()
+{
+#ifdef THORVG_SUPPORT
+ if(!Drawable::GetObject() || !mTvgShape)
+ {
+ DALI_LOG_ERROR("Shape is null\n");
+ return false;
+ }
+
+ if(static_cast<tvg::Shape*>(mTvgShape)->reset() != tvg::Result::Success)
+ {
+ DALI_LOG_ERROR("reset() fail.\n");
+ return false;
+ }
+ Drawable::SetChanged(true);
+ return true;
+#else
+ return false;
+#endif
+}
+
bool ShapeTizen::SetFillColor(Vector4 color)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null [%p]\n", this);
return false;
Vector4 ShapeTizen::GetFillColor() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null [%p]\n", this);
return Vector4(0, 0, 0, 0);
#endif
}
+bool ShapeTizen::SetFillGradient(Dali::CanvasRenderer::Gradient& gradient)
+{
+#ifdef THORVG_SUPPORT
+ if(!Drawable::GetObject() || !mTvgShape)
+ {
+ DALI_LOG_ERROR("Shape is null [%p]\n", this);
+ return false;
+ }
+ mFillGradient = gradient;
+ Drawable::SetChanged(true);
+ return true;
+#else
+ return false;
+#endif
+}
+
+Dali::CanvasRenderer::Gradient ShapeTizen::GetFillGradient() const
+{
+ return mFillGradient;
+}
+
bool ShapeTizen::SetFillRule(Dali::CanvasRenderer::Shape::FillRule rule)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
Dali::CanvasRenderer::Shape::FillRule ShapeTizen::GetFillRule() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return Dali::CanvasRenderer::Shape::FillRule::WINDING;
bool ShapeTizen::SetStrokeWidth(float width)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
float ShapeTizen::GetStrokeWidth() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
bool ShapeTizen::SetStrokeColor(Vector4 color)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
Vector4 ShapeTizen::GetStrokeColor() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return Vector4(0, 0, 0, 0);
#endif
}
+bool ShapeTizen::SetStrokeGradient(Dali::CanvasRenderer::Gradient& gradient)
+{
+#ifdef THORVG_SUPPORT
+ if(!Drawable::GetObject() || !mTvgShape)
+ {
+ DALI_LOG_ERROR("Shape is null [%p]\n", this);
+ return false;
+ }
+ mStrokeGradient = gradient;
+ Drawable::SetChanged(true);
+ return true;
+#else
+ return false;
+#endif
+}
+
+Dali::CanvasRenderer::Gradient ShapeTizen::GetStrokeGradient() const
+{
+ return mStrokeGradient;
+}
+
bool ShapeTizen::SetStrokeDash(const Dali::Vector<float> dashPattern)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
Dali::Vector<float> ShapeTizen::GetStrokeDash() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return Vector<float>();
bool ShapeTizen::SetStrokeCap(Dali::CanvasRenderer::Shape::StrokeCap cap)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
}
-
if(static_cast<tvg::Shape*>(mTvgShape)->stroke(static_cast<tvg::StrokeCap>(cap)) != tvg::Result::Success)
{
DALI_LOG_ERROR("SetStrokeCap fail.\n");
Dali::CanvasRenderer::Shape::StrokeCap ShapeTizen::GetStrokeCap() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return Dali::CanvasRenderer::Shape::StrokeCap::SQUARE;
bool ShapeTizen::SetStrokeJoin(Dali::CanvasRenderer::Shape::StrokeJoin join)
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return false;
Dali::CanvasRenderer::Shape::StrokeJoin ShapeTizen::GetStrokeJoin() const
{
#ifdef THORVG_SUPPORT
- if(!mTvgShape)
+ if(!Drawable::GetObject() || !mTvgShape)
{
DALI_LOG_ERROR("Shape is null\n");
return Dali::CanvasRenderer::Shape::StrokeJoin::BEVEL;