Re: How wide can a widget get ?
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: John Cupitt <jcupitt gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: How wide can a widget get ?
- Date: Fri, 10 Dec 2004 17:43:50 +0200
John Cupitt wrote:
On Thu, 9 Dec 2004 03:58:37 +0200, Paul Pogonyshev <pogonyshev gmx net> wrote:
What's the maximum width I can set a widget to ? I end up attempting
to set the width of one of my drawing area widgets to 66327, and it
doesn't seem to want to go that wide. Is there an inherent limit to
the width of a widget ?
There was in gtk+-1.2, but gtk2 (pretty much) removed this. I have
drawing areas in my app which go up to several million pixels in each
axis and gtk scrolls them fine. Memory isn't allocated for invisible
pixels, so there's no limit there either.
You can have problems with a 16 bit coordinate limit on drawing
operations on very large drawing areas: you may need to do some
clipping yourself.
Can you please explain this further? (Sample code would be especially
helpful.) Here is one particular example that causes problems:
gdk_draw_line (window, gc, 20, 20, 20, 40000);
Instead of going downwards, the line goes upwards (seems like X
considers 40000 to be a negative 16-bit number.)
Yes, you've hit the 16 bit coordinate limit (+/- 32k). This will
limitation will vanish at some point in the beautiful cairo future (I
think), but it's very annoying until then.
The solution is to do some clipping yourself before issuing the draw
command. You know the position and size of the viewport, so you need
to draw just the bit of the line that intersects that area.
AFAIK, the 16 bit limit is for the length of the line rather than the
absolute position (thanks to the magic of gdk2 scrolling), so
gdk_draw_line (window, gc, 20, 35000, 20, 40000);
should work ok (provided your viewport is positioned at 35000 or lower).
It seems that you are right. At least after I implemented clipping which
limited line length to be not much larger than view port's width/height,
all drawing glitches seem to have disappeared, even in the "sign flip
zone."
Thanks for the help!
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]