[cairo] CAIROMM: surfaces

Jonathon Jongsma jonathon.jongsma at gmail.com
Thu Jan 12 19:43:01 PST 2006


On 1/12/06, Owen Taylor <otaylor at redhat.com> wrote:
> On Wed, 2006-01-11 at 13:34 -0600, Jonathon Jongsma wrote:
>
> > - Surface
> >    - ImageSurface
> >    - FileSurface (name TBD)
> >       - PdfSurface
> >       - PsSurface
> >       -SvgSurface
>
> My hit-and-run opinion is that the FileSurface type is extraneous.
> Just because those surfaces have similar-looking (or even identical)
> constructors, doesn't mean that they need to share a base class.
>
> Since this "FileSurface" has no representation in the cairo code,
> cairo could always add a "FigSurface" (say) that is a file surface
> in some ways, but not a FileSurface in every way, and then you'd
> be in trouble.
>
> Regards,
>                                         Owen

I've come to the same conclusion after thinking about it for a little
bit.  The "FileSurface" class could only be an abstract / interface
class anyway since they'd need to each call their specific
cairo_foo_surface_set_dpi() functions.  So there's no practical
benefit to the base class.

I also took a look at what they did in the C# bindings, and it's
basically the flat heirarchy (i.e. all surfaces derived from a common
Surface class, but no separate base class for PS/PDF/etc).  So the C++
bindings should follow the C# bindings pretty closely.

Jonner


More information about the cairo mailing list