[cairo] Fwd: I have a question about Cairo graphic

Chris Wilson chris at chris-wilson.co.uk
Thu Oct 17 11:46:11 CEST 2013


On Thu, Oct 17, 2013 at 08:21:40AM +0000, 김소연 wrote:
>     
> 
>    Dear Cairo manager.
> 
>    Hi, I'm samsung software assistant engineer.
> 
>     
> 
>    I have question about Cairo graphic.
> 
>     
> 
>    --> what is difference between Cairo and Open GL
> 
>        - advantage, disadvantage

OpenGL is a low-level abstraction for feeding rendering primitives to
the GPU. The base elements are triangles and shaders.

cairo is a high-level canvas drawing model for laying out pages and
other views. The base elements are resolution independent paths and
patterns. cairo can translate that canvas model into GPU primitives
using OpenGL (among others), but the canvas model does not often
translate efficiently to the GPU.

cairo is a much higher abstraction which is both an advantage and
disadvantage:

For the application programmer, a canvas api (e.g. cairo) is much simpler
to use. You do not need to worry about GPU limitations and are device and
display independent, using a layout language much closer to the graphic
designers.

Conversely, the abstraction of the canvas api divorces the application
programmer from considering the limitations of the GPU and how poor they
are at rendering the canvas model. In order to gain the most
performance, you need to construct your UI fully cognisant of the GPU
and program within its capabilities. That is highly device and driver
specific.

cairo - easy to use, portable to any device, scales to any device
opengl - very hard to use (have to write your own toolkit), device
         dependent. May be faster.

To use OpenGL, you essentially have to create your own UI toolkit, which
if you desire the general qualities Cairo offers, ends up looking very much
like Cairo, with similar advantages and disadvantages over raw OpenGL.
Where it is easiest to use OpenGL (for example blending multiple layers),
it is also easy for Cairo to efficiently use OpenGL.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list