[Newbies] Re: displaying a grid of images
peace_the_dreamer at yahoo.com
Wed Jan 3 05:59:51 UTC 2007
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
Why not put a pasteupmorph in a system window.
size the pasteup to be large enough for all the
get a collections of centerpoints (for the images)
get a collection of thumbnails of the appropriate
I would use ImageMorphs or make a subclass to
paste the thumbs on the pasteup centered at the grid
overide the mouse down/up behaviors and it should
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.
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 at eachRow ] ].
ImageMorph new extent .
"Make a place to keep them and put it where it wants
to end up.""
PasteUpMorph authoringPrototype extent: biggestExtent
* (aSide + 2) .
play openCenteredInWorld .
"Collect the grid positions."
centers collect: [ :each |
play bounds extent // (aSide + 1) * each + play
topLeft ] .
centerPoints collect: [ :each |
ImageMorph new center: each ] .
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
More information about the Beginners