将图像magick命令转换为magick++ c++代码
我是 Magick++ 的新手。我正在开发一个动态制作按钮图像对象的项目。浏览一些帮助页面,我能够创建以下转换命令来满足我的需求。现在我正在尝试将其迁移到 C++。提前感谢您的帮助。
convert \( -size 110x30 xc:none -fill '#bdbdbd' -draw 'roundrectangle 0,0 109,29 5,5' \) \
\( -clone 0 -alpha extract \) \
\( -clone 0 -bordercolor none -border 9 -channel rgba -blur 9x65000 -shave 9x9 \) \
-delete 0 +swap -alpha off -compose copy_opacity -composite -auto-level -alpha off +level-colors '#0D5A84','#19AAF9' -alpha on tmp-1.png
double width = 110.0;
double height = 30.0;
Magick::Image button(Magick::Geometry(width, height), "none");
button.fillColor("#bdbdbd"); // Fill color
button.draw(Magick::DrawableRoundRectangle(0.0/*XCenter*/, 0.0/*YCenter*/,
width-1.0, height-1.0, 5.0/*cornerWidth*/, 5.0/*cornerHeight*/));
// \( -clone 0 -alpha extract \)
Magick::Image layer1(button);
layer1.alpha(); // how to set alpha extract and how this layer is used?
//\( -clone 0 -bordercolor none -border 9 -channel rgba -blur 9x65000 -shave 9x9 \)
Magick::Image layer2(button);
layer2.bordercolor("none");
layer2.border(Magick::border()); //parameter is of type Geometry not double
layer2.channel(RGBChannels); //rgba
layer2.blur(9, 65000);
layer2.shave(Magick::Geometry(9, 9));
//how to -delete 0
//how to +swap
button.alpha(false);
button.composite(layer2, "+0+0", MagickCore::CompositeOperator::OverCompositeOp); //-compose copy_opacity -composite
button.alpha(false);
//how to level colors
button.alpha(true);
button.write("button.png");