[Xr] Can the xrs argument be removed?

Soorya Kuloor skuloor at verano.com
Fri May 23 09:15:51 PDT 2003


I think having a explicit state argument to the function calls is a good
idea, though it is a bit cumbersome. In the Xr Java wrapper that I am
writing, I need to keep track of multiple XrState objects that draw on
different images or windows. So each XrState* maps into a XrState Java
object nicely. If the explicit arguments are removed, for every call I
need to make:

	XrSetState(state);
	XrDosomething(....);
	XrRemoveState(state);

or something similar in the wrapper class. With explicit argument I just
need to do XrDoSomething(state, ....).

-- Soorya

On Thu, 2003-05-22 at 20:04, Carl Worth wrote:
> An object-oriented interface to Xr need not have many XrState objects.
> 
> I guess I had always assumed an object-oriented interface to Xr might
> look something like this:
> 
>  	xrs.MoveTo (10, 20);
> 	xrs.LineTo (30, 40);
> 	xrs.Fill ();
> 
> I think we would all agree that this is quite free of visual
> clutter. And it turns out that this maps best to the API as it now
> stands, (with an explicit XrState pointer).
> 
> With an implicit XrState parameter, it would only be valid to have a
> single instance of the XrState object in the object-oriented code
> which seems exceedingly awkward to me.
> 
> I do realize that the code above is in a wrapped style without the
> cross-language cut-and-paste feature you were proposing earlier. I
> don't see this as a big drawback personally.
> 
> If I were to code in a language other than C, I would want my Xr
> interface to act as an integrated part of that language.
> 
> -Carl





More information about the cairo mailing list