Re: drawing on drawables



Joachim Mathes wrote:
Hallo!

Maybe my question has already been answered. But up to now I haven't found any information concerning the 
problem.

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?
Hi,
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.

        Olexiy




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