Question about Morphic

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

Question about Morphic

Alexandre Bergel-4
Dear All,

I know some of you are morphic expert :-)
I am still on the quest to make Mondrian usuable in Squeak/Pharo. The  
situation is the following: I have a window having scrollbar, and I am  
trying to render (using Balloon) something bigger than what the window  
can actually display. Balloon seems to not be aware of the part of the  
canvas being actually displayed. It simply try to render everything.  
Is my guess right? Can anyone confirm please?
Is there a way to turn this on?

Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Igor Stasenko
2009/2/22 Alexandre Bergel <[hidden email]>:

> Dear All,
>
> I know some of you are morphic expert :-)
> I am still on the quest to make Mondrian usuable in Squeak/Pharo. The
> situation is the following: I have a window having scrollbar, and I am
> trying to render (using Balloon) something bigger than what the window
> can actually display. Balloon seems to not be aware of the part of the
> canvas being actually displayed. It simply try to render everything.
> Is my guess right? Can anyone confirm please?
> Is there a way to turn this on?
>
Canvas has the clipping capabilities.
So, you can send a command to render a rectangle (-1000 @ -1000)
corner: (10000 @10000)
but depends on canvas clipping area, it will render only part of it.

Also, for displaying morphs withing area with scrolling - use a
TransformMorph to apply clipping & sroll in view.
There are another morphs , ready for use , like ScrollPane

> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Lukas Renggli
In reply to this post by Alexandre Bergel-4
> canvas being actually displayed. It simply try to render everything.
> Is my guess right? Can anyone confirm please?
> Is there a way to turn this on?

In the original implementation whenever a shape was draw, all child
shapes were clipped according to the bounds of the parent shape. So
the root shape clipped to the bounds of the window.

You could test before drawing if the shape is visible at all, however
in my experience you do not gain any speed because the graphic engine
is much faster at performing such tests. At some points I also
experimented with R- and Generalized Search Trees, but I figured out
that in most cases it is not worth the troubles. For Mondrian
visualization the whole dataset is normally displayed anyway. These
kind of trees only bring speed improvement, if typically only a
fraction of a huge amount of data is visible, like this is the case in
a game world or a CAD application.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Alexandre Bergel
In reply to this post by Igor Stasenko
> Canvas has the clipping capabilities.
> So, you can send a command to render a rectangle (-1000 @ -1000)
> corner: (10000 @10000)
> but depends on canvas clipping area, it will render only part of it.
>
> Also, for displaying morphs withing area with scrolling - use a
> TransformMorph to apply clipping & sroll in view.
> There are another morphs , ready for use , like ScrollPane

I exactly use a ScrollBar. Here is a code excerpt:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
        | window pane |
        window := SystemWindow labelled: 'Mondrian Canvas'.
        window model: self.
        window extent: 640 @ 480.
        pane := ScrollPane new.
       
        canvas := MOCanvas on: self root.
        pane scroller addMorph: canvas.
        window
                addMorph: pane
                frame: (0 @ 0 corner: 1 @ 1).
        window openInWorld.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

MOCanvas is a subclass of Morph that is resized on some point.

Apparently, this incantation does not activate this clipping.

Alexandre

>
>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Alexandre Bergel
In reply to this post by Lukas Renggli
Thanks to all of you for your prompt answer.

> You could test before drawing if the shape is visible at all, however
> in my experience you do not gain any speed because the graphic engine
> is much faster at performing such tests. At some points I also
> experimented with R- and Generalized Search Trees, but I figured out
> that in most cases it is not worth the troubles. For Mondrian
> visualization the whole dataset is normally displayed anyway. These
> kind of trees only bring speed improvement, if typically only a
> fraction of a huge amount of data is visible, like this is the case in
> a game world or a CAD application.

This is also what I would expect. But Apparently, displaying a lot of  
nodes outside the window slow the whole thing down.

I get this profiling: http://bergel.eu/Picture1.png
For this window being displayed: http://bergel.eu/Picture2.png

