drawBezierShape in drawOn

TJ Leone tj at leonelearningsystems.com
Wed Dec 7 17:55:28 UTC 2005


Squeakers,

I finally got back to looking at Squeak, and I have my first dumb question.

I tried to make a class called AMorph (subclass of Morph) with the 
following drawOn method:

------------------------------------------------------------------------------
drawOn: aCanvas

         "draw a Bezier shape"

         aCanvas asBalloonCanvas aaLevel: 4;
         drawBezierShape: {30 @ 30. 30 @ 200. 200 @ 10.
                          200 @ 10. 50 @ 150.  50 @ 30.
                           50 @ 30. 30 @ 30.   30 @ 30}
         color: Color red
         borderWidth: 1
         borderColor: Color green
---------------------------------------------------------------------------------

To get it to draw I execute the following in a Workspace:

AMorph new openInWorld.

After overwriting defaultBounds, the shape draws fine, but it disappears 
when I drag it around and try to drop anywhere besides the upper left 
corner of the World.

It looks like I need to do something to tell AMorph that the control points 
should be relative to its position, but I'm not sure how to that.  How do I 
fix this method?

--TJ

At 12:10 PM 11/3/2005, you wrote:
>Hi TJ!
>
>When I worked on Stencili, a would-be vector graphics in Squeak, I
>worked on some graphical primitives. Unfortunately, it's been a while,
>and I don't have any of the code handy. To get a head start, your best
>bet may be the Bezier classes that already exist in Squeak. Let me
>know if you need some help getting started. (interestingly, I decided
>to return to Squeak only this week).
>
>Also, some reading on arcs represented :
>http://graphics.stanford.edu/courses/cs248-98-fall/Final/q1.html
>http://www.tinaja.com/cubic01.asp
>http://www.tinaja.com/glib/bezarc1.pdf
>
>The first link shows a specific example of a 90 degree arc represented
>with Bezier segments. The last one is a more generic one.
>
>Bolot
>
>
>On 11/2/05, TJ Leone <tj at leonelearningsystems.com> wrote:
> > Hi,
> >
> > I used to be a programmer at Northwestern.  Maybe we met when I was working
> > on the ITR project?  Anyway, I'm thinking about trying to port an
> > application of mine from Java to Squeak and Je77 said you might be able to
> > help me out.
> >
> > I need a class similar to the Arc2d class in Java.  Have you begun or
> > completed work on anything like this?
> >
> > The application I'm looking to port (called Circular Reasoning) is
> > available for download at
> > http://www.leonelearningsystems.com/circular_reasoning.htm.
> >
> > --TJ
> >
> > >Date:   Tue, 1 Nov 2005 14:30:02 -0500
> > >From:   "Jochen F. Rick" <nadja at cc.gatech.edu>
> > >To:     Eddie Cottongim <cottongim at earthlink.net>
> > >Cc:     tj at leonelearningsystems.com, squeakers at cc.gatech.edu
> > >Subject: Re: [Squeakers] [Fwd: Arcs?]
> > >User-Agent: Mutt/1.4.2.1i
> > >
> > >Hi TJ,
> > >
> > >Bolot was at one time working on something like that. I think he got
> > >pretty close. You may want to contact him. I assume you met him back on
> > >the ITR project. His new e-mail address is bolot at usa.net
> > >
> > >The other people to contact would be the MathMorphs people:
> > >http://www.dm.uba.ar/MathMorphs/
> > >
> > >Peace and Luck!
> > >
> > >Je77
> > >
> > >On Mon, Oct 31, 2005 at 09:47:58PM -0500, Eddie Cottongim wrote:
> > > > I don't think theres anything that does that off the shelf. But there's
> > > > PolygonMorph, which might allow him to build things piecewise. Theres
> > > > also the ST-80 Paths package, that has Arc, Circle, Line, etc, but
> > > > doesn't have drawing support in Morphic.
> > > >
> > > > One  approach to creating "SliceMorph" woud be to subclass PolygonMorph
> > > > and provide some methods to control a fixed set of points from a circle
> > > > point of view. The only difficulty I see here is that for a slice, you
> > > > want smoothing applied to only the points on the outside of the arc.
> > > > Another one would be to look at EllipseMorph and add some arbitrary
> > > > circle properties and use a fancier draw method.
> > > >
> > > > Eddie
> > > >
> > > >
> > > > Mark Guzdial wrote:
> > > >
> > > > >Can anyone give TJ a hand here?
> > > > >
> > > > >-------- Original Message --------
> > > > >Subject:     Arcs?
> > > > >Date:        Wed, 26 Oct 2005 09:03:14 -0500
> > > > >From:        TJ Leone <tj at leonelearningsystems.com>
> > > > >To:  guzdial at cc.gatech.edu
> > > > >
> > > > >
> > > > >
> > > > >Mark,
> > > > >
> > > > >I don't know if you remember me.  We met once a few years ago on a 
> joint
> > > > >project with Georgia Tech, U of Mich, and Northwestern.  I was part of
> > > the
> > > > >Northwestern contingent.
> > > > >
> > > > >Anyhow, I was thinking about using Squeak for some work I'm doing now,
> > > but
> > > > >I can't find a class like the Arc2D class in Java.  I want to be 
> able to
> > > > >create arcs, circle segments and sectors of arbitrary orientation,
> > > central
> > > > >angle, and radius length and change them on the fly.  Is there such a
> > > > >Squeak class?
> > > > >
> > > > >If not, how would I go about creating one?  I'm a total Smalltalk
> > > > >newbie.  I know there's a class called CurveMorph and I think I saw a
> > > > >method called beSmoothCurve someplace, but I don't know anything about
> > > > >drawing programmatically with Squeak.
> > > > >
> > > > >I tried posting this question to squeak-dev, but I haven't heard 
> anything.
> > > > >
> > > > >--TJ
> > > > >
> > > > >
> > > > >TJ Leone
> > > > >Leone Learning Systems, Inc.
> > > > >237 Custer Ave
> > > > >Evanston, IL 60202
> > > > >
> > > > >Email: tj at leonelearningsystems.com
> > > > >Phone: (847) 951-0127
> > > > >Fax: (847) 733-8812
> > > > >Web: http://www.leonelearningsystems.com
> > > > >
> > > > >
> > > > >
> > > > >------------------------------------------------------------------- 
> -----
> > > > >
> > > > >_______________________________________________
> > > > >Squeakers mailing list
> > > > >Squeakers at cc.gatech.edu
> > > > >https://mailman.cc.gatech.edu/mailman/listinfo/squeakers
> > > > >
> > > > >
> > > >
> > > > _______________________________________________
> > > > Squeakers mailing list
> > > > Squeakers at cc.gatech.edu
> > > > https://mailman.cc.gatech.edu/mailman/listinfo/squeakers
> > >
> > >--
> > >Jochen "Jeff" Rick, PhD Candidate, Georgia Tech College of Computing
> > >jochen.rick at cc.gatech.edu, http://www.je77.com/, work: 404-385-1105
> >
> > TJ Leone
> > Leone Learning Systems, Inc.
> > 237 Custer Ave
> > Evanston, IL 60202
> >
> > Email: tj at leonelearningsystems.com
> > Phone: (847) 951-0127
> > Fax: (847) 733-8812
> > Web: http://www.leonelearningsystems.com
> >
> >
> >

TJ Leone
Leone Learning Systems, Inc.
237 Custer Ave
Evanston, IL 60202

Email: tj at leonelearningsystems.com
Phone: (847) 951-0127
Fax: (847) 733-8812
Web: http://www.leonelearningsystems.com 




More information about the Squeak-dev mailing list