Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Newbie Gallery questions
Newbie Gallery questions [message #479472] Tue, 11 August 2009 09:30 Go to next message
Thomas Christensen is currently offline Thomas ChristensenFriend
Messages: 11
Registered: July 2009
Junior Member
The Gallery widget is working for me, but I have issues with the item
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
Re: Newbie Gallery questions [message #479480 is a reply to message #479472] Tue, 11 August 2009 10:05 Go to previous messageGo to next message
Nicolas Richeton is currently offline Nicolas RichetonFriend
Messages: 179
Registered: July 2009
Senior Member
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.

(You can even contribute your item renderer to Nebula Smile )
--
Nicolas

Re: Newbie Gallery questions [message #479653 is a reply to message #479480] Tue, 11 August 2009 20:24 Go to previous message
Thomas Christensen is currently offline Thomas ChristensenFriend
Messages: 11
Registered: July 2009
Junior Member
Nicolas Richeton wrote:

> 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 :-)
Re: Newbie Gallery questions [message #598115 is a reply to message #479472] Tue, 11 August 2009 10:05 Go to previous message
Nicolas Richeton is currently offline Nicolas RichetonFriend
Messages: 179
Registered: July 2009
Senior Member
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.

(You can even contribute your item renderer to Nebula :) )
--
Nicolas
Re: Newbie Gallery questions [message #598133 is a reply to message #598115] Tue, 11 August 2009 20:24 Go to previous message
Thomas Christensen is currently offline Thomas ChristensenFriend
Messages: 11
Registered: July 2009
Junior Member
Nicolas Richeton wrote:

> 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 :-)
Previous Topic:Cache images system for Gallery widget
Next Topic:CDateTime invalid time entry
Goto Forum:
  


Current Time: Fri Apr 19 21:51:31 GMT 2024

Powered by FUDForum. Page generated in 0.03762 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top