[Xr] Xr API comments: Push vs. Save, Rect, Quad

Paul Sladen xr at paul.sladen.org
Sat May 31 04:43:23 PDT 2003


On 23 May 2003, Soorya Kuloor wrote:

Hello People,

> * XrSave() and XrRestore() function names are a bit confusing. XrPush()
> and XrPop() may be better names?. Other libraries seem to use the
> push/pop names (Eclipse draw2d, Java2D).

Instinctively I would think of Push() and Pop() as being fairly lightweight
functions and Save()/Restore() being somewhat cumbersome functions, I would
want to avoid.  Push/Pop are definitely more intuitive to programmers.

> * Are there any plans to provide 'higher level' shape related functions
> in Xr API, such as drawing ellipses, curves and rectangles?

From the OpenGL standpoint, these could be handled efficiently by a separate
library/layer on the top, this would also be an appropriate place to put
the Conics and Rounded-Rectangles that other people have mentioned are
merely producing lower-level primitives.

Rect() is a convenience function that can be optimised in the case of
a Window-Linear matrix.  ...Hardware /can/ draw Rectangles.

In addition, they are extremely fast to clip against.  Rect() is the limit
of what should probably be in a core-API and on the basis of trade-off
between being minimalist and allowing optimisation (and convenience).

Continuing on on the point of optimisation, whilst Quadratic Beziérs can be
handled as Cubics, it might be worth reflecting that they are actually
easier to render;  and that Truetype fonts happen to be made of them...

Hope that is useful,

	-Paul
-- 
War is inconsistent with Truth.  Nottingham, GB






More information about the cairo mailing list