Re: displaying a grid of images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: displaying a grid of images

Jerome Peace
displaying a grid of images

>Robert Withers reefedjib at yahoo.com
>Tue Jan 2 23:04:32 UTC 2007 wrote:
>Can anyone demonstrate how I could display a grid of
images within a  
>SystemWindow? <snipped>

Hi Robert,

Why not put a pasteupmorph in a system window.

size the pasteup to be large enough for all the
pictures.
get a collections of centerpoints  (for the images)
get a collection of thumbnails of the appropriate
size.
I would use ImageMorphs or make a subclass to
customize behavior.
paste the thumbs on the pasteup centered at the grid
centers.
overide the mouse down/up behaviors and it should
rock.

doing your own #drawOn: is the long way around.

Below is a workspace doit to get an example.  
In 3.9 there are ThumbnailImageMorphs.
If you tell them an extent they will resize the
picture to fall with in that extent.
The other alternative is to use a SketchMorph.

HTH.

Yours in service, --Jerome Peace

-----
copy all the below into a workspace.
select everything from the first brackett to its
closing brackett and doit.
-----

[

aSide := 3 .

onASide := ( 1 to: aSide ) .


" Here we model the grid "
centers := OrderedCollection new .

onASide do: [ :eachCol |
        onASide do: [ :eachRow |
                centers add: eachCol@eachRow ] ].

biggestExtent :=
ImageMorph new extent .

"Make a place to keep them and put it where it wants
to end up.""

play :=
PasteUpMorph authoringPrototype extent: biggestExtent
* (aSide + 2) .

play openCenteredInWorld .

"Collect the grid positions."

centerPoints :=
centers collect: [ :each |
        play bounds extent // (aSide + 1) * each + play
topLeft ] .

pictures :=
centerPoints collect: [ :each |
        ImageMorph new center:  each ] .

"or
pictures :=
 myImages collect:  [ :each  |
        ImageMorph new image: each ] .
pictures with: centerPoints do: [ :each :eachCenter |

        each center: eachCenter ] . "

play addAllMorphs: pictures .

play embedInWindow .

 ] value .


play removeAllMorphs .

play delete .



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners