【问题标题】:setting the line pattern using CIMG for c++使用 CIMG for c++ 设置线型
【发布时间】:2016-09-21 21:19:57
【问题描述】:

我正在尝试学习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. 

我的问题是模式,我无法在文档中找到哪些整数代表哪种线。有谁现在如何操纵模式?

提前谢谢你

【问题讨论】:

    标签: c++ cimg


    【解决方案1】:

    其中一位开发人员通过电子邮件向我回复了这个问题,我将其发布在此处以供有相同问题的任何人使用。

    模式由 unsigned int 中的位的设置方式给出。 您必须将无符号整数视为 32 像素的模式(即 32 位),可以是透明的(位设置为 0)或不透明的(位设置为 到 1)。 例如,所有位都设置为 1 的模式是完全不透明的,并且 对应于模式值 0xFFFFFFFF。 8 个像素是透明的,然后是 8 个像素是不透明的图案 对应于模式 0xFF00FF00。 像 0xCCCCCCCC 这样的图案意味着 1 个像素透明,然后 1 个像素不透明, 等等……

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多