More...morphic

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

More...morphic

nacho
Hi!
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?
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.
Thanks in advance
nacho
Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: More...morphic

KenDickey
On Fri, 25 Apr 2014 12:52:47 -0700 (PDT)
nacho <[hidden email]> 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@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@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

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
-KenD
Reply | Threaded
Open this post in threaded view
|

Re: More...morphic

nacho
This post was updated on .
Ken,
Thanks for your answer. I will definitely take a look at both implementations.
And Morphic 3 sounds terrific.
The implementation already began? or it's something planned for the future?
Also, thanks for the example, code, and work in progress you have on your GitHub repos, they are a very valuable source of information.
Best
Nacho
 
Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: More...morphic

Juan Vuletich-4
Hi Folks,

On 4/26/2014 10:09 AM, nacho wrote:
> Ken,
> Thanks for your answer. I will definitely take a look at both
> implementations.
> And Morphic 3 sound terrific.

Thanks!

> The implementation already began? or it's something planned for the future?

I've started working on it in 2006. The samples in the web page were don
with an early prototype.

The main reason for not publishing the code is that the ideas could be
patented by someone else, if not protected in some way. That's why I
wrote
http://www.defensivepublications.org/publications/prefiltering-antialiasing-for-general-vector-graphics 
. There are some other details that also need protection, and I'm still
working out details, but the code will be published this year (although
I'm not sure if it will be mature enough to actually replace Morphic 2...)

> Also, thanks for the example, code, and work in progress you have on your
> GitHub repos, they are a very valuable source of information.
> Best
> Nacho

Cheers,
Juan Vuletich

_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org