[Newbies] how to create multiple colorforms from a master colorform

Michael van der Gulik mikevdg at gmail.com
Mon Mar 2 00:38:45 UTC 2009


On Mon, Mar 2, 2009 at 12:48 PM, mstramba <mikestramba at gmail.com> wrote:

>
> Greetings,
>
> I have a ColorForm create from  : (Form fromFileNamed: cards).
>
> It's an 840x504x8  png file of a deck of playing cards, i.e. showing all
> the
> cards.
>
> I want to create individual ColorForms, each representing one playing card
> from the 'master' colorform.
>
> So I guess I need to (in a loop) extract a rectangular area of pixels from
> the original ColorForm and then create a new colorform from those extracted
> pixels.
>
> I'm looking at the ColorForm, ImageMorph, Form .. and other superlcasses
> methods, but haven't figured out which combination of methods I need to
> use.
>


eachCard := masterForm copy: (0 at 0 corner: 840 at 504).

You'll need to replace 0 at 0 and 804 at 504 with the coordinates you need.

Also, this is fun:

(Display copy: (0 at 0 corner: 1024 at 768)) asMorph openInWindow

It makes a partial screen-shot :-).

Gulik.

-- 
http://gulik.pbwiki.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20090302/2ce1da78/attachment.htm


More information about the Beginners mailing list