[cairo] Carl, please add an extra methond in Cairo
Bill Spitzak
spitzak at d2.com
Mon Aug 15 16:32:28 PDT 2005
David Reveman wrote:
> On Sat, 2005-08-13 at 22:30 +0800, Jackey Yang wrote:
>
>>Carl,
>>
>>Would you mind to add the following patch into cvs, so we can get a glitz
>>surface from a cairo surface. It may not necessary for most of you guys but
>>we do. I think this method will be widely used when there are more
>>applications based on cairo*^_^*. Thx lots, nice day.
>
>
> Is this more than just a convenience thing that allows you to not keep
> track of the glitz_surface_t yourself?
>
> The only additional functionality I can think of is that you can get the
> glitz_surface_t from a cairo_surface_t created using
> cairo_surface_create_similar but if you really need the glitz_surface_t
> you shouldn't be using create_similar but instead
> cairo_glitz_surface_create.
>
> If it's just a convenience thing, have you considered using
> cairo_surface_set_user_data?
I disagree with this. It is very desirable to keep just one pointer
around. If the program is required to keep 2 pointers, it is very
misleading, because there is a hidden assumption that those pointers are
independent, and that changing one does not require changing the other.
If instead one pointer is derived from the other every time it is
needed, it is obvious and clear that they depend on each other. Also it
is really annoying to have to pass two pointers to function calls when
only one is necessary. (yes you can define a structure that holds both
pointers, but then you are defeating the entire purpose of Cairo, which
is to provide a backend you can use directly without a wrapper from the
toolkit!)
I would certainly like the ability to retrive every single argument
passed to a cairo_create_xyz_surface() with a
cairo_xyz_surface_get_foo() function. In fact I think this should be a
requirement of any backend.
More information about the cairo
mailing list