MarketCairo (graphics)
Company Profile

Cairo (graphics)

Cairo is an open-source graphics library that provides a vector graphics-based, device-independent API for two-dimensional drawing. Written in C, it supports output to multiple backends including X11, Quartz, Win32, SVG, PDF, and PostScript. Cairo uses hardware acceleration when available.

History
Keith Packard and Carl Worth created the project for use in the X Window System, originally naming it Xr (later Xr/Xc). Cairo 1.0 was released in 2005, providing a stable API. Version 1.2 (2006) added PDF and SVG backend support. Version 1.4 (2007) improved font handling and added the cairo_push_group API for offscreen rendering. Version 1.10 (2010) introduced the recording surface, which captures drawing operations for later replay, and the cairo_region API. GTK adopted Cairo for rendering in version 2.8 (2005), and GTK 3.0 (2011) used Cairo for all rendering. GTK 4 (2020) shifted to Vulkan and OpenGL renderers via GSK, reducing Cairo's role. == Architecture ==
Architecture
Drawing model Cairo uses a three-layer drawing model based on Porter-Duff compositing: • A mask is constructed from vector primitives (paths, rectangles, glyphs, Bezier curves). • A source provides color data, which may be a solid color, gradient, bitmap pattern, or another surface. • The source is painted through the mask onto a destination surface, which represents the output backend. Backends Cairo supports output to multiple backends ("surfaces"): • Display servers: X Window System (via Xlib and XCB), Quartz (macOS), Win32 GDIImage formats: PNG, in-memory image buffers • Document formats: PDF, PostScript, SVG Legacy backends for BeOS, OS/2, DirectFB, and OpenGL (direct and via glitz) were removed in 2022-2023. Qt, Skia, and Direct2D. Language bindings Bindings exist for C++, C# and other CLI languages, Delphi, Haskell, Julia, Lua, Perl, PHP, Python, Ruby, Rust, Scheme, and Smalltalk. Complex text layout Cairo handles Latin and CJK fonts but does not directly support complex text layout scripts that require glyph shaping. The developers recommend using Pango for complex text, which integrates with Cairo for rendering. == Software using Cairo ==
Software using Cairo
GTK used Cairo for all rendering in version 3.x; GTK 4 uses it in a reduced role. • WebKit uses Cairo for rendering in its GTK and EFL ports. • The Poppler PDF rendering library uses Cairo for antialiased output. • Inkscape uses Cairo for its outline mode display and for PDF and PostScript export. • The Mono Project uses Cairo to implement its GDI+ (libgdiplus) and System.Drawing backends. • R uses Cairo for PDF, PostScript, and SVG plot output when available. • RRDtool replaced its internal graphics library with Cairo and Pango in version 1.3 (2008). • Gnuplot 4.4 uses Cairo for PDF and PNG output. Example A simple program that generates an SVG file using Cairo: • include • include int main(int argc, char **argv) { cairo_surface_t *surface = cairo_svg_surface_create("Cairo_example.svg", 100.0, 100.0); cairo_t *cr = cairo_create(surface); /* Draw the squares in the background */ for (int x = 0; x == See also ==
tickerdossier.comtickerdossier.substack.com