Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsNewbie Gallery questions
https://www.eclipse.org/forums/index.php/mv/msg/152288/479472/#msg_479472
sizes.
I want to show prescaled images (thumbnails) and I don't want the gallery
to mess with the size of them. They are all in the range 1-160 pixels in
width and in height, but the Gallery widget -- with the default item
renderer -- will scale them all to the same size.
I want them to be shown untouched in a 160x160 region, can this be done?
Here comes the next question. When I set item size to 160 x 160 it is not
the region reserved for the image but for the whole item with caption and
margins.
Can I control the region reserved for the image?
Because if I can I can box the smaller ones inside a 160x160 black image.
Thomas]]>Thomas Christensen2009-08-11T09:30:26-00:00Re: Newbie Gallery questions
https://www.eclipse.org/forums/index.php/mv/msg/152288/479480/#msg_479480
This is exactly why Gallery supports pluggable item renderers. In your case, you should just create a new ItemRenderer by extending AbstractItemRenderer.
During redraw, 'draw' is invoked for each item.
public void draw(GC gc, GalleryItem item, int index, int x, int y,
int width, int height) {
you get an untouched area you can paint as you wish, without resizing.
width and height are the one defined with setItemSize(). If you want to draw labels, just add a little room for them.
(You can even contribute your item renderer to Nebula )
--
Nicolas
]]>Nicolas Richeton2009-08-11T10:05:14-00:00Re: Newbie Gallery questions
https://www.eclipse.org/forums/index.php/mv/msg/152288/598115/#msg_598115
This is exactly why Gallery supports pluggable item renderers. In your case, you should just create a new ItemRenderer by extending AbstractItemRenderer.
During redraw, 'draw' is invoked for each item.
public void draw(GC gc, GalleryItem item, int index, int x, int y,
int width, int height) {
you get an untouched area you can paint as you wish, without resizing.
width and height are the one defined with setItemSize(). If you want to draw labels, just add a little room for them.
(You can even contribute your item renderer to Nebula :) )
--
Nicolas]]>Nicolas Richeton2009-08-11T10:05:16-00:00Re: Newbie Gallery questions
https://www.eclipse.org/forums/index.php/mv/msg/152288/598133/#msg_598133
> Hi Thomas,
> This is exactly why Gallery supports pluggable item renderers. In your case,
you should just create a new ItemRenderer by extending AbstractItemRenderer.
> During redraw, 'draw' is invoked for each item.
> public void draw(GC gc, GalleryItem item, int index, int x, int y,
> int width, int height) {
> you get an untouched area you can paint as you wish, without resizing.
> width and height are the one defined with setItemSize(). If you want to draw
labels, just add a little room for them.
Works like a charm, thanks.
> (You can even contribute your item renderer to Nebula :) )
If I get proud of it I will consider :-)]]>Thomas Christensen2009-08-11T20:24:13-00:00Re: Newbie Gallery questions
https://www.eclipse.org/forums/index.php/mv/msg/152288/479653/#msg_479653
> Hi Thomas,
> This is exactly why Gallery supports pluggable item renderers. In your case,
you should just create a new ItemRenderer by extending AbstractItemRenderer.
> During redraw, 'draw' is invoked for each item.
> public void draw(GC gc, GalleryItem item, int index, int x, int y,
> int width, int height) {
> you get an untouched area you can paint as you wish, without resizing.
> width and height are the one defined with setItemSize(). If you want to draw
labels, just add a little room for them.
Works like a charm, thanks.
> (You can even contribute your item renderer to Nebula :) )
If I get proud of it I will consider :-)]]>Thomas Christensen2009-08-11T20:24:13-00:00