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
6
votes
1 answer

gnuplot pdfcairo matches latex font size

I plot a pdf figure using gnuplot 5.0 with pdfcairo terminal, and then insert this figure into a pdf file using latex. However, I found the font size in gunplot is different with the font size in latex, although I set them to be the same. To make…
lululxvi
  • 73
  • 1
  • 6
6
votes
2 answers

How to get transparent background in window with PyGTK and PyCairo?

I've been trying really hard to create a window with no decoration and a transparent background using PyGTK. I would then draw the content of the window with Cairo. But I can't get it to work. I've tried a lot of different ways, they all failed,…
paldepind
  • 4,680
  • 3
  • 31
  • 36
6
votes
3 answers

Is it possible to create .eps files with ggsave using the Cairo graphics device?

Edit: This page provides the code: https://www.andrewheiss.com/blog/2017/09/27/working-with-r-cairo-graphics-custom-fonts-and-ggplot/ ggsave("test_cario.eps", device=cairo_ps) ggsave("test_cario.pdf", device=cairo_pdf) However, I am wondering…
00schneider
  • 698
  • 9
  • 21
6
votes
1 answer

Alpha transparency in Cairo

I have a problem with displaying alpha transparency using GTK and Cairo. I try to display this image 1 If I do the alpha blending my self, everything works. If I pass the alpha values directly to Cairo, the shadow seems to render fine, but the…
user877329
  • 6,717
  • 8
  • 46
  • 88
6
votes
1 answer

Rotating an image with pyCairo

I'm having trouble understanding how to simply rotate an image with pyCairo... Here's what I did, based on this example : image_surface = cairo.ImageSurface.create_from_png(image_path) width = image_surface.get_width() height =…
Kyrill
  • 227
  • 1
  • 11
6
votes
3 answers

Cairo "Could not find libpng in the pkg-config search path"

I'm trying to install GTK-DFB and cairo is a requirement. When I try to build it from source, it throws: checking for cairo's PNG functions feature... configure: WARNING: Could not find libpng in the pkg-config search path checking whether cairo's…
Alon Gubkin
  • 56,458
  • 54
  • 195
  • 288
6
votes
1 answer

Special characters in knitr (cairoDevice doesn't work)

I have problem with special characters in my knitr document. Normal text works fine but the polish letters in the title or axis name on the picture doesn't. I tried to fix this with installing cairoDevice package. But it still doesn't work.…
jjankowiak
  • 3,010
  • 6
  • 28
  • 45
6
votes
1 answer

How to get cmake's PKG_CHECK_MODULES to find my cairo library in Windows

I'm trying to build OpenSceneGraph's pdf plugin on a win32 box. The plugin is using cmake's PKG_CHECK_MODULES macro to find cairo and poppler libraries. I don't know how to install these in such a way as to help it find them though.
Michael Daum
  • 820
  • 6
  • 12
6
votes
1 answer

How to render image as pdf (canvas and pdfkit)

I have a function on nodejs that generates an image from many images and then generate a pdf file from that. Im trying with just one image but i need to add more, but this doesnt seems to work function HelperHandler() { this.pdf = function(req,…
jtomasrl
  • 1,430
  • 3
  • 13
  • 22
6
votes
1 answer

How do I do text wrapping in pyCairo + Pango?

What I need pyCairo to do is : generate an image of size 100x100 containing some text and an image from filesystem as background the text should be within a box which has text wrapping of size 20x20 with bottom left corner at (40,40). save this…
Nullpoet
  • 10,949
  • 20
  • 48
  • 65
6
votes
2 answers

How to draw in C++ with Cairo to a window using GDI (instead of creating an image)?

I managed to find this code snippet and compile it with Cairo: #define LIBCAIRO_EXPORTS #include #include int main(int argc, char** argv) { cairo_surface_t *surface; cairo_t *cr; surface =…
AturSams
  • 7,568
  • 18
  • 64
  • 98
6
votes
1 answer

In AthensTutorial where canvas comes from?

I was doing the AthensTutorial , I understand the first step surface := AthensCairoSurface extent: self extent asIntegerPoint. and then step 2 is surface drawDuring: [:canvas | "First, we clear the surface" surface clear. "we can use surface…
Kilon
  • 1,962
  • 3
  • 16
  • 23
6
votes
0 answers

Choosing a cross-platform graphics library for perfect text rendering

I want to write a simple text editing application in c/c++ ( mainly devoted to source code editing ) with these specifications: cross-platform ( Windows, OS X, Linux ) with the as much as possible the same appearence on each os insanely fast a…
Pich
  • 61
  • 9
6
votes
1 answer

Fit line to width with Pango and Cairo (Pycairo)

I've several lines of text and I'd like each to fit in width (scaling the font size) to the width of the Context. Is there a way of doing this? I'm using pangocairo and python for this.
casasin
  • 153
  • 7
6
votes
1 answer

Drawing tons of circles in Python using cairo

I am currently working on an application, which uses a video projector to create an effect similar to a real laser. A really nice example of what I'm trying to archive can be seen on Youtube here. Basically that application needs to draw simple…
Delphinator
  • 513
  • 3
  • 11