cairo

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

How to install pycairo on osx?

蓝咒 提交于 2019-11-28 09:16:02
I am trying to install the pycairo (Python bindings for the cairo graphics library ) under OSX. I started with easy_install pycairo and got: Requested 'cairo >= 1.8.8' but version of cairo is 1.0.4 error: Setup script exited with Error: cairo >= 1.8.8 not found So I went to cairo's site and downloaded the latest package (1.8.8) of cairo, and also the latest package of something called pixman (both source packages -- couldn't find osx binaries) unzipped both, each in own directory. for pixman, the regular ./configure ; make ; sudo make install worked just find for cairo, ./configure seemed to

How to unit test a Python function that draws PDF graphics?

女生的网名这么多〃 提交于 2019-11-28 08:18:57
I'm writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected bounding boxes of the objects. However, I want to make sure that the generated PDF files "look" correct after I change the code. Is there an automated way to do this? How can I automate as much as possible? Do I need to visually inspect each generated PDF? How can I solve this problem without pulling my hair out? You could capture the PDF as a bitmap (or at least a losslessly-compressed) image, and

Making a screenshot using Xlib and Cairo libs [fail]

心不动则不痛 提交于 2019-11-28 06:47:16
问题 I'm trying to make a screenshot using Xlib and Cairo , however I'm not sure to do it the good way, "stride" is really confusing me. Here's the code : #include <stdio.h> #include <stdlib.h> #include <malloc.h> #include <cairo.h> #include <X11/Xlib.h> #include <X11/Xutil.h> int main(int argc, char** argv) { int x, y; Display *disp; Window root; XWindowAttributes watts; XImage *image; cairo_surface_t *surface; unsigned int width; unsigned int height; int stride; disp = XOpenDisplay(NULL); root =

Difference between GtkWindow and GdkWindow?

江枫思渺然 提交于 2019-11-27 21:19:39
问题 At the beginning of my Gtk-Gdk-Cairo-Pango app, I create the window: GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); First, there is GtkWindow , but gtk_create_window returns GtkWidget , not GtkWindow , why? Then, some functions, like gdk_window_process_updates(..) require GdkWindow* . gtk_window_set_geometry_hints() on the other hand requires GtkWindow* . In documentation there is also GdkWindow* gdk_window_new() that returns GdkWindow . Sure there is documentation saying: A

Package cairo was not found in the pkg-config search path. Node j.s install canvas issue

好久不见. 提交于 2019-11-27 12:15:53
I am having a problem installing installing the canvas module in node..It seems to be something with cairo I am getting this error... npm http GET https://registry.npmjs.org/canvas npm http 304 https://registry.npmjs.org/canvas npm http GET https://registry.npmjs.org/nan npm http 304 https://registry.npmjs.org/nan > canvas@1.1.3 install /Users/plimb/Desktop/motion-therapy/node_modules/canvas > node-gyp rebuild Package cairo was not found in the pkg-config search path. Perhaps you should add the directory containing `cairo.pc' to the PKG_CONFIG_PATH environment variable No package 'cairo' found

Error with Python ctypes and librsvg

天涯浪子 提交于 2019-11-27 07:08:48
问题 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 =

How to install pycairo on osx?

落花浮王杯 提交于 2019-11-27 02:46:52
问题 I am trying to install the pycairo (Python bindings for the cairo graphics library) under OSX. I started with easy_install pycairo and got: Requested 'cairo >= 1.8.8' but version of cairo is 1.0.4 error: Setup script exited with Error: cairo >= 1.8.8 not found So I went to cairo's site and downloaded the latest package (1.8.8) of cairo, and also the latest package of something called pixman (both source packages -- couldn't find osx binaries) unzipped both, each in own directory. for pixman,

How to unit test a Python function that draws PDF graphics?

末鹿安然 提交于 2019-11-27 02:13:59
问题 I'm writing a CAD application that outputs PDF files using the Cairo graphics library. A lot of the unit testing does not require actually generating the PDF files, such as computing the expected bounding boxes of the objects. However, I want to make sure that the generated PDF files "look" correct after I change the code. Is there an automated way to do this? How can I automate as much as possible? Do I need to visually inspect each generated PDF? How can I solve this problem without pulling

Package cairo was not found in the pkg-config search path. Node j.s install canvas issue

妖精的绣舞 提交于 2019-11-26 15:57:06
问题 I am having a problem installing installing the canvas module in node..It seems to be something with cairo I am getting this error... npm http GET https://registry.npmjs.org/canvas npm http 304 https://registry.npmjs.org/canvas npm http GET https://registry.npmjs.org/nan npm http 304 https://registry.npmjs.org/nan > canvas@1.1.3 install /Users/plimb/Desktop/motion-therapy/node_modules/canvas > node-gyp rebuild Package cairo was not found in the pkg-config search path. Perhaps you should add