[cairo] cairo_win32_surface_create api change

Carl Worth cworth at cworth.org
Wed Dec 7 11:02:39 PST 2005


On Mon, 5 Dec 2005 13:20:12 -0800, Vladimir Vukicevic wrote:
> This is a pretty interesting inconsistency in the API; on windows and
> quartz, the initial HDC/CGContextRef state can affect drawing in ways
> that cairo knows nothing about.  It seems that we may want to lean
> towards the X11 style of doing things for future surfaces; that is,
> create the surface from the actual thing that you're drawing to,
> rather than some kind of structure that you would use with the native
> API to draw onto the thing. (e.g., Window and not GC).

The X11 situation is unique I think in that the core drawing API is so
nasty. Specifically, the GC object does _not_ wrap the Drawable, but
all drawing operations must accept both a Drawable _and_ the GC,
(_and_ the display). Anyone who has done much Xlib programming knows
that pain.

As for the "window system" having effect on the drawing in ways that
cairo knows nothing about. If the user is in control of such things,
is that really a problem? If weird things are possible then I can
imagine a simple answer of "just don't do that".

I think the decision about what should be passed to the
cairo_surface_create functions should be a matter of what is most
"natural" on the relevant system. It wouldn't make sense to make the
user go through awkward motions to dig some underlying piece out of
the object they happen to have just to be able to draw to the object
they have.

That said, I don't have any input on what the correct "natural" object
is for the win32 or quartz API's, since I am not familiar with them.

> I'd suggest that we take stuart's patch that adds width/height for
> both API consistency

The API inconsistency for the size is a bit annoying, but we can't fix
it entirely unless we break API compatibility. We can add the
_with_size variant if needed to fix any actual problems, but that will
still be inconsistent with all the other backends. Oh, well.

> We should also consider adding methods for creating a surface from a
> HWND, etc. for API consistency purposes.

If they make sense, sure. I no nothing about these objects, so I can't
make any useful comment on whether they make sense or not.

-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.freedesktop.org/archives/cairo/attachments/20051207/506180bf/attachment.pgp


More information about the cairo mailing list