cairo

get cairosvg working in windows

我怕爱的太早我们不能终老 提交于 2019-12-05 12:25:42
Trying to get this code working: import cairosvg import os path = "D:/PyProjects/Bla/Temp" os.chdir(path) cairosvg.svg2pdf(url='Pic.svg', write_to='image.pdf') but get errors along similar to this post : Traceback (most recent call last): File "D:/work/lean_python/pdf/other.py", line 2, in <module> import cairosvg File "D:\env_python352\lib\site-packages\cairosvg\__init__.py", line 29, in <module> from . import surface File "D:\env_python352\lib\site-packages\cairosvg\surface.py", line 24, in <module> import cairocffi as cairo File "D:\env_python352\lib\site-packages\cairocffi\__init__.py",

Failed to install “Cairocffi”

独自空忆成欢 提交于 2019-12-04 18:55:19
问题 I'm working with python3, and i'm trying to install " cairocffi " on Ubuntu. To do this, i've successfully installed: python-dev libffi-dev cffi But when i've trying to install "cairocffi" with pip install cairocffi ,I got: File "/usr/local/lib/python3.2/dist-packages/setuptools/dist.py", line 272 , in __init__ _Distribution.__init__(self,attrs) File "/usr/lib/python3.2/distutils/dist.py", line 261, in __init__ self.finalize_options() File "/usr/local/lib/python3.2/dist-packages/setuptools

How can I render Text with transparent background over other widgets in GTK?

风流意气都作罢 提交于 2019-12-04 17:40:06
I wish to render text with transparent/translucent background (or no background) over other gtk widgets like GtkImage or GtkButton etc. Primary goal is to have text display over Gtk Widgets (esp. GtkImage) in the background. I can render text on GtkFrame using pangocairo library but I am not able to get rid of the background of GtkFrame. I have seen examples of making GtkWindow transparent or translucent but I wish to have opaque GtkWindow with GtkLayout for placing the GtkWidgets, then place GtkImage over the layout and render Text on top of GtkImage so that it gives a nice background to my

ZetCode 绘图教程

二次信任 提交于 2019-12-04 12:05:11
来源: ApacheCN ZetCode 翻译项目 译者: 飞龙 协议: CC BY-NC-SA 4.0 贡献指南 本项目需要校对,欢迎大家提交 Pull Request。 请您勇敢地去翻译和改进翻译。虽然我们追求卓越,但我们并不要求您做到十全十美,因此请不要担心因为翻译上犯错——在大部分情况下,我们的服务器已经记录所有的翻译,因此您不必担心会因为您的失误遭到无法挽回的破坏。(改编自维基百科) 目录 Java 2D 游戏教程 Java 游戏基础 动画 移动精灵 碰撞检测 Java 益智游戏 Java Snake Breakout 游戏 Java 俄罗斯方块 Java 吃豆人 Java 太空侵略者 Java 扫雷 Java 推箱子 Java 2D 教程 介绍 基本绘图 形状和填充 透明度 合成 剪裁 变换 特效 图像 文字和字体 命中测试,移动物体 俄罗斯方块 Cario 图形教程 Cario 图形库 Cario 定义 Cairo 后端 Cairo 基本图形 形状和填充 渐变色 透明度 合成 剪裁和遮罩 变换 Cairo 文字 Cairo 中的图像 根窗口 PyCairo 教程 PyCairo 简介 PyCairo 后端 PyCairo 中的基本绘图 PyCairo 形状和填充 PyCairo 渐变 PyCairo 剪裁&遮罩 PyCairo 的透明度 PyCairo 中的变换

gnuplot - pdf terminal - setting unicode character (solar mass symbol/odot)

杀马特。学长 韩版系。学妹 提交于 2019-12-04 11:18:45
问题 I'm trying to set the LaTeX \odot symbol in the gnuplot (4.6.0) pdf terminal. What is the exact syntax for this? The gnuplot FAQ gives some clues, but should I type {/Symbol \2299} , or {/utf8 \2299} , or some other variation on \ , / , # etc.? Or should I do set encoding utf8 ? Pasting the symbol in directly does not seem to work. Should I use pdf or pdfcairo for the terminal? The latter affects my plots in intolerable ways. 回答1: It is pretty simple. First you need to select a terminal that

load svg with Cairo

我的未来我决定 提交于 2019-12-04 08:14:29
I want to load a SVG file with the Cairo library, do apply some transformations to it. Then I want to display my svg with a glTexture. But I just find functions which create svg file and not load svg. Uli Schlachter Cairo itself cannot read SVG files. You need something like librsvg to render SVGs to a Cairo surface. From a quick look at their API documentation , it looks like you need rsvg_handle_new_from_file() to load a file and something like rsvg_handle_render_cairo() or rsvg_handle_get_pixbuf() to draw the SVG to a Cairo context / to turn the SVG into a GdkPixbuf. 来源: https:/

How to return an image in an HTTP response with CherryPy

时光总嘲笑我的痴心妄想 提交于 2019-12-03 14:05:36
I have code which generates a Cairo ImageSurface , and I expose it like so: def preview(...): surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) ... cherrypy.response.headers['Content-Type'] = "image/png" return surface.get_data() preview.exposed = True This doesn't work (browsers report that the image has errors). I've tested that surface.write_to_png('test.png') works, but I'm not sure what to dump the data into to return it. I'm guessing some file-like object? According to the pycairo documentation , get_data() returns a buffer. I've also now tried: tempf = os.tmpfile()

Can cairo use SDL_Texture as a render target?

冷暖自知 提交于 2019-12-03 12:37:00
问题 Rendering to an SDL_Surface is possible with Cairo, but my application uses SDL_Renderer and SDL_Texture to take advantage of 2D accelerated rendering. I am currently creating an SDL_Surface and copying it to a texture with SDL_CreateTextureFromSurface(), but this process is cumbersome and possibly slow (although it's not a bottleneck.) Is there a direct way to draw to a SDL_Texture? 回答1: I've figured it out. Streaming SDL_Textures can expose the raw pixels in the ARGB8888 format, which is a

gnuplot - pdf terminal - setting unicode character (solar mass symbol/odot)

笑着哭i 提交于 2019-12-03 06:50:56
I'm trying to set the LaTeX \odot symbol in the gnuplot (4.6.0) pdf terminal. What is the exact syntax for this? The gnuplot FAQ gives some clues, but should I type {/Symbol \2299} , or {/utf8 \2299} , or some other variation on \ , / , # etc.? Or should I do set encoding utf8 ? Pasting the symbol in directly does not seem to work. Should I use pdf or pdfcairo for the terminal? The latter affects my plots in intolerable ways. Lee Phillips It is pretty simple. First you need to select a terminal that supports Unicode; then you can indeed paste your Unicode characters in directly. The old pdf

How do I change the mouse cursor over a GtkDrawingArea in GTK3?

你。 提交于 2019-12-02 16:19:37
问题 This follows from my previous question, I am trying to set the mouse cursor to cross hair when hovering over a GtkDrawingArea. I am trying to apply the answer from ebassi to the following code from zetcode. So far I have got: #include <cairo.h> #include <gtk/gtk.h> static void do_drawing(cairo_t *); struct { int count; double coordx[100]; double coordy[100]; } glob; static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr, gpointer user_data) { do_drawing(cr); return FALSE; } static void