- if(params.empty() || params[0].at(0) != '#')\r
- return nullptr;\r
- return std::make_shared<color_producer>(get_pixel_color_value(params[0]));\r
+ auto color2 = get_hex_color(color);\r
+ if(color2.length() != 9 || color2[0] != '#')\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(color2) << msg_info("Invalid color."));\r
+ \r
+ core::pixel_format_desc desc(pixel_format::bgra);\r
+ desc.planes.push_back(core::pixel_format_desc::plane(1, 1, 4));\r
+ auto frame = frame_factory->create_frame(tag, desc);\r
+ \r
+ // Read color from hex-string and write to frame pixel.\r
+\r
+ auto& value = *reinterpret_cast<uint32_t*>(frame.image_data(0).begin());\r
+ std::wstringstream str(color2.substr(1));\r
+ if(!(str >> std::hex >> value) || !str.eof())\r
+ BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("color") << arg_value_info(color2) << msg_info("Invalid color."));\r
+ \r
+ return core::draw_frame(std::move(frame));\r