Expose paint blend references in CLI
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "document/ppi_import.h"
|
||||
#include "foundation/parse.h"
|
||||
#include "foundation/result.h"
|
||||
#include "paint/blend.h"
|
||||
#include "paint/stroke.h"
|
||||
#include "paint/stroke_script.h"
|
||||
#include "renderer_api/recording_renderer.h"
|
||||
@@ -240,6 +241,7 @@ void print_help()
|
||||
<< " simulate-document-edits [--width N] [--height N]\n"
|
||||
<< " simulate-document-export [--width N] [--height N]\n"
|
||||
<< " simulate-document-history [--width N] [--height N] [--history N]\n"
|
||||
<< " simulate-blend\n"
|
||||
<< " simulate-image-import [--width N] [--height N]\n"
|
||||
<< " simulate-stroke --x1 N --y1 N --x2 N --y2 N [--spacing N]\n"
|
||||
<< " simulate-stroke-script --path FILE\n"
|
||||
@@ -1365,6 +1367,63 @@ int simulate_stroke_script(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int simulate_blend(int argc, char**)
|
||||
{
|
||||
if (argc > 2) {
|
||||
print_error("simulate-blend", "unknown option");
|
||||
return 2;
|
||||
}
|
||||
|
||||
const auto normal = pp::paint::blend_pixels(
|
||||
pp::paint::Rgba { .r = 0.2F, .g = 0.4F, .b = 0.6F, .a = 0.5F },
|
||||
pp::paint::Rgba { .r = 0.8F, .g = 0.2F, .b = 0.1F, .a = 0.25F },
|
||||
pp::paint::BlendMode::normal);
|
||||
const auto multiply = pp::paint::blend_pixels(
|
||||
pp::paint::Rgba { .r = 0.25F, .g = 0.5F, .b = 0.75F, .a = 1.0F },
|
||||
pp::paint::Rgba { .r = 0.5F, .g = 0.5F, .b = 0.5F, .a = 1.0F },
|
||||
pp::paint::BlendMode::multiply);
|
||||
const auto stroke_normal = pp::paint::blend_stroke_alpha(
|
||||
0.2F,
|
||||
0.8F,
|
||||
0.25F,
|
||||
pp::paint::StrokeBlendMode::normal);
|
||||
const auto stroke_linear_height = pp::paint::blend_stroke_alpha(
|
||||
0.5F,
|
||||
0.25F,
|
||||
0.16F,
|
||||
pp::paint::StrokeBlendMode::linear_height);
|
||||
const auto stroke_height = pp::paint::blend_stroke_alpha(
|
||||
0.5F,
|
||||
0.25F,
|
||||
0.16F,
|
||||
pp::paint::StrokeBlendMode::height);
|
||||
const auto stroke_unknown = pp::paint::blend_stroke_alpha(
|
||||
0.2F,
|
||||
0.2F,
|
||||
0.5F,
|
||||
static_cast<pp::paint::StrokeBlendMode>(255));
|
||||
|
||||
std::cout << "{\"ok\":true,\"command\":\"simulate-blend\""
|
||||
<< ",\"finalBlendModes\":5"
|
||||
<< ",\"strokeBlendModes\":11"
|
||||
<< ",\"normal\":{\"r\":" << normal.r
|
||||
<< ",\"g\":" << normal.g
|
||||
<< ",\"b\":" << normal.b
|
||||
<< ",\"a\":" << normal.a
|
||||
<< "}"
|
||||
<< ",\"multiply\":{\"r\":" << multiply.r
|
||||
<< ",\"g\":" << multiply.g
|
||||
<< ",\"b\":" << multiply.b
|
||||
<< ",\"a\":" << multiply.a
|
||||
<< "}"
|
||||
<< ",\"stroke\":{\"normal\":" << stroke_normal
|
||||
<< ",\"linearHeight\":" << stroke_linear_height
|
||||
<< ",\"height\":" << stroke_height
|
||||
<< ",\"unknown\":" << stroke_unknown
|
||||
<< "}}\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
pp::foundation::Status parse_apply_stroke_script_args(int argc, char** argv, ApplyStrokeScriptArgs& args)
|
||||
{
|
||||
for (int i = 2; i < argc; ++i) {
|
||||
@@ -2814,6 +2873,10 @@ int main(int argc, char** argv)
|
||||
return simulate_stroke_script(argc, argv);
|
||||
}
|
||||
|
||||
if (command == "simulate-blend") {
|
||||
return simulate_blend(argc, argv);
|
||||
}
|
||||
|
||||
if (command == "apply-stroke-script") {
|
||||
return apply_stroke_script(argc, argv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user