SWT / GTK 16 bits limitation


Have you ever try to draw a very large shape on an SWT Canvas using GC drawing methods on a linux workstation ?

Try to draw a line from (245, 258) to (40000, 150) and it will sometimes result in bad rendering (see here for more details). You are thinking, why draw such a line since my screen resolution can’t exceed 1600 pixels …. ???

You are right so, to easily workaround this limitation we just have to compute the intersection between the line and the underlying Canvas‘s client area.

Fine but ….. in some cases, when drawing very large scrollable diagrams for example, it can be very difficult to compute the visible part of a given shape. Have you for example, already computed the intersection between an SWT polygon == an int[] and an SWT Rectangle ??
It’s not so trivial, and the easyest way i found to do this is to use Java2Dclasses !!! and I don’t want to depend on Java2D. (I opened a new feature request to SWT here).

All this long story to ask these questions :

Have you ever encountered this limitation, how did you solved it ?

Advertisements

2 thoughts on “SWT / GTK 16 bits limitation

  1. A bit of algebra is usually all that’s needed to prevent using huge numbers for this sort of thing.

    Just work it out algebraically and don’t be lazy.

  2. Hi James,

    I agree with you, but it would be nice to have this algebra directly provided by SWT avoiding every one to reinvent the wheel each time … no ??

    Regards
    Manuel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s