#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/controls/canvas-view/canvas-view.h>
+#include <dali/devel-api/adaptor-framework/canvas-renderer-drawable-group.h>
#include <dali/devel-api/adaptor-framework/canvas-renderer-shape.h>
using namespace Dali;
shape1.Rotate(Degree(45.0f));
shape1.Translate(Vector2(100.0f, 100.0f));
- mCanvasView.AddDrawable(shape1);
-
mRoundedRect = Dali::CanvasRenderer::Shape::New();
mRoundedRect.AddRect(Rect<float>(10.0f, 350.0f, 200.0f, 140.0f), Vector2(40.0f, 40.0f));
mRoundedRect.SetFillColor(Vector4(0.0f, 0.0f, 1.0f, 1.0f));
dashPattern.PushBack(15.0f);
dashPattern.PushBack(30.0f);
mRoundedRect.SetStrokeDash(dashPattern);
- mCanvasView.AddDrawable(mRoundedRect);
Dali::CanvasRenderer::Shape shape2 = Dali::CanvasRenderer::Shape::New();
shape2.AddMoveTo(Vector2(535.0f, 135.0f));
shape2.SetStrokeWidth(20.0f);
shape2.SetStrokeJoin(Dali::CanvasRenderer::Shape::StrokeJoin::ROUND);
shape2.Transform(Matrix3(0.6f, 0.0f, 20.0f, 0.0f, 0.6f, -50.0f, 0.0f, 0.0f, 1.0f));
- mCanvasView.AddDrawable(shape2);
mArc = Dali::CanvasRenderer::Shape::New();
mArc.AddArc(Vector2(100.0f, 650.0f), 80.0f, 10.0f, 0.0f, true);
mCanvasView.AddDrawable(mStar);
+ mGroup1 = Dali::CanvasRenderer::DrawableGroup::New();
+
+ mGroup1.AddDrawable(mRoundedRect);
+ mGroup1.AddDrawable(shape1);
+
+ mGroup2 = Dali::CanvasRenderer::DrawableGroup::New();
+
+ mGroup2.AddDrawable(mGroup1);
+ mGroup2.AddDrawable(shape2);
+
+ mCanvasView.AddDrawable(mGroup2);
+
mTimer = Timer::New(1000.0f / 32.0f);
mTimer.TickSignal().Connect(this, &CanvasViewController::tick);
mTimer.Start();
mStar.Rotate(Degree(mCount * 2.0f));
mStar.Scale(float(mCount % 100) * 0.01f + 0.6f);
+
+ mGroup1.Scale(float(mCount % 50) * 0.005f + 0.8f);
+
+ mGroup2.SetOpacity(1.0f - float(mCount % 50) * 0.015f);
+
mCount++;
return true;
}
}
private:
- Application& mApplication;
- Dali::CanvasRenderer::Shape mRoundedRect;
- Dali::CanvasRenderer::Shape mArc;
- Dali::CanvasRenderer::Shape mStar;
- Timer mTimer;
- int mCount;
+ Application& mApplication;
+ Dali::CanvasRenderer::Shape mRoundedRect;
+ Dali::CanvasRenderer::Shape mArc;
+ Dali::CanvasRenderer::Shape mStar;
+ Dali::CanvasRenderer::DrawableGroup mGroup1;
+ Dali::CanvasRenderer::DrawableGroup mGroup2;
+ Timer mTimer;
+ int mCount;
};
int DALI_EXPORT_API main(int argc, char** argv)
STATUS_NORMAL = 0,
STATUS_ROUND = 1,
STATUS_BORDERLINE = 2,
- STATUS_ROUNDED_BORDERLINE = 3,
+ STATUS_ROUNDED_BORDERLINE = STATUS_ROUND | STATUS_BORDERLINE,
NUMBER_OF_STATUS,
};
const char* BUTTON_LABEL[NUMBER_OF_STATUS] = {
mTable.AddChild(button2, Toolkit::TableView::CellPosition(CellPlacement::MID_BUTTON, x));
Toolkit::PushButton button3 = Toolkit::PushButton::New();
- button3.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(STATUS_NORMAL + 1) % NUMBER_OF_STATUS]);
+ button3.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[STATUS_NORMAL]);
button3.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::BOTTOM_CENTER);
button3.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::BOTTOM_CENTER);
button3.ClickedSignal().Connect(this, &ImageViewController::RoundedCornerClicked);
mImageViewImageIndexStatus[buttonIndex] = 0;
}
- // Reset corner radius state value
- mImageViewRoundedCornerStatus[buttonIndex] = STATUS_NORMAL;
- button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]);
-
Property::Map imagePropertyMap;
imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]);
+ if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_ROUND)
+ {
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS_VALUE);
+ }
+ if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_BORDERLINE)
+ {
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH_VALUE);
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET_VALUE);
+ }
+
mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap);
}
return true;
{
mImageViewRoundedCornerStatus[buttonIndex] = (mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS;
- button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[(mImageViewRoundedCornerStatus[buttonIndex] + 1) % NUMBER_OF_STATUS]);
+ button.SetProperty(Toolkit::Button::Property::LABEL, BUTTON_LABEL[mImageViewRoundedCornerStatus[buttonIndex]]);
Property::Map imagePropertyMap;
imagePropertyMap.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
imagePropertyMap.Insert(Toolkit::ImageVisual::Property::URL, IMAGE_PATH[mImageViewImageIndexStatus[buttonIndex]]);
- imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, mImageViewRoundedCornerStatus[buttonIndex] & 1 ? CORNER_RADIUS_VALUE : 0.0f);
- imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_WIDTH_VALUE : 0.0f);
- imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, mImageViewRoundedCornerStatus[buttonIndex] & 2 ? BORDERLINE_OFFSET_VALUE : 0.0f);
+ if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_ROUND)
+ {
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS_VALUE);
+ }
+ if(mImageViewRoundedCornerStatus[buttonIndex] & STATUS_BORDERLINE)
+ {
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH_VALUE);
+ imagePropertyMap.Insert(Toolkit::DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET_VALUE);
+ }
mImageViews[buttonIndex].SetProperty(Toolkit::ImageView::Property::IMAGE, imagePropertyMap);
}