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
13
votes
2 answers

How to draw any GTK widget on top of Cairo surface

I would like to save the looks of a GTK window, and all the buttons and other widgets it contains to a PNG or PDF file. Cairo supports drawing on such surfaces. Could I somehow ask a GTK widget to draw itself on Cairo surface? A code sample would…
tzador
  • 2,535
  • 4
  • 31
  • 37
13
votes
6 answers

How to install pycairo on osx?

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 >=…
Yoav
  • 501
  • 1
  • 7
  • 12
12
votes
1 answer

pyCairo: How to resize and position an image?

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…
Derek
  • 197
  • 2
  • 11
12
votes
3 answers

cannot load library libcairo

I have problem when trying to run a website in Django: OSError: no library called "libcairo-2" was found cannot load library 'libcairo.so.2': /lib/x86_64-linux-gnu/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var cannot load library…
alis01
  • 169
  • 1
  • 3
  • 11
12
votes
1 answer

Can cairo use SDL_Texture as a render target?

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…
Vortico
  • 2,610
  • 2
  • 32
  • 49
11
votes
3 answers

How to install cairo on Windows

For the life of me I can't figure out how to install cairo on Windows! I need it for Haskell Charts, but when I follow setup instructions and get to running: cabal install gtk I get this error: Linking dist/setup-wrapper\setup.exe ... Configuring…
Andriy Drozdyuk
  • 58,435
  • 50
  • 171
  • 272
11
votes
1 answer

How to get better anti-aliasing results in Cairo (examples shown)

Building a project using Cairo for graphics processing. Neither of the anti-aliasing options produce a good enough result. I'm using an ARGB32 surface and writing to png. I have tried using all of the hinting styles but I can see no change in the…
digout
  • 4,041
  • 1
  • 31
  • 38
11
votes
4 answers

rotate text around its center in pycairo

community. I know that there are many answers here, manuals, tutorials and references over the internets and amny more about this question. Also I know that knowledge of linear algebra is required. But when I think about time to figuring out all the…
Крайст
  • 776
  • 1
  • 9
  • 22
11
votes
2 answers

Is there a better library for drawing vector graphics in Python than Cairo?

...Not that I have anything against Cairo -- I love it in fact. It's just terribly difficult to install the Python bindings, especially on a Mac (see all the SO questions about installing pycairo on OS X). Are there better alternatives? Edit: For…
mjumbewu
  • 1,104
  • 5
  • 14
  • 28
11
votes
2 answers

How to install X11 before testing with GitHub Actions for macOS?

I'm testing an R package with GitHub Actions, and it succeeds on Windows and Linux. However, it fails on Mac OS, as you can see on the logs: Warning in grSoftVersion() : unable to load shared object…
Dan Chaltiel
  • 7,811
  • 5
  • 47
  • 92
11
votes
3 answers

Why is my simple python gtk+cairo program running so slowly/stutteringly?

My program draws circles moving on the window. I think I must be missing some basic gtk/cairo concept because it seems to be running too slowly/stutteringly for what I am doing. Any ideas? Thanks for any help! #!/usr/bin/python import gtk import…
shino
  • 4,562
  • 5
  • 38
  • 57
11
votes
1 answer

Use Windows (TTF) font?

Is it possible to use a TTF font in R? Is the cairo package intended for this task? How would a minimal example look like?
Karsten W.
  • 17,826
  • 11
  • 69
  • 103
11
votes
3 answers

How to resize svg image file using librsvg Python binding

When rasterizing svg file, I would like to be able to set width and height for the resulting png file. With the following code, only the canvas is set to the desired width and height, the actual image content with the original svg file dimension is…
btw0
  • 3,516
  • 5
  • 34
  • 36
10
votes
2 answers

Is Cairo acelerated on Opengl backend?

By this I mean, does Cairo draw lines, shapes and everything using opengl acelerated primitives or no? and if not, a library that does this?
gotch4
  • 13,093
  • 29
  • 107
  • 170
10
votes
3 answers

How do I write an image into an SVG file using cairo?

I have some code that looks like this: cairo_surface_t * surface = cairo_svg_surface_create("0.svg", 512, 512); cairo_t * context = cairo_create(surface); int * data = new int[512*512]; // fill the data... cairo_surface_t * image_surface = …
Scott
  • 103
  • 1
  • 6
1 2
3
83 84