\r
#include "color_producer.h"\r
\r
-#include "../../processor/draw_frame.h"\r
+#include <mixer/frame/draw_frame.h>\r
\r
#include <sstream>\r
\r
\r
class color_producer : public frame_producer\r
{\r
+ safe_ptr<draw_frame> frame_;\r
+ std::wstring color_str_;\r
+ printer parent_printer_;\r
+\r
public:\r
- color_producer(color_producer&& other) : frame_(std::move(other.frame_)), color_str_(std::move(other.color_str_)){}\r
\r
- explicit color_producer(const std::wstring& color) : color_str_(color), frame_(draw_frame::empty())\r
+ explicit color_producer(const std::wstring& color) \r
+ : color_str_(color)\r
+ , frame_(draw_frame::empty())\r
{\r
if(color.length() != 9 || color[0] != '#')\r
BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(narrow(color)) << msg_info("Invalid color code"));\r
}\r
- \r
- virtual safe_ptr<draw_frame> receive() { return frame_; }\r
\r
- virtual void initialize(const safe_ptr<frame_processor_device>& frame_processor)\r
+ virtual void initialize(const safe_ptr<frame_factory>& frame_factory)\r
{\r
- auto frame = frame_processor->create_frame(1, 1, pixel_format::bgra);\r
+ auto frame = frame_factory->create_frame(1, 1, pixel_format::bgra);\r
auto& value = *reinterpret_cast<unsigned long*>(frame->image_data().begin());\r
std::wstringstream str(color_str_.substr(1));\r
str >> std::hex >> value; \r
frame_ = std::move(frame);\r
}\r
- \r
- virtual std::wstring print() const { return + L"color[" + color_str_ + L"]"; }\r
\r
- safe_ptr<draw_frame> frame_;\r
- std::wstring color_str_;\r
+ virtual void set_parent_printer(const printer& parent_printer){parent_printer_ = parent_printer;}\r
+ \r
+ virtual safe_ptr<draw_frame> receive() { return frame_; }\r
+ \r
+ virtual std::wstring print() const { return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"color[" + color_str_ + L"]"; }\r
};\r
\r
safe_ptr<frame_producer> create_color_producer(const std::vector<std::wstring>& params)\r
return make_safe<color_producer>(params[0]);\r
}\r
\r
+volatile struct reg\r
+{\r
+ reg(){register_producer_factory(create_color_producer);}\r
+} my_reg;\r
+\r
}}
\ No newline at end of file