[Cuis] More...morphic

Ken Dickey Ken.Dickey at whidbey.com
Fri Apr 25 19:25:24 CDT 2014


On Fri, 25 Apr 2014 12:52:47 -0700 (PDT)
nacho <0800nacho at gmail.com> wrote:

> In trying to understand how morphic is implemented in Cuis, several
> questions arise:
> 1) In Squeak to get the bounds of a morph the bounds and bonds: methods are
> used. Searching the Morph class I think I figured out that in Cuis that is
> done by morphBoundsInWorld and morphBoundsInWorld: is that correct?

Yes.  

A big change for Cuis is a transition/migration to something called Morphic 3.

  http://www.jvuletich.org/Morphic3/Morphic3-201006.html

Part of the migration (not yet complete) to scalable graphics is making the graphic coordinates themselves scalable (integer coordinates->float coordinates) and part is making Morphs be positioned relative to their container, rather than a single, global screen position.

So a CUIS Morph has a location (relative to its owner) and an extent.

This means that the origin of its rectangle is always 0 at 0.

You can see this in the difference in #drawOn: Squeak and CUIS.

|================
[Squeak]Morph>>drawOn: aCanvas
	aCanvas fillRectangle: self bounds 
		fillStyle: self fillStyle 
		borderStyle: self borderStyle.
|================
[CUIS]Morph>>drawOn: aCanvas
	"A canvas is already set with a proper transformation from our 	
	  coordinates to those of the Canvas target."
	aCanvas fillRectangle: (0 at 0 extent: self morphExtent)
		color: self color
|================


Following the CUIS philosophy, Morphs have been 'simplified'.  

Note the difference in Ivars from Squeak. Squeak Morphs look slimmer, but they typically have a MorphExtension -- which is not slim at all.

CUIS Morphs just use properties where needed.

I'll let Juan take it from here..


> 2) When I use a canvas..the drawOn: aCanvas method
> 
> aCanvas fillRectangle: ( xxxxx ) color: lightRed
> 
> What is supposed to be xxxx? from inspecting the method in the browser it's
> a rectangle but if I do:
> aCanvas fillRectangle: (RectangleLikeMorph new) color: lightRed 
> I get an error.
> I'm a little puzzled.

A RectangleLikeMorph is not a Rectangle or a subclass of Rectangle.

See Morph>>drawOn: , above.

This is subtle stuff.  Yes, documentation is wanted.

Only 36 hours in a day, however.  ;^)

Cheers,
-KenD




More information about the Cuis mailing list