Questions tagged [cairo]

Cairo is a software library used to provide a vector graphics-based, device-independent API for software developers.

Cairo is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends. Cairo is designed to use hardware acceleration when available.

Although written in C, there are bindings for using the cairo graphics library from many other programming languages, including C++, Factor, Haskell, Lua, Perl, Python, Ruby, Scheme, Smalltalk and several others. Dual licensed under the GNU Lesser General Public License and the Mozilla Public License, cairo is free software.

Cairo Homepage includes documentation and examples.

1254 questions
8
votes
3 answers

What is the fastest way to draw an image in Gtk+?

I have an image/pixbuf that I want to draw into a gtk.DrawingArea and refresh frequently, so the blitting operation has to be fast. Doing it the easy way: def __init__(self): self.drawing_area = gtk.DrawingArea() self.image =…
Grumbel
  • 6,585
  • 6
  • 39
  • 50
8
votes
2 answers

Weasyprint get undefined property at invoking write_pdf: "AttributeError: 'PosixPath' object has no attribute 'read_text'"

I'm running weasyprint project on ubuntu 18.04 and I try to create a a pdf. The problem started when I try to set a footer image. I'm running on python 3.6.7 This is my code invoking weasyprint: import sys import os from weasyprint import HTML,…
deleuterio
  • 548
  • 1
  • 4
  • 17
8
votes
6 answers

get cairosvg working in windows

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…
cs0815
  • 16,751
  • 45
  • 136
  • 299
8
votes
1 answer

Steps to install py2cairo?

Seems that pycairo was branched to py2cairo for 2.x versions back in May. There are no pip or easy_install installation options for py2cairo. I've grabbed the latest py2cairo tar, as well as the cairo 1.8.10 package which is registered as a…
Geuis
  • 41,122
  • 56
  • 157
  • 219
8
votes
1 answer

How to include and use cairo graphics library in C?

I have recently downloaded and installed Cairo graphics library for C from the project website. I tried to run the hello world program of Cairo by using the given code from the site FAQ. In Terminal, I applied the same command as given by the same…
Nimit Bhardwaj
  • 827
  • 9
  • 19
8
votes
3 answers

Can I use EGL in OSX?

I am trying to use Cairo library in a C++ application utilizing its GL acceleration in Mac. (I made same tests with its Quartz backend but the performance was disappointing.) It says it supports EGL and GLX. Use of GLX requires (externally…
user3648895
  • 395
  • 10
  • 20
8
votes
6 answers

Inkscape screws up EPS files

I have been trying to use Inkscape to prepare artwork graphics for my scientific papers. I use LaTeX, and I need my figures to be prepared as high-quality Encapsulated PostScript (EPS) images. The work order is as follows. First, I plot parts of my…
Benkevitch
  • 415
  • 1
  • 5
  • 13
8
votes
1 answer

can't render text in cairo

I am new to cairo and I have read the tutorials/documentation on its website. Now I can make lines, rectangles, and basically I can render images but not text. I am using the following code cairo_select_font_face (cr, "monospace",…
Techie Help
  • 161
  • 1
  • 6
8
votes
1 answer

Cairo Radial Gradient

I'm using a radial gradient in Cairo, but I'm not getting the expected results. The radial gradient I'm getting is much less fuzzy than I'd expect and I can't seem to fiddle with the color stops in order to get the desired results. Here is the…
Q2Ftb3k
  • 678
  • 3
  • 9
  • 18
8
votes
2 answers

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

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…
jtlz2
  • 7,700
  • 9
  • 64
  • 114
7
votes
2 answers

Boolean Operations on Cairo Paths?

Is there any way to build paths in Cairo by combining two paths together through Boolean operations such as Union, Difference, and Intersection? I'm working on a vector graphics application that uses Cairo to do its rendering and would like to give…
Adrian Lopez
  • 1,695
  • 1
  • 16
  • 22
7
votes
1 answer

Image compositing

I have an album title of some music band. I want to draw it with some mask which will round the corners of image. So, I've prepared such mask in gimp: I'm using white mask, but it's invisible at white background here. So, here is the code of…
Max Frai
  • 61,946
  • 78
  • 197
  • 306
7
votes
2 answers

X11: Draw overlay / Remove drawings from overlay

I need to draw a shape directly on screen (a little arrow) in X11, it serves as an overlay. I am searching for about an hour no with no good results. Could anyone provide me a good entry point for what I need? The technologies I can use are cairo,…
Nidhoegger
  • 4,973
  • 4
  • 36
  • 81
7
votes
2 answers

Win 7/Python 2.7 32bit: OSError: cannot load library pangocairo-1.0: error 0x7e

I want to test weasyprint but it has a problem with the installation of pangocairo. I successfully installed weasyprint: pip install weasyprint I installed gtk using this tutorial, downloading it from here. I also set up the path to…
Chameleon
  • 9,722
  • 16
  • 65
  • 127
7
votes
2 answers

Font layouting & rendering with cairo and freetype

I have a system that has only the freetype2 and cairo libraries available. What I want to achieve is: getting the glyphs for a UTF-8 text layouting the text, storing position information (by myself) getting cairo paths for each glyph for…
maxdev
  • 2,491
  • 1
  • 25
  • 50