[Xr] XrSetPattern added

Carl Worth cworth at east.isi.edu
Sat May 17 17:33:21 PDT 2003


On May 17, Vadim Plessky wrote:
 > |  which allows you to draw using a pattern rather than a solid color.
 > |
 > |  This should be quite helpful for those who want to do things like
 > |  gradients.
 > 
 > Are gradients supported in current Xr CVS?

XrSetPattern allows you to use a surface as the source "paint" for any
drawing operation. It can also do interpolated scaling of the
surface. So, that means that you can draw two rectangles of different
colors on a 2X2 surface and use that as a scaled pattern to get a
lovely linear gradient.

The recently posted paper on Xr has an example of the effect:

http://xr.xwin.org/xr_ols2003/html/xr_ols2003.html#fig:outline

As well as the source code used to generate it, (see Figure 15 at the
end of the paper).

Note that this example is a 3-color gradient. It's using 3 shades of
gray, but that's just because the figure was intended for non-color
printing. You can get much more interesting effects with other colors.

Have fun,

-Carl

PS. Xr now has a little more presence on the web. The above URL might
give you a clue to where the new Xr web page lives. And, yes, the page
is rather pathetic, (a page about a graphics library with no graphics
(!)). As always, any help will be appreciated.

-- 
Carl Worth                                        
USC Information Sciences Institute                      cworth at isi.edu





More information about the cairo mailing list