realbasic-nug
[Top] [All Lists]

Need help with an image grid

To: realbasic-nug at lists dot realsoftware dot com
Subject: Need help with an image grid
From: bigj at qrystallizedmedia dot com
Date: Fri, 30 Sep 2005 08:36:52 -0600
Delivered-to: realbasic-nug at lists dot realsoftware dot com
I've been banging my head against the wall trying to figure out the proper 
equation to make this happen... I'm certain one of you brilliant folks on this 
list can help me out...

I am displaying a grid of images. Each image's space will be perfectly square 
(pic.width=pic.height). I have a finite amount of space within which to display 
the images. This space is traditionally rectangular (portrait or landscape), 
but could easily be square.

I need to fit a number of images into this space. The number of images will 
vary, but they need to be fit in without a scrollbar. Their size should be 
dynamically adjusted to the available dimensions. The grid will be filled Left 
to Right each row and the rows work from top to bottom. If there are not enough 
images to evenly use all spaces in the final row, blank areas will be to the 
*right* of the filled in cells.

Essentially the final usage could be similar to iPhoto's display of an entire 
album of images on one screen. The actual desire is to fit a full folder of 
images (dynamically sized) on one portion of a sheet of paper. Generally 
there'll be only 2-8 images, but I want to accommodate any number.

This will be drawn into the printer object's graphics object. The available 
page area will be known, but change based on page setup selections. I will be 
making adjustments to the image's appearance (including adding a dynamically 
sized filename) within the square cells. I just need to know how to determine 
the number of columns and rows necessary to display this grid of square cells 
at the largest size possible.

Example:
Space available: 576x288 (8"x4" total in printed canvas terms)
Total Number of Images: 7

**Result** a 144x144 (2"x2") cell size which has 2 rows and 4 columns


That was a very basic example, but gets the general principle. I need the 
equation which will provide that type of result. Of course, for situations 
which don't provide full usage of the width and/or height, there will be white 
space to the right or bottom of the grid. That's fine. I just need to fit all 
of the images in at the largest size possible.

I hope I've provided sufficient explanation for my dilemma. Hopefully someone 
can help me out. Thanks in advance!!!

Sincerely,
Jeremiah "BluJai" Sanders
Photographer

Sincerely,
Jeremiah "BluJai" Sanders, President
Qrystallized Media
Office: 615-889-6330
Web:  http://www.QrystallizedMedia.com

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>