Re: drawing on drawables
- From: John Vetterli <jvetterli linux ca>
- To: Gtk AppDev Mailing List <gtk-app-devel-list gnome org>
- Subject: Re: drawing on drawables
- Date: Thu, 7 Apr 2005 14:23:01 -0400 (EDT)
On Thu, 7 Apr 2005, Olexiy Avramchenko wrote:
Joachim Mathes wrote:
While programming gtk-applications which contain drawable-widgets e.g.
pixmaps, I realized that it is possible to draw a rectangle on coordinates
that are actually outside the allocated region. For example: If you create
a pixmap with a height and width of 200 and you draw a rectangle on
coordinates (250,250) no exception is raised. Even negative coordinates are
possible: gdk_draw_rectangle (pixmap, gc, TRUE, -50, -50, 100, 100); and
only the rest of the rectangle is plotted. This is very comfortable and
reduces the amont of checks for validate coordinates.
So my question is if this is a feature I can rely on. Is this not just a
matter of implementation but defined in the specificaton of GTK?
1) GDK doesn't clip drawing requests at drawable boundaries, but Xserver do
(I assume that you're using X11 backend).
2) X11 protocol specification tells nothing about that (or I missed it), so I
think that this is the pure Xserver implementation question.
3) But any server has to clip, because the unclipped drawing request (like
line -10,-10,10x10 to off-screen pixmaps in system memory) is a huge security
hole.
So you may rely on it :) Just try not to use coordinates outside +-16K, if
you want to have a portable app.
If you want to be sure you can set clipping in the graphics context. See
gdk_gc_set_clip_rectangle() and the like.
My 2 cents.
JV
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]