How can I fill a polygon with a graphic

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

How can I fill a polygon with a graphic

Steve Thomas
So I have a fraction cutter that can split a polygon and separate the halves by moving them apart.

I want to be able to allow a teacher (or student) to select a graphic to place inside the polygon so they can cut cakes, cookies, pictures of themselves etc.

The polygon has an option from the menu to set "fill style" to "bitmap fill".  But "choosing a new graphic" is not straight forward (an option similar to a player variable where I can click on an costume would be nice). And "grab a new graphic" does not allow for the precision I need and requires some trial and error which makes difficult things I want to be easy.

So is there a way to "choose a new graphic" in smalltalk code?

Stephen

_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: How can I fill a polygon with a graphic

Bert Freudenberg

On 20.07.2011, at 07:03, Steve Thomas wrote:

> So I have a fraction cutter that can split a polygon and separate the halves by moving them apart.
>
> I want to be able to allow a teacher (or student) to select a graphic to place inside the polygon so they can cut cakes, cookies, pictures of themselves etc.
>
> The polygon has an option from the menu to set "fill style" to "bitmap fill".  But "choosing a new graphic" is not straight forward (an option similar to a player variable where I can click on an costume would be nice). And "grab a new graphic" does not allow for the precision I need and requires some trial and error which makes difficult things I want to be easy.

One idea would be to use a ScreeningMorph. It allows to view one object to be viewed "screened" by another morph.

It looks like it's missing from the object catalog. But you can use a RoundGlass from the "Just for Fun" category instead. This is actually a rectangular Magnifier screened by an Ellipse.

Click twice to get the halo on the Ellipse, lift it out. Then click twice again to lift the Magnifier out. Drop an Image in, then a Polygon.

Even if that does not fit your purpose, Screening is cool ;)

> So is there a way to "choose a new graphic" in smalltalk code?

I was about to suggest you look at the "caleidoscope" project, but google found these instead. Still pretty neat:

http://www.luise-buechner-schule.eisfair.net/moodle/mod/resource/view.php?id=16784

http://community.ofset.org/index.php/Les_limites_du_monde_Kedama

For the Smalltalk code you could use a textual script like this:

adoptGraphic
        Sensor waitNoButton.
        self costume
                fillStyle: (BitmapFillStyle fromForm: self costume world chooseClickTarget imageForm)

- Bert -


_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: How can I fill a polygon with a graphic

K K Subbu
In reply to this post by Steve Thomas
On Wednesday 20 Jul 2011 10:33:27 AM Steve Thomas wrote:
> I want to be able to allow a teacher (or student) to select a graphic to
> place inside the polygon so they can cut cakes, cookies, pictures of
> themselves etc.
I once wrote a changeset to use shapes as stencils or silhouettes to help out
Art et Squeak project. Since this had to with art rather than scripting, I
didn't seriously pursue its addition to Squeak/Etoys. I can revive the
changeset if there is sufficient interest now.

See http://community.ofset.org/index.php/Grab_area_button

Subbu
_______________________________________________
squeakland mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/squeakland