pycairo

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 中的变换

pyCairo: How to resize and position an image?

百般思念 提交于 2019-11-29 19:14:23
问题 Based on the question Create PDF with (resized) PNG images using Pycairo - rescaling Surface issue I have attempted to create code that rescales and places an image at a specific position, as shown in the code below (in this case, for example, the images should appear "over" the underlying rectangles). However, I cannot seem to get the image to appear at the correct location(s). I'd appreciate knowing what I must change, in order to both scale and position an image correctly. import cairo if

PyCairo - installation on Windows

最后都变了- 提交于 2019-11-29 15:36:34
I see there is an old question about a similar thing here. So I did some research already, please don't close my question just like that. How do you install PyCairo (Cairo for Python) on Windows? Since it's from 2012, I guess it's out of date. I am trying to install pycairo on my Windows 7 64-bit laptop where I have Python 3.6.3 installed. I also have the latest setuptools installed if that matters. I am facing the error below. C:\Programs\Python36>python Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license"

How do you install PyCairo (Cairo for Python) on Windows?

。_饼干妹妹 提交于 2019-11-29 03:09:11
I spent hours this afternoon trying to find a straightforward tutorial for installing PyCairo on Windows. The Cairo project itself does not maintain Windows binaries, they must be dowloaded elsehere (e.g. http://ftp.gnome.org/pub/GNOME/binaries/win32/pycairo/ ). The process is also complicated further apparently by the fact that MSVC is apparently not a supported compiler for PyCairo (although the source patch is simple). See this bug report: https://www.libreoffice.org/bugzilla/show_bug.cgi?id=22940 Can anyone recommend a tutorial for installing PyCairo on Windows? You should try windows

How to install PyCairo 1.10 on Mac OSX with default python

守給你的承諾、 提交于 2019-11-28 21:25:07
Has anyone installed pycairo 1.10 on the mac using the new waf build? Its failing on can't find python headers. I think waf is seriously broken for Mac OS X :( Here's how it worked for me. After python waf configure failed to find Python.h, I looked through the config.log file located in build_directory and found out that the true cause of failure was incompatible architecture. The waf script tries to build a simple source file with CPython calls in it using i386 architecture. It fails to do so, because my python is built for the x86_64 architecture. I guess, you could rebuild python as a

Install pycairo in virtualenv

不打扰是莪最后的温柔 提交于 2019-11-28 17:50:50
I've tried to install pycairo in a virtualenv to use in a Django project. I've ran the pip install pycairo==1.10.0 command which finds the package and downloads it unlike other commands like pip install pycairo , etc. but when starting to install the package it throws an error. Here's the log: Downloading/unpacking pycairo==1.10.0 Running setup.py egg_info for package pycairo Traceback (most recent call last): File "<string>", line 14, in <module> IOError: [Errno 2] No such file or directory: '/home/radu/Desktop/djangos/workout/venv/build/pycairo/setup.py' Complete output from command python

Error with Python ctypes and librsvg

只谈情不闲聊 提交于 2019-11-28 12:33:03
I'm trying to wrap basic function of librsvg with ctypes for Python, but I'm getting a segfault. C: // pycairo excerpt typedef struct { PyObject_HEAD cairo_t *ctx; PyObject *base; /* base object used to create context, or NULL */ } PycairoContext; // librsvg excerpt RsvgHandle * rsvg_handle_new_from_file (const gchar * file_name, GError ** error); // ... gboolean rsvg_handle_render_cairo (RsvgHandle * handle, cairo_t * cr); Python ctypes: from ctypes import * from ctypes import util librsvg = cdll.LoadLibrary('/brew/lib/librsvg-2.2.dylib') libgobject = cdll.LoadLibrary('/brew/lib/libgobject-2

Save the contents of a Gtk.DrawingArea or Cairo pattern to an image on disk

帅比萌擦擦* 提交于 2019-11-28 10:57:26
问题 I've got a small PyGI project which uses a Cairo image surface, which I then scale with a surface pattern and render on a Gtk.DrawingArea. I'd like to write the scaled version to a PNG file. I've tried to write from the original surface with Surface.write_to_png(), but it only writes in the original (i.e. non-scaled) size, so I'm stuck in there. Then I thought I could perhaps fetch the rendered image from the Gtk.DrawingArea and write that to disk, but I haven't found out how to do that in

Installation of PyCairo on Windows

China☆狼群 提交于 2019-11-28 09:15:36
问题 I see there is an old question about a similar thing here: How do you install PyCairo (Cairo for Python) on Windows? Since it's from 2012, I guess it's out of date. I am trying to install pycairo on my Windows 7 64-bit laptop where I have Python 3.6.3 installed. I also have the latest setuptools installed if that matters. I am facing the error below. C:\Programs\Python36>python Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright",

pycairo “ImportError: DLL load failed: The specified module could not be found.” even after DLLs installed

六眼飞鱼酱① 提交于 2019-11-27 15:09:01
I'm following the pycairo installation instructions here : http://www.cs.rhul.ac.uk/home/tamas/development/igraph/tutorial/install.html to install pycairo for use with igraph. However, even after running the installer and unzipping/copying all DLL's into the site-packages cairo directory according to the instructions, I still get the following error: >>> import cairo Traceback (most recent call last): File "", line 1, in File "c:\Python26\lib\site-packages\cairo__init__.py", line 1, in from _cairo import * ImportError: DLL load failed: The specified module could not be found. >>> I am running