From 10d955f18b7c6af94f9556aa8bb292dd6bd3dff3 Mon Sep 17 00:00:00 2001 From: ozantonkal Date: Tue, 9 Jul 2013 14:28:55 +0200 Subject: [PATCH] widget2d setcolor implementation --- modules/viz/include/opencv2/viz/widgets.hpp | 2 ++ modules/viz/src/widget.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/modules/viz/include/opencv2/viz/widgets.hpp b/modules/viz/include/opencv2/viz/widgets.hpp index 9aea972..d70b763 100644 --- a/modules/viz/include/opencv2/viz/widgets.hpp +++ b/modules/viz/include/opencv2/viz/widgets.hpp @@ -53,6 +53,8 @@ namespace temp_viz Widget2D() {} Widget2D(const Widget &other); Widget2D& operator=(const Widget &other); + + void setColor(const Color &color); }; diff --git a/modules/viz/src/widget.cpp b/modules/viz/src/widget.cpp index 419cd35..e7f346d 100644 --- a/modules/viz/src/widget.cpp +++ b/modules/viz/src/widget.cpp @@ -182,4 +182,13 @@ temp_viz::Widget2D& temp_viz::Widget2D::operator=(const Widget &other) CV_Assert(actor); Widget::operator=(other); return *this; +} + +void temp_viz::Widget2D::setColor(const Color &color) +{ + vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getActor(*this)); + CV_Assert(actor); + Color c = vtkcolor(color); + actor->GetProperty ()->SetColor (c.val); + actor->Modified (); } \ No newline at end of file -- 2.7.4