问题标签 [cairo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
960 浏览

python - (py)cairo - 填充

有没有办法填充封闭路径(多边形)之外的所有内容?

背景:我想用海岸线渲染一些地图 - 所以有时我需要用蓝色填充大海,所以我认为用蓝色填充这个海岸线多边形之外的所有东西是最简单的,在我的情况下也是最有效的颜色。

提前致谢!

0 投票
1 回答
1672 浏览

graphics - How to do off-screen drawing using Cairo in Gtk+?

I'm trying to do my drawing stuff in an Cairo Image Context. Is there a way to load the content of the Image context to a Cairo Context on expose event?

For example I want to draw a series of dots based on cursor movements over a drawing area, If I want to keep all the dots I should use an off-screen buffer, so I use an Image Context, but I cannot find a way to draw it to the Cairo Context on expose event...

any solution?

0 投票
1 回答
1394 浏览

gtk - 如何将 Cairo Image 表面的内容写入 Gdk Pixbuf?

我有一个画布(Gdk 绘图区),我可以使用 Cairo 将其绘制到其中,但我需要将画布的内容保存到缓冲区中,在我的情况下是 Gdk Pixbuf。我想知道这是否可能,是否有更好的方法我想知道。

谢谢。

0 投票
1 回答
64 浏览

gtk - gtk 中的仿射变换

我需要使用 gtk 框架进行一些仿射变换操作。

我找到了 cairo,但这并不能解决我的要求。我需要创建转换对象并进行一些操作,如下所示:

  1. [transform1 translateXBy:2.5 yBy:3.8];
  2. [transform1 rotateByDegrees:23.0];
  3. [transform1 appendTransform:transform2];

其中 transform1、transform2 是 AffineTransformation 的对象。

问候, iSight

0 投票
1 回答
49 浏览

gtk - 改造 GdkPoint

如何转换 gdkpoint?说:

0 投票
1 回答
675 浏览

animation - Why do fonts in Pango change weight when text is rotated in Cairo?

I'm having a problem with Pango rendering under a rotated matrix. I'm attempting to draw a label (see code below) which happens inside of an animating Cairo matrix rotation.

As the label rotates, the text jitters, seeming to grow and shrink in weight, becoming thickest at diagonal angles, and thinnest at orthogonal angles. See this comparison:

http://www5.picturepush.com/photo/a/4666818/640/Anonymous/pango-rotation.jpg

I'd like the rotated text to generate as if it were just rotating shape paths, and not trying to change the look of the text based on the angle. Any ideas of how I could do this?

Thanks, Sean

0 投票
1 回答
3126 浏览

python - Python + Cairo:如何保存绘图?

假设我在窗口中创建了一个空白区域并在其中绘制了一些线条,我如何将其保存为 .png 或 .jpg?或者也许将其转换为 PIL 可以理解的对象?

0 投票
1 回答
1591 浏览

gtk - 如何从 Cairo 上下文创建 GtkImage?

我得到了一个使用 Cairo 上下文工作的绘制函数,最终结果应该是一个 GtkImage(没有中间图像创建)。我尝试使用 gdk_cairo_create 函数,但是这段代码:

失败:

Gdk-CRITICAL **:IA__gdk_cairo_create:断言“GDK_IS_DRAWABLE(可绘制)”失败

与一个简单的相同:

我不明白为什么这会失败。任何帮助表示赞赏!

0 投票
5 回答
5154 浏览

python - 如何对绘制 PDF 图形的 Python 函数进行单元测试?

我正在编写一个使用 Cairo 图形库输出 PDF 文件的 CAD 应用程序。许多单元测试不需要实际生成 PDF 文件,例如计算对象的预期边界框。但是,我想确保在更改代码后生成的 PDF 文件“看起来”正确。有没有一种自动化的方法来做到这一点?我怎样才能尽可能地自动化?我是否需要目视检查每个生成的 PDF?我怎样才能在不拔头发的情况下解决这个问题?

0 投票
1 回答
1948 浏览

image - 将图像的一部分绘制到 cairo 表面

我正在使用 pygtk 和 cairo(......我必须说的很棒的东西。谢谢大家)

我想知道如何在我的 cairo 表面上的大型绘图区域上呈现部分图像。

我希望显示表面内的区域看起来像是被剪裁的,这样我就可以在这些区域中滚动图像而不会干扰周围的绘制项目。

我可以将用于零件绘图的图像剪切到表面上,还是必须以正确的顺序获取绘图顺序,以便需要剪切的图像重叠,因此部分根据需要隐藏并显示为已剪切?

感谢您的任何指点

缺口