]> git.sesse.net Git - casparcg/commitdiff
#414 Added help for color producer.
authorHelge Norberg <helge.norberg@svt.se>
Mon, 29 Feb 2016 11:59:42 +0000 (12:59 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 29 Feb 2016 11:59:42 +0000 (12:59 +0100)
core/producer/color/color_producer.cpp
core/producer/color/color_producer.h
shell/server.cpp

index 88882372793287bfda52588e393a91a02efd1577..78c89a53c3842579568f9e34c5064b0e401dc4f4 100644 (file)
@@ -30,6 +30,8 @@
 #include <core/frame/pixel_format.h>
 #include <core/frame/audio_channel_layout.h>
 #include <core/monitor/monitor.h>
+#include <core/help/help_repository.h>
+#include <core/help/help_sink.h>
 
 #include <common/except.h>
 #include <common/array.h>
@@ -157,6 +159,44 @@ bool try_get_color(const std::wstring& str, uint32_t& value)
        return true;
 }
 
+void describe_color_producer(core::help_sink& sink, const core::help_repository& repo)
+{
+       sink.short_description(L"Fills a layer with a solid color.");
+       sink.syntax(
+               L"{#[argb_hex_value:string]}"
+               L",{#[rgb_hex_value:string]}"
+               L",{[named_color:EMPTY,BLACK,WHITE,RED,GREEN,BLUE,ORANGE,YELLOW,BROWN,GRAY,TEAL]}");
+       sink.para()->text(L"A producer that fills a layer with a solid color.");
+       sink.para()
+               ->text(L"If a ")->code(L"#")
+               ->text(L" sign followed by an 8 character hexadecimal number is given it is interpreted as an 8-bit per channel ARGB color. ")
+               ->text(L"If it is instead followed by a 6 character hexadecimal number it is interpreted as an 8-bit per channel RGB value with an opaque alpha channel.");
+       sink.para()->text(L"There are also a number of predefined named colors, that are specified without a ")->code(L"#")->text(L" sign:");
+       sink.definitions()
+               ->item(L"EMPTY",        L"Predefined ARGB value #00000000")
+               ->item(L"BLACK",        L"Predefined ARGB value #FF000000")
+               ->item(L"WHITE",        L"Predefined ARGB value #FFFFFFFF")
+               ->item(L"RED",          L"Predefined ARGB value #FFFF0000")
+               ->item(L"GREEN",        L"Predefined ARGB value #FF00FF00")
+               ->item(L"BLUE",         L"Predefined ARGB value #FF0000FF")
+               ->item(L"ORANGE",       L"Predefined ARGB value #FFFFA500")
+               ->item(L"YELLOW",       L"Predefined ARGB value #FFFFFF00")
+               ->item(L"BROWN",        L"Predefined ARGB value #FFA52A2A")
+               ->item(L"GRAY",         L"Predefined ARGB value #FF808080")
+               ->item(L"TEAL",         L"Predefined ARGB value #FF008080");
+       sink.para()
+               ->strong(L"Note")->text(L" that it is important that all RGB values are multiplied with the alpha ")
+               ->text(L"at all times, otherwise the compositing in the mixer will be incorrect.");
+       sink.para()->text(L"Examples:");
+       sink.example(L"PLAY 1-10 EMPTY", L"For a completely transparent frame.");
+       sink.example(L"PLAY 1-10 #00000000", L"For an explicitly defined completely transparent frame.");
+       sink.example(L"PLAY 1-10 #000000", L"For an explicitly defined completely opaque black frame.");
+       sink.example(L"PLAY 1-10 RED", L"For a completely red frame.");
+       sink.example(L"PLAY 1-10 #7F007F00",
+               L"For a completely green half transparent frame. "
+               L"Since the RGB part has been premultiplied with the A part this is 100% green.");
+}
+
 spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<frame_factory>& frame_factory, uint32_t value)
 {
        return spl::make_shared<color_producer>(frame_factory, value);
index 40a0972c47d49e85a2430a028f52781a74f57a08..696b274df979cbb92cc7367640467ca3f88d4e37 100644 (file)
@@ -33,6 +33,7 @@ namespace caspar { namespace core {
 
 bool try_get_color(const std::wstring& str, uint32_t& value);
 
+void describe_color_producer(core::help_sink& sink, const core::help_repository& repo);
 spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<frame_factory>& frame_factory, uint32_t value);
 spl::shared_ptr<frame_producer> create_color_producer(const spl::shared_ptr<frame_factory>& frame_factory, const std::vector<std::wstring>& params);
 draw_frame create_color_frame(void* tag, const spl::shared_ptr<frame_factory>& frame_factory, uint32_t value);
index cfcf4daa12ceb3bdf072f9d36e85e644c78c29dc..2c2c5f3d36be07e467ff86a8f2b877acddcd7177 100644 (file)
@@ -42,6 +42,7 @@
 #include <core/producer/scene/scene_producer.h>
 #include <core/producer/scene/xml_scene_producer.h>
 #include <core/producer/text/text_producer.h>
+#include <core/producer/color/color_producer.h>
 #include <core/consumer/output.h>
 #include <core/mixer/mixer.h>
 #include <core/mixer/image/image_mixer.h>
@@ -167,6 +168,7 @@ struct server::impl : boost::noncopyable
                initialize_modules(dependencies);
                core::text::init(dependencies);
                core::scene::init(dependencies);
+               help_repo_->register_item({ L"producer" }, L"Color Producer", &core::describe_color_producer);
        }
 
        void start()