Re: scrolled list of images?
- From: zentara <zentara@xxxxxxxxxxxxxx>
- Date: Thu, 02 Mar 2006 11:02:45 GMT
On 1 Mar 2006 16:38:30 -0800, woodenbicycle@xxxxxxxxxxx wrote:
I am trying to write a small graphical utility for managing my photos.
I am at a loss, however, when it comes to displaying an _arbitrary_
number of images.
In my previous program I had a few JPEG images (via Photo and
createImage) that were updated/changed depending on which files were
slected from drop-down menus. This was easy as I made a canvas for each
image area.
Now back to my current problem. I would like to make a scrollable
region with n number of 320x240 JPEG images, one on top of each other,
so the scrollable area is about 320 pixels wide and n x 240 pixels
tall. How would I go about doing this? I can easily make a list/array
of the path/filenames of the images themselves. But how do I go about
actually creating/displaying n number of photo/createimage/canvases?
Right now I only know how to hard code a fixed number of canvases for
the JPEG photos. How do I make this dynamic and flexible so I can
accomplish my goal?
This shows how to put it in an HList. The next step is to "paginate"
the HList, so only x number appear at a time. What if you had 1000
photos? Thats a long scroll bar.
http://perlmonks.org?node_id=327499
To add pagination, see
http://perlmonks.org?node_id=338291
Pagination requires a few tricks, to avoid memory gains.
My biggest advice to you, is watch how you display your images,
and reuse image objects. Don't try to destroy an image and create
a new one everytime you change display....you will start to
gain memory.
What you want to do is create 1 display image, use $image->clear,
then put the new image into it.
Same with the thumbnails..... 1000 images would require 1000 image
objects, which would slow program startup, and cause memory bloat.
What you want is to paginate the thumbnails, so you only create say 10
thumbnail image objects, then when you paginate, you clear them out,
and load a different 10, etc. Your program will be faster and use less
memory.
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.
- References:
- scrolled list of images?
- From: woodenbicycle
- scrolled list of images?
- Prev by Date: Re: scrolled list of images?
- Next by Date: Re: canvas, dialog, menu issues
- Previous by thread: Re: scrolled list of images?
- Next by thread: Re: scrolled list of images?
- Index(es):
Relevant Pages
|