在c++中使用CIMG设置行模式
setting the line pattern using CIMG for c++
我正在尝试学习Cimg,但有时文档非常模糊。我正在使用绘图函数,我想画一条线。函数声明非常简单:
CImg<T>& draw_line ( const int x0,
const int y0,
const int x1,
const int y1,
const tc *const color,
const float opacity = 1,
const unsigned int pattern = ~0U,
const bool init_hatch = true
)
,
x0 X-coordinate of the starting line point.
y0 Y-coordinate of the starting line point.
x1 X-coordinate of the ending line point.
y1 Y-coordinate of the ending line point.
color Pointer to spectrum() consecutive values of type T, defining the drawing color.
opacity Drawing opacity.
**pattern An integer whose bits describe the line pattern.**
init_hatch Tells if a reinitialization of the hash state must be done.
我的问题是模式,我没能在文档中找到哪个整数代表哪一种行。有人知道如何操作这个模式吗?
提前感谢
一位开发人员通过电子邮件回答了我这个问题,我把它贴在这里供任何有同样问题的人使用。
该模式由unsigned int型的位的设置方式给出。你必须把你的无符号整数看作一个32像素的模式。32位),可以是透明的(位设置为0)或不透明的(位设置为0)1)。例如,所有位都设置为1的模式是完全不透明的,并且对应模式值0xFFFFFFFF。其中8个像素是透明的,然后8个像素是不透明的对应模式0xFF00FF00。像0xCCCCCCCC这样的模式表示1像素透明,然后1像素不透明,等等…
相关文章:
- 是否允许使用带有"w+"模式的 freopen 进行标准设置?
- 如何在使用 MPFR 时在提升多精度中设置舍入模式
- 直接显示 - 无法使用设置模式设置静止引脚
- 基于 std::vector <string>的内容动态设置顺序的模式
- 将 GtkTreeView 中的单元格设置为以编程方式编辑模式
- 将终端设置为原始模式:仅在按下下一个键后显示字符
- 如何自动将流模式设置回默认值
- 如何使用适用于 Mac 和 Windows 10 的 vscode 设置同步插件配置C++智能感知模式
- 将焦点设置在MFC视图中托管的无模式对话框上
- 哪些VS2010 C项目设置导致执行器需要兼容模式
- OpenCV安卓人像模式全屏设置
- 在Android上为OpenCV设置相机场景模式
- 如何设置从非阻塞模式的服务器客户端接收消息的超时
- 在全屏模式下设置控制台字体大小
- 如何在工厂设计模式中设置派生产品类的数据成员
- Qt:无法设置拖动模式
- 如果从文件流中读取数据,gSOAP为什么将stdin模式设置为二进制
- 将1d矩阵模式设置为等于2d矩阵
- emacs的c++ 11模式或设置
- 为什么在设置模式时,使用 getline 会导致"Debug assertion failed"消息?