[cairo] [cairo-announce] Cairo participates in Google Summer of Code 2008

Carl Worth cworth at cworth.org
Tue Mar 18 16:06:29 PDT 2008


On Wed, 19 Mar 2008 04:10:28 +0545, gopi wrote:
> Hi Everyone!

Hi there!

> I'm here as a student for the Summer of Code 08 initiative, having quickly
> browsed
> the cairo/pixman src codes, I here list few selected ideas and my doubts,
> Please correct me if I'm wrong:

Thanks for taking a look at things, and for starting to pinpoint some
interest areas with questions.

> a. [Hard]      Add support for programmatic patterns, (ie. arbitrary
> gradients).
>     1. it is the logical extension to the patterns drawing capability,
>         but why the "coons patch mesh & tensor patch mesh" models only ?

What we're very much interested in here is a way for the user to be
able to provide a description of an arbitrary color pattern that will
be smoothly interpolated and cairo, and also done in a way that will
be efficient across as many of cairo's backends as possible.

So a gradient that is specified as a PostScript/PDF-compatible mesh
can easily be inserted into a PostScript/PDF file, (that much should
be obvious). Perhaps more interestingly, such a gradient could also be
conceivably accelerated by video hardware. So a description that is
efficient with both PDF file output and when using video hardware to
render to the display---that's the kind of sweet spot that we love for
cairo.

A project tackling this would first start by generating correct
image-backend output for the mesh gradient. At that point, all other
backends could return UNSUPPORTED for the new gradient types and
cairo's fallback machinery would automatically give them correct, (but
inefficient), output. Subsequent steps would involve doing the native
PostScript/PDF output for this, and adding new support to the X Render
Extension and for X graphics drivers, (though these last steps would
be well outside the scope of a Summer of Code project).

>     2. Wouldn't "Type 1 Shading (Functional)" suffice ?

The problem here comes in how to describe that function. Within
PostScript, that's an actual PostScript function. How would we
implement that in cairo? The corresponding notion could be a C
function, but then that's hard to map efficiently to both
PostScript/PDF output as well as to hardware rendering. So it would
provide a very complete and very general way to describe any smooth
shading, but I don't think it's actually all that interesting for
cairo.

>     3. is cairo_pattern_create_linear(), functionality wise a derivative to
> the above ?
>     4. is cairo_pattern_create_radial(), similar to "Type 2 Shading
> (Radial)" ?

Conceptually, both create_linear and create_radial could be considered
as less general versions of a mesh-based gradient. That's not how they
are implemented internally. And these gradients already map to the
native gradient output types in PS/PDF output, (such as Type 2 like
you mention).

So the new thing we're talking about in the project idea would be a
new cairo_pattern_create_mesh or so.

>     5. Do I need to have a very good understanding of the Benzier Curves, so
> as to undertake this assignment ?
>         (Reference from - PostScript Language Reference)

You need to be able to understand and be able to implement in C the
mathematical descriptions of Coons Patch Mesh (Type 6) and
Tensor-Product Patch Mesh (Type 7) in the PostScript Language
Reference, (though I think the former might simply be a less general
version than the latter).

> b. [Medium] Add HDR image surface type to cairo/pixman
> (CAIRO_FORMAT_ARGB64).
>     Please point me to if any, HDR Image library that can be used (if that
> needs to be ?).

You might take a look at the GEGL library:

	http://www.gegl.org/

The author/maintainer of that library, (Øyvind "pippin" Kolås), is
active within the cairo community and I would hope that he might be
available as a mentor if such a project would be pursued, (but I
haven't talked to him to see if he might be).

> Thanks everyone!

Thank you for your interest in cairo! Have fun,

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20080318/bfd4e128/attachment-0001.pgp 


More information about the cairo mailing list