cairo

Precision timing of GDK3/GTK3 window update

北慕城南 提交于 2019-12-11 03:21:50
问题 I have an application written in C using GTK (although the language is probably unimportant for this question). This application has a fullscreen gtk_window with a single gtk_drawing_area . For the drawing area, I have registered a tick callback via gtk_widget_add_tick_callback which just calls gtk_widget_queue_draw every tick. Inside the drawing area draw callback, I change the color of the entire window at regular intervals (e.g., from black to white at 1Hz). Say that in this call to the

How to run and compile a cairo file in ubuntu

烈酒焚心 提交于 2019-12-11 03:21:23
问题 I wanted to use cairo library for c++ graphics. I included the libraries using sudo apt-get install libcairo2-dev and further I installed GLX-Dock(Cairo Dock with OpenGL) using Ubuntu open software center and used the code in http://cairographics.org/FAQ/ and compiled with command g++ trial.cpp but it gives me the following error fatal error: cairo.h: No such file or directory compilation terminated. How should i compile and run the file? Moreover can someone recommend easy to learn graphics

Django: How to render image with a template

余生颓废 提交于 2019-12-11 02:38:35
问题 Objective: I would like to display a generated .png image using a template. I worked with the example here. Here is the final snippet of code from that example: def gen_chart(request): ... pp = CairoPlot.PiePlot(surface, data, heigth, width, background = None, gradient = True, shadow = True, series_colors = colors ) pp.render() response = HttpResponse(mimetype="image/png") pp.surface.write_to_png(response) return response Accessing the gen_chart view shows a pretty pie chart. However, I'd

Cairo and memory leaks fix with valgrind

邮差的信 提交于 2019-12-11 01:28:20
问题 In my program, even if do all the obvious housekeeping, such as calling cairo_destroy() , cairo_surface_destroy() ..., valgrind always finds memory leaks, the leaks are in cairo dependencies ( freetype , pixman , ...). How do I cleanup after cairo , so that valgrind won't detect any leaks, or are the leaks normal? Sample output ==1861== HEAP SUMMARY: ==1861== in use at exit: 1,996,663 bytes in 532 blocks ==1861== total heap usage: 21,915 allocs, 21,383 frees, 95,411,698 bytes allocated ==1861

Installing pycairo under ubuntu

天涯浪子 提交于 2019-12-10 18:51:51
问题 For some reason I can't get python to find cairo. When I did ./waf configure I got Setting top to : /home/user/pycairo/py2cairo-1.10.0 Setting out to : /home/user/pycairo/py2cairo-1.10.0/build_directory ./configure() Checking for 'gcc' (c compiler) : ok Checking for program python : /usr/bin/python Checking for python version : (2, 7, 2, 'final', 0) Checking for library python2.7 : yes Checking for program python2.7-config : /usr/bin/python2.7-config Checking for header Python.h : yes

Cairo example works with Python 2.7 but does not work in Python 3

≡放荡痞女 提交于 2019-12-10 17:18:24
问题 The simplest example. We create a window by means of Gtk, we add there area for drawing of Gtk.DrawingArea and on it we draw the text by means of Cairo. Example: #!/usr/bin/env python from gi.repository import Gtk import cairo class MyWindow (Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title='MyWindow') darea = Gtk.DrawingArea() darea.connect('draw', self.on_draw) self.add(darea) def on_draw(self, widget, ctx): ctx.set_source_rgb(0, 0, 0) ctx.select_font_face("Sans", cairo.FONT

how to install pycairo for python 3 on Ubuntu 10.04

隐身守侯 提交于 2019-12-10 14:30:04
问题 i am trying to install pycairo 1.10.0 for use with my custom-build python 3.1. however, sudo /flower/bin/easy_install-3.1 pycairo fails with XXX@XXXX:/adventures$ sudo /flower/bin/easy_install-3.1 pycairo install_dir /flower/lib/python3.1/site-packages/ Searching for pycairo Reading http://pypi.python.org/simple/pycairo/ Reading http://cairographics.org/pycairo Best match: pycairo 1.10.0 Downloading http://cairographics.org/releases/pycairo-1.10.0.tar.bz2 Processing pycairo-1.10.0.tar.bz2

How to install pycairo on osx?

夙愿已清 提交于 2019-12-10 12:56:30
问题 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 compile node.js module canvas on RedHat OpenShift servers?

℡╲_俬逩灬. 提交于 2019-12-10 11:51:46
问题 On RedHat OpenShift servers it is not possible to compile node.js module canvas, because there are missing cairo libraries for the linux, and related required libraries as well. 回答1: This is how to make it compile: export PATH=/sbin:$PATH:$OPENSHIFT_DATA_DIR/usr/local/bin export LD_LIBRARY_PATH=$OPENSHIFT_DATA_DIR/usr/local/lib:/opt/rh/nodejs010/root/usr/lib64:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=$OPENSHIFT_DATA_DIR/usr/local/lib/pkgconfig cd $OPENSHIFT_DATA_DIR curl -L http://sourceforge

pdfcairo 'unknown or ambiguous terminal type' in gnuplot

一笑奈何 提交于 2019-12-10 11:37:43
问题 After upgrading gnuplot from 4.6 to 5.0.1 , I encounter the following error: set terminal pdfcairo size 3.0in,2.25in font ',8' ^ "plot.plt", line 114: unknown or ambiguous terminal type; type just 'set terminal' for a list How can I fix it? PS: pdfcairo works fine in the previous version (4.6). I install the gnuplot by the following command: #build it: ./configure --with-cairo make #install it: sudo make install As described in GNUPLOT Version 5.0.1 Release Notes, the pdfcairo is included by