Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Clipped graphics

20 views
Skip to first unread message

Alexandre Ferrieux

unread,
Feb 7, 2007, 3:44:01 PM2/7/07
to
Hi,

I'm looking for an extension allowing to do clipped graphics in Tk:
defining arbitrary regions as drawing masks like the ClipRgn in old
MacOs.

I'm also interested in the special case of polygons: both the clipper
and the drawn shape are just polygons. So a purely computational
polygon intersection tool is also welcome.

Thanks for all suggestions, and insight to help the choice.

Bets regards,

-Alex

Bruce Hartweg

unread,
Feb 7, 2007, 4:19:36 PM2/7/07
to
Alexandre Ferrieux wrote:
> Hi,
>
> I'm looking for an extension allowing to do clipped graphics in Tk:
> defining arbitrary regions as drawing masks like the ClipRgn in old
> MacOs.
>
at the C level? or in a tcl script dealing directly with canvas objects?

> I'm also interested in the special case of polygons: both the clipper
> and the drawn shape are just polygons. So a purely computational
> polygon intersection tool is also welcome.

> C


> Thanks for all suggestions, and insight to help the choice.
>

see
http://wiki.tcl.tk/PolygonClipping
http://wiki.tcl.tk/PolygonIntersection
http://wiki.tcl.tk/CategoryPolygon

Bruce

Alexandre Ferrieux

unread,
Feb 7, 2007, 6:24:22 PM2/7/07
to
On Feb 7, 10:19 pm, Bruce Hartweg <doNOT...@nowhere.com> wrote:
>
> > I'm looking for an extension allowing to do clipped graphics in Tk:
>
> at the C level? or in a tcl script dealing directly with canvas objects?

At the C level. On my planet tcl scripts and extensions do not
intersect :-)

> > I'm also interested in the special case of polygons: both the clipper
> > and the drawn shape are just polygons. So a purely computational
> > polygon intersection tool is also welcome.

> seehttp://wiki.tcl.tk/PolygonClippinghttp://wiki.tcl.tk/PolygonIntersectionhttp://wiki.tcl.tk/CategoryPolygon

Thanks; but I'd really prefer C implementations there, because the
idea is to illustrate 3D rendering techniques to children,
in cases where clipping is superior to other techniques. I did a C+asm
version on the Mac years ago (using the ClipRgn() machinery),
but I tend to think Tcl's slighly better than 68k opcodes as an
educational tool...

-Alex

Donal K. Fellows

unread,
Feb 7, 2007, 7:13:12 PM2/7/07
to
Alexandre Ferrieux wrote:
> I'm looking for an extension allowing to do clipped graphics in Tk:
> defining arbitrary regions as drawing masks like the ClipRgn in old
> MacOs.

Tk itself doesn't do it, mostly due to the difficulty of expressing a
clipping region at the Tcl level (cleanly and efficiently). Once the
representation problem is solved, adding it to the canvas's items is
easy since (I think) all the underlying window systems support the
necessary basic clipping operations.

So, a good thing for someone to learn Tk's internals with. :-)

Donal.

sleb...@gmail.com

unread,
Feb 7, 2007, 9:11:14 PM2/7/07
to
On Feb 8, 8:13 am, "Donal K. Fellows"

<donal.k.fell...@manchester.ac.uk> wrote:
> Alexandre Ferrieux wrote:
> > I'm looking for an extension allowing to do clipped graphics in Tk:
> > defining arbitrary regions as drawing masks like the ClipRgn in old
> > MacOs.
>
> Tk itself doesn't do it, mostly due to the difficulty of expressing a
> clipping region at the Tcl level (cleanly and efficiently). Once the
> representation problem is solved

Why not emulate how tkzinc handles them?

Uwe Klein

unread,
Feb 8, 2007, 3:21:29 AM2/8/07
to
Alexandre Ferrieux wrote:

> Thanks; but I'd really prefer C implementations there, because the
> idea is to illustrate 3D rendering techniques to children,
> in cases where clipping is superior to other techniques. I did a C+asm
> version on the Mac years ago (using the ClipRgn() machinery),
> but I tend to think Tcl's slighly better than 68k opcodes as an
> educational tool...

Three ideas/questions:

does TKZink provide clipping?

what about scripted Open-GL ( as in Tk3D/Tcl3D )

What about the SVG support announced recently
http://wiki.tcl.tk/2893
>
> -Alex

uwe

>

Donal K. Fellows

unread,
Feb 8, 2007, 4:04:35 AM2/8/07
to
slebetman wrote:
> Why not emulate how tkzinc handles them?

Why not write up how it handles them or at least provide a pointer to
some documentation? :-)

Donal.

suchenwi

unread,
Feb 8, 2007, 4:16:20 AM2/8/07
to
On 8 Feb., 00:24, "Alexandre Ferrieux" <alexandre.ferri...@gmail.com>
wrote:

> Thanks; but I'd really prefer C implementations there, because the
> idea is to illustrate 3D rendering techniques to children,
> in cases where clipping is superior to other techniques.

It's only in Tcl, but http://wiki.tcl.tk/playing%203d has 3D rendering
and clipping (the windows and door of the house), and may be fun for
children, especially around Easter time :^)

Arjen Markus

unread,
Feb 8, 2007, 4:16:53 AM2/8/07
to

Tkzinc: http://www.tkzinc.org/tkzinc/pmwiki.php?n=Main.Documentation

But I am not sure that the inner workings are documented there too.

Regards,

Arjen

Donal K. Fellows

unread,
Feb 8, 2007, 5:20:09 AM2/8/07
to
Arjen Markus wrote:

> Donal K. Fellows wrote:
> > Why not write up how it handles them or at least provide a pointer to
> > some documentation? :-)
>
> http://www.tkzinc.org/tkzinc/pmwiki.php?n=Main.Documentation

OK, so clipping is done by reference to some existing item. That'd
actually be not that hard to add, though it would require a revision
to the existing item types so that they can report themselves as clip
masks (easy for some items, hard for others). Luckily, the Tk_ItemType
structure is revisable so there are no serious back-compat issues.
It's just A Simple Matter Of Programming (and so I can't take it on).

Donal.

Bruce Hartweg

unread,
Feb 7, 2007, 4:19:36 PM2/7/07
to
Alexandre Ferrieux wrote:
> Hi,
>
> I'm looking for an extension allowing to do clipped graphics in Tk:
> defining arbitrary regions as drawing masks like the ClipRgn in old
> MacOs.
>
at the C level? or in a tcl script dealing directly with canvas objects?

> I'm also interested in the special case of polygons: both the clipper


> and the drawn shape are just polygons. So a purely computational
> polygon intersection tool is also welcome.

> C


> Thanks for all suggestions, and insight to help the choice.
>

see

Donal K. Fellows

unread,
Feb 7, 2007, 7:13:12 PM2/7/07
to
Alexandre Ferrieux wrote:
> I'm looking for an extension allowing to do clipped graphics in Tk:
> defining arbitrary regions as drawing masks like the ClipRgn in old
> MacOs.

Tk itself doesn't do it, mostly due to the difficulty of expressing a


clipping region at the Tcl level (cleanly and efficiently). Once the

0 new messages