I think I will try to the display boxes that I am sure they are  
contained in the visible part of the window. The polymorph extension  
seem to ease this.

Thanks again,

Cheers,
Alexandre

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Igor Stasenko
2009/2/22 Alexandre Bergel <[hidden email]>:

> Thanks to all of you for your prompt answer.
>
>> You could test before drawing if the shape is visible at all, however
>> in my experience you do not gain any speed because the graphic engine
>> is much faster at performing such tests. At some points I also
>> experimented with R- and Generalized Search Trees, but I figured out
>> that in most cases it is not worth the troubles. For Mondrian
>> visualization the whole dataset is normally displayed anyway. These
>> kind of trees only bring speed improvement, if typically only a
>> fraction of a huge amount of data is visible, like this is the case in
>> a game world or a CAD application.
>
> This is also what I would expect. But Apparently, displaying a lot of
> nodes outside the window slow the whole thing down.
>
> I get this profiling: http://bergel.eu/Picture1.png
> For this window being displayed: http://bergel.eu/Picture2.png
>
> I think I will try to the display boxes that I am sure they are
> contained in the visible part of the window. The polymorph extension
> seem to ease this.
>
you can test whether you drawing primitive is visible on the screen:
canvas isVisible: aRectangle



> Thanks again,
>
> Cheers,
> Alexandre
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Igor Stasenko
In reply to this post by Alexandre Bergel
2009/2/22 Alexandre Bergel <[hidden email]>:

>> Canvas has the clipping capabilities.
>> So, you can send a command to render a rectangle (-1000 @ -1000)
>> corner: (10000 @10000)
>> but depends on canvas clipping area, it will render only part of it.
>>
>> Also, for displaying morphs withing area with scrolling - use a
>> TransformMorph to apply clipping & sroll in view.
>> There are another morphs , ready for use , like ScrollPane
>
> I exactly use a ScrollBar. Here is a code excerpt:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>        | window pane |
>        window := SystemWindow labelled: 'Mondrian Canvas'.
>        window model: self.
>        window extent: 640 @ 480.
>        pane := ScrollPane new.
>
>        canvas := MOCanvas on: self root.
>        pane scroller addMorph: canvas.
>        window
>                addMorph: pane
>                frame: (0 @ 0 corner: 1 @ 1).
>        window openInWorld.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> MOCanvas is a subclass of Morph that is resized on some point.
>
> Apparently, this incantation does not activate this clipping.
>
Well,  i'm not sure how to use ScrollPane properly..
look for examples of it in other morphs.

> Alexandre
>
>>
>>
>>> Cheers,
>>> Alexandre
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Alexandre Bergel
In reply to this post by Igor Stasenko
> canvas isVisible: aRectangle

You great Man Igor,

spaciba
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Gary Chambers-4
In reply to this post by Igor Stasenko
The scroller itself provides the transform morph that deals with offsetting
within the scrollpane.
Canvases are used in the drawing cycle of morphs so a morph of some kind
(that implements drawOn: and draws the graphics) should be added to the
scroller of the scrollpane. The transform morph sets the clipping rectangle
for drawing its submorphs.

|window pane m|
window := SystemWindow labelled: 'Mondrian Canvas'.
window model: self.
window extent: 640 @ 480.
pane := ScrollPane new.
m := PolygonMorph new
    position: 250@200;
    extent: 400@300.
pane scroller addMorph: m.
window
addMorph: pane
frame: (0 @ 0 corner: 1 @ 1).
window openInWorld.


Regards, Gary

----- Original Message -----
From: "Igor Stasenko" <[hidden email]>
To: <[hidden email]>
Sent: Sunday, February 22, 2009 12:11 PM
Subject: Re: [Pharo-project] Question about Morphic


