Re: Anti-Aliased 2D drawing

Hash: SHA1

Scott Robert Ladd <gnome coyotegulch com> writes:

> Roger Leigh wrote:
>> Have you taken a look at libgnomecanvas?  Despite the name, it only
>> depends on GTK+, and it allows anti-aliased line drawings of arbitrary
>> size.
>> I don't know, but I suspect it will be replaced by, or depend upon,
>> Cairo at some point, but it's mature and usable right now.
> My only problem is in finding a reasonable tutorial for GnomeCanvas. If
> you know of one, I'd appreciate a pointer to it.
> I'm just drawing lins on top of an existing pixbuf; nothing terribly
> complex. I think I'm doing everything right, but the line doesn't show
> up. A quick tutorial will probably show me the obvious.

I don't have a tutorial I'm afraid, but you're welcome to look at my
code (and use it--it's GPL :-). debian org--2005-uterm/uterm--mainline--0.1--patch-41/cse?color=default

The cse-canvas-*.[ch] files will be the ones of interest.  The base
GnomeCanvas objects are found in cse-canvas.[ch].
cse_canvas_realize() and cse_canvas_init() are where the interesting
canvas-y stuff happens.

The other files are derived GnomeCanvasItems.  You don't need to
derive GnomeCanvasItems at all--using the stock items is fine, but
I've used it to simplify canvas operations by deriving from
GnomeCanvasGroup, so a single object can contain a set of related
items which may be manipulated as a whole.

Sorry about the lack of documentation there--I've not yet documented
the canvas stuff.

You can check out the whole source tree using the instructions here: debian org--2005-uterm/uterm--mainline--0.1--patch-41/README?color=default

If you don't have arch or the build dependencies, I can put up a
tarball.  Seeing how the canvas stuff looks on screen will hopefully
illustrate better what the code is doing.  (You'll need to configure
with CC='gcc -std=gnu99' until autoconf includes AC_PROG_CC_C99.)

I found the Gnumeric sources, and the advice of Jody Goldberg (the
maintainer) to be invaluable while writing this.


- -- 
Roger Leigh
                Printing on GNU/Linux?
                Debian GNU/Linux
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]