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 ?
February 9, 2008 at 12:49 pm |
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.
February 11, 2008 at 9:15 am |
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