> 2009/2/22 Alexandre Bergel <[hidden email]>:
>>> Canvas has the clipping capabilities.
>>> So, you can send a command to render a rectangle (-1000 @ -1000)
>>> corner: (10000 @10000)
>>> but depends on canvas clipping area, it will render only part of it.
>>>
>>> Also, for displaying morphs withing area with scrolling - use a
>>> TransformMorph to apply clipping & sroll in view.
>>> There are another morphs , ready for use , like ScrollPane
>>
>> I exactly use a ScrollBar. Here is a code excerpt:
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>        | window pane |
>>        window := SystemWindow labelled: 'Mondrian Canvas'.
>>        window model: self.
>>        window extent: 640 @ 480.
>>        pane := ScrollPane new.
>>
>>        canvas := MOCanvas on: self root.
>>        pane scroller addMorph: canvas.
>>        window
>>                addMorph: pane
>>                frame: (0 @ 0 corner: 1 @ 1).
>>        window openInWorld.
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> MOCanvas is a subclass of Morph that is resized on some point.
>>
>> Apparently, this incantation does not activate this clipping.
>>
> Well,  i'm not sure how to use ScrollPane properly..
> look for examples of it in other morphs.
>
>> Alexandre
>>
>>>
>>>
>>>> Cheers,
>>>> Alexandre
>>>> --
>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>> Alexandre Bergel  http://www.bergel.eu
>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Question about Morphic

Alexandre Bergel
Thanks Gary,

Cheers,
Alexandre


On 23 Feb 2009, at 12:36, Gary Chambers wrote:

> The scroller itself provides the transform morph that deals with  
> offsetting
> within the scrollpane.
> Canvases are used in the drawing cycle of morphs so a morph of some  
> kind
> (that implements drawOn: and draws the graphics) should be added to  
> the
> scroller of the scrollpane. The transform morph sets the clipping  
> rectangle
> for drawing its submorphs.
>
> |window pane m|
> window := SystemWindow labelled: 'Mondrian Canvas'.
> window model: self.
> window extent: 640 @ 480.
> pane := ScrollPane new.
> m := PolygonMorph new
>    position: 250@200;
>    extent: 400@300.
> pane scroller addMorph: m.
> window
> addMorph: pane
> frame: (0 @ 0 corner: 1 @ 1).
> window openInWorld.
>
>
> Regards, Gary
>
> ----- Original Message -----
> From: "Igor Stasenko" <[hidden email]>
> To: <[hidden email]>
> Sent: Sunday, February 22, 2009 12:11 PM
> Subject: Re: [Pharo-project] Question about Morphic
>
>
>> 2009/2/22 Alexandre Bergel <[hidden email]>:
>>>> Canvas has the clipping capabilities.
>>>> So, you can send a command to render a rectangle (-1000 @ -1000)
>>>> corner: (10000 @10000)
>>>> but depends on canvas clipping area, it will render only part of  
>>>> it.
>>>>
>>>> Also, for displaying morphs withing area with scrolling - use a
>>>> TransformMorph to apply clipping & sroll in view.
>>>> There are another morphs , ready for use , like ScrollPane
>>>
>>> I exactly use a ScrollBar. Here is a code excerpt:
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>       | window pane |
>>>       window := SystemWindow labelled: 'Mondrian Canvas'.
>>>       window model: self.
>>>       window extent: 640 @ 480.
>>>       pane := ScrollPane new.
>>>
>>>       canvas := MOCanvas on: self root.
>>>       pane scroller addMorph: canvas.
>>>       window
>>>               addMorph: pane
>>>               frame: (0 @ 0 corner: 1 @ 1).
>>>       window openInWorld.
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>
>>> MOCanvas is a subclass of Morph that is resized on some point.
>>>
>>> Apparently, this incantation does not activate this clipping.
>>>
>> Well,  i'm not sure how to use ScrollPane properly..
>> look for examples of it in other morphs.
>>
>>> Alexandre
>>>
>>>>
>>>>
>>>>> Cheers,
>>>>> Alexandre
>>>>> --
>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> [hidden email]
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo- 
>>>>> project
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Igor Stasenko AKA sig.
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> [hidden email]
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Best regards,
>> Igor Stasenko AKA sig.
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project