gpt4 book ai didi

c++ - C++ 圆角

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:15:55 30 4
gpt4 key购买 nike

我正在寻找一些 c++ 绘图图形库来为动态键盘键创建器创建带有抗锯齿选项的圆角。我已经测试过 OpenCV 和 Magick++ 函数,但结果不是很好。谁能帮我解决这个问题?

这是一个使用 Magick++ 库创建圆角的代码示例

void create_rounded_image (int size, int border) {
Magick::Image image_bk (Magick::Geometry (size, size), Magick::Color ("black"));

image_bk.strokeColor ("white");
image_bk.fillColor ("white");
image_bk.strokeWidth(1);
image_bk.draw (DrawableCircle(size, size, size*0.3, size*0.3));

image_bk.write ("rounded.png");
}

这是我得到的结果

This is the result I'm getting

这就是我要的结果

This is the result I'm looking for

最佳答案

在线谷歌搜索 documentation ,我发现:

strokeAntiAlias - bool - Enable or disable anti-aliasing when drawing object outlines.

我建议:

image_bk.strokeAntiAlias(true); 

关于c++ - C++ 圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37047600/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com