Hello Clement

restoreAfter: is not only for transformation. It also restores clipping - that is why we need restoreAfter. (uses push and pop state). Having that clipping region is an arbitrary path there is no way to avoid pop and push state - which costs a lot in Cairo. It is slow because Cairo and Athens are statefull - which is bad for rendering a composition of arbitrary elements.

Right now there is a huge work going on new Sparta - it will be almost stateless and will support a wide variety of backends (Cairo, Skia, CoreGraphics and so on).
Current Sparta-Cairo is an experiment which goal was to support clipping by arbitrary path. We learned that it is slow because of statefullness.

In order to fill a square with color we have to perform the following ffi native calls:
- set color
- set shape
- fill

Even in the most simple case we need 3 calls. When it gets more complicated there are even more calls. Preparing drawing context with multiple calls to perform an operation is a consequence of statefullness.

Modern browsers use stateless canvases to render content. Idea is simple: one call per drawing operation. Example above would look like:
- fillPath(aPath, aPattern, drawOptions).
That is it.
Second benefit is that we don't need to care about shared state between drawing operations, no more push/pop state and as result huge performance boost.

Cheers
Alex

On Jun 21, 2016 1:34 PM, "Cl��ment Bera" <bera.clement@gmail.com> wrote:
Hi,

Thanks Doru it now works for me ! Very exciting indeed.

I have a few questions:

1. In Pharo the World menu is accessed through left-click and right-click provides the world contents. In Bloc, right-click displays the world menu and left-click does nothing. Is it expected / some design choice or just convenience for debugging ? At first glance I thought Bloc didn't work because I was left-clicking like in Pharo.

2. Can we change the fonts in Bloc ?��

3. When (in Bloc) I go to World menu>>help>>Help browser>>Bloc>>Grid Layout, I find the following license:��

Copyright (C) 2011 The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Does it mean Bloc is not under MIT ? Or is it completely unrelated ?

4. What is Cairo-Sparta ? What is the difference with Athens ?

5. It seems that the normal Pharo image in idle spends between 4 and 5% of execution time in the Morphic process, while in Bloc it seems that between 17 and 23% of execution time is in the main bloc loop (BlBoostedMainLoopManager). Isn't that a lot ?��
- It's interesting to see that 28% of execution time spent in Bloc is in BlSpartaCanvas>>#restoreAfter:. In the 2D video games I wrote (both using Cairo and Javascript canvas) I avoided using #restoreAfter: and instead in method such as BlSpartaCanvas >>#transform:during: I used a reverse transformation to restore the state. I am wondering if that's possible in large graphic framework like Bloc, that would save a quarter of the time. Maybe it's possible only in simple 2D video games.
- Aside from restoreAfter, there is no obvious ways on how to save time...

Well keep up the good work.



On Tue, Jun 21, 2016 at 11:36 AM, Tudor Girba <tudor@tudorgirba.com> wrote:
Hi,

Thanks for looking at it.

You have to first switch to the Bloc space:

World Menu / Bloc / Switch to Bloc
(I think there is a problem right now with OS-Window)

Then, from Nautilus, you can pick an example and Inspect Return-Values to get the object.

Cheers,
Doru



On Jun 21, 2016, at 10:42 AM, Cl��ment Bera <bera.clement@gmail.com> wrote:

Hi Doru,

Ok I understand I have issues keeping comments updated in my projects too :-). Do your best.

I tried to run the examples from Bloc-Core-Examples but they didn't work. I downloaded the latest��Pharo-Spur32 VM from��files.pharo.org��and retried and it still didn't work.

How can I have the examples running ?

Here is the errors I have for the first two examples of BlExampleElementWithBorderAndFill.

<Screen Shot 2016-06-21 at 10.40.39 AM.png>

Here are the examples:

<Screen Shot 2016-06-21 at 10.37.49 AM.png>


Best,

Clement

On Tue, Jun 21, 2016 at 10:09 AM, Tudor Girba��<tudor@tudorgirba.com>��wrote:
Hi Clement,

Thanks for looking at it.

Indeed, there aren���t many comments. A large part of the engine got rewritten twice over the last��months, and many of the previous comments were no longer up to date.

And no, the policy is not to not write comments :), but right now the priority is on building examples.��which you will find in the Bloc-Core-Examples classes and their subclasses.

Cheers,
Doru



> On Jun 21, 2016, at 9:39 AM, Cl��ment Bera <bera.clement@gmail.com> wrote:
>
> Hi Doru,
>
> I downloaded the image, opened Nautilus, clicked on the package named 'Bloc-Core' and all the��classes I can see have no class comments (See screenshot below). Is there a 'No class comment'��policy in Bloc ? Or maybe the top classes shown are just non representative of the class comments��of the overall framework.
>
> <Screen Shot 2016-06-21 at 9.33.31 AM.png>
>
> On Tue, Jun 21, 2016 at 7:42 AM, Tudor Girba <tudor@tudorgirba.com> wrote:
> Hi,
>
> Here is a brief update on the status of Bloc.
>
> Several of us came together to form a team and work to see Bloc in Pharo 6 at least as a preview.��The team communication happens via Slack in a dedicated team, and the goal is to have regular��progress/feedback communication on this mailing list.
>
> Just because we have a dedicated team does not mean that your feedback is important. In fact,��over the last months, Bloc was redesigned again to include the feedback we got here. So, now we��have:
> - Element is responsible for drawing (no more shape)
> - Interaction area and clipping area are now distinct
>
> You can find the current build on top of Pharo 6 here:
>��https://ci.inria.fr/moose/job/bloc/PHARO=alpha,VERSION=development,VM=vmLatest/
>
> The current team focus goes like this:
> - Alain is looking at events,
> - Glenn is playing with creating new elements in Bloc and refactoring the way we can manage ,
> - Alex (Syrel) and Esteban are working on the backend to make rendering faster,
> - Doru is pretending to do something useful.
>
> Cheers,
> Doru
>
>
> --
>��www.tudorgirba.com
>��www.feenk.com
>
> "What we can governs what we wish."
>
>
>
>
>
>

--
www.tudorgirba.com
www.feenk.com

"Presenting is storytelling."




--
www.tudorgirba.com
www.feenk.com

"Problem solving should be focused on describing
the problem in a way that makes the solution obvious."