Forums Register Login

Displaying generated images greater than 32767 pixels on canvas

+Pie Number of slices to send: Send
Hi

I've been stuck on this for almost a week now so here it goes..

The general gist of the application is to generate one large horizontal bar up to approxiamtely 85,000 pixels to model the amount of seconds in a 24hr period, each pixel represents a second.

This bar is split into multiple sections, these sections can number sometimes anywhere between 1000-2000, each represent a particular 'event' within the 24hr period. So I might have an event A coloured red and that is 300 seconds, another event Z may be 400 seconds with a yellow bar. So they've taken up 700 horizontal pixels so far --> 700 seconds within the 24hr timespan.

These bars and their colours are generated according to a pre-determined 'model' so their never the same.

Inititally I tried it with a ScrolledComposite to display the bar, it worked great up till 32767 pixels (the composite expanded to 32767 pixels) of which after I soon found out I reached the maximum pixel limit for composites in Windows and whatever that should have been drawn beyond this point has been cut off, the scrollbars also worked great displaying the 32767 pixels however and with no lag.

So after having a consultation with the supervisor I've decided to go for the Canvas approach. The thing is my original approach was with a Canvas but I got stuck hence making me switch to a ScrolledComposite. Now I am back to square one. Here are my questions:

1)
Would this be the best approach in your opinion? Does canvas support a pixel width of 85,000 (I tried with 'Image' and it failed)?

My idea was to have a 1000 pixel wide fixed width canvas with scrollbars. Everytime the scrollbars or a 'forward button' is pressed the canvas is repainted to simulate a side "scroll" to show the next lot of pixel graphics. Once the button is clicked on again it shows the next lot of pixel graphics. With this approach I only ever have to deal with 1000 pixels at a time and not the whole 85,000 pixels however I will still be able to view the whole 85,000 pixels without lag or reaching a limit.

How would I 'technically' be able to go around doing this? Some pointers please!

2)
I wrote a "Canvas Test" program to try to test out my idea mentioned above.


The problem with this code is that it's supposed to display 4 different coloured rectangles on the canvas however it only displays the first three, I have to drag the shell window out manually to see the fourth image. So to address this issue I added a Listener to listen for SWT.Resize events. However it does not work as it should - the horizontal scrollbar just disappears when I re-size the window manually. The thumb size on the scrollbar should become smaller if I manually resize the shell smaller so that the scrollbar can be used to view all four images, and the scrollbar width should increase if I manually resize the window outward.

Can someone please tell me what's wrong with my Resize listener code.

Thanks guys

Really appreciate it!


PS: Should mention I am not an expert on SWT however I did read some books and went through tutorials to try to understand the best I can given the timeframe.
+Pie Number of slices to send: Send
interesting question. i dont know the answer. my first approach, however, would be a JPanel and a JScrollPane
+Pie Number of slices to send: Send
No I can't use any SWING components since the boss wants it to be done in SWT.

Guys if you can't answer the first question please answer the second!! Still trying here...
+Pie Number of slices to send: Send
SWT gets very little traffic here, and most questions go unanswered (a quick search will confirm).

You're more likely to solve the problem by posting in an Eclipse/SWT forum (if there is one - should be)
+Pie Number of slices to send: Send
 

Michael Dunn wrote:
You're more likely to solve the problem by posting in an Eclipse/SWT forum (if there is one - should be)


Indeed. This looks like the real McCoy http://www.eclipse.org/forums/index.php/f/100/
Water! People swim in water! Even tiny ads swim in water:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1761 times.
Similar Threads
Exception in thread "AWT-EventQueue-0" org.eclipse.swt.SWTException: Invalid thread access
Shell keeps popping up when creating a menu tray
java SWT application giving error while executing jar file
ScrolledComposite issue
Good design or should I try something else
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:38:58.