Re: [Pharo-project] Athens work in progress: couple screenshots
Ah! So Athens is a facade, for a Canvas API, based on Paths, that could have a Cairo, OpenGl or BallonCanvas rendering engine as a backend. In the current case, using BallonCanvas (bit map based), i guess you are implementing the scalable fonts using the free type library? In Gaucho, i've done exactly that, i have a FontLibrary which acts as a cache for a particular font family, at a requested size. So when the canvas renders a string with a given font, it asks the library for the font at the current scale of the desired size. Although i prefer the abstractions that are present in Athens, and will try to use it instead eventually. Fernando pd: attached screen shot of Gaucho, using a scalable GCanvas (built on top of the free type lib and FormCanvas). On Wed, Nov 23, 2011 at 1:08 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
+1
Something big is happening in the Pharo World.
Alexandre
On 23 Nov 2011, at 08:44, Stéphane Ducasse wrote:
put it in the class comments somewhere. Do not expect that people will know what you know. Make the entry simple and immediate.
Stef
On 23 November 2011 11:21, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Igor
prepare the following:    - a class showing an example        with the transformation stuff (because it is unclear)
There is one: AthensBalloonSurfaceExamples
   - a tester canvas so that people can to
(CanvasTester testClass: CircleMorph) open.
err.. what is it?
To test morphic display on Athens you can do following:
| surf | Â Â Â surf := AthensBalloonSurface new form: (Form extent: Display extent depth: 32).
   surf drawDuring: [ :canvas |
       canvas fullDrawMorph: yourMorph. ].
Display getCanvas translucentImage: surf form at: 0@0
People could then extend the Athens package with the method in the morph.
It would be great to help adapting all morphs for Athens. Morphs, that having own draw method(s), should also have own #drawOnAthensCanvas:
I didn't covered all of them yet, so a little help with it would be nice. Also, it is good for checking the missing functionality in Athens API as well as learning it.
There's not much to learn yet :)
basicly what you should know is that you have coordinate system:
canvas pathTransform  (instance of AthensAffineTransform)
which you can manipulate to achieve desirable results.
And actual drawing:
canvas setPaint: somePaintObject. ( color, gradient, or anything which conforms to AthensPaint protocol ). canvas drawShape: Â (rect or path or anything , which responds to: 'paintFillsUsing: aPaint on: anAthensCanvas' ). canvas draw: (anything , which responds to #drawOnAthensCanvas: )
think that we are dummies willing to help and do the two things I mention above. I'm then sure you will get contributions.
Stef
-- Best regards, Igor Stasenko.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel  http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On 24 November 2011 01:33, Fernando Olivero <fernando.olivero@usi.ch> wrote:
Ah! So Athens is a facade, for a Canvas API, based on Paths, that could have a Cairo, OpenGl or BallonCanvas rendering engine as a backend.
Right. The only things which i don't want to be trapped with is to have minimal common denominator, which usually happens when you have different backends with different features. But i think we should be guided by our practical needs: instead of trying hard to support various fancy stuff, potentially usable in 0.001% cases, we should focus on things which we really need. That's why i took an effort with Morphic adoption.
In the current case, using BallonCanvas (bit map based), i guess you are implementing the scalable fonts using the free type library? In Gaucho, i've done exactly that, i have a FontLibrary which acts as a cache for a particular font family, at a requested size. So when  the canvas renders a string with a given font, it asks the library for the font at the current scale of the desired size.
In Athens i dont use cache for rendering freetype fonts, because it is pointless. I measured time to render text with and without letting freetype to render each separate glyph and found that glyphs rendering taking 1/3 of total rendering time. (so, it is memory bound - freetype renders a glyph into 8-bit grayscale bitmap, and then we blit it on 32bit bitmap, which explains given ratio, the cost of drawing shape(s) looks like completely neglectible ;). So, i don't see a big reason for having cache, and moreover it makes sense only if you render things horizontally, but if you allow an arbitrary angle and scale, then there is no way to make efficient cache of it (oh yeah.. unless you have terabytes of memory ;). The only thing which i imagine how to cache it is to capture the whole output of text into "cache bitmap", rather than bother with separate glyphs. But this is another level of caching, which potentially could be used for other things not just for text rendering. And actually it is easily doable by youself: we can create a separate surface, render stuff there, and then just blit ready for use parts to another surface, or redraw it, if something are changed.
Although i prefer the abstractions that are present in Athens, and will try to use it instead eventually.
Be careful, some abstractions are cruft :) Because i took the original work started by Cyrille , but all new classes i wrote was from scratch, while i left existing ones for review & future conversion. I should clean it to not confuse people.
Fernando pd: attached screen shot of Gaucho, using a scalable GCanvas (built on top of the free type lib and FormCanvas).
On Wed, Nov 23, 2011 at 1:08 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
+1
Something big is happening in the Pharo World.
Alexandre
On 23 Nov 2011, at 08:44, Stéphane Ducasse wrote:
put it in the class comments somewhere. Do not expect that people will know what you know. Make the entry simple and immediate.
Stef
On 23 November 2011 11:21, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Igor
prepare the following:    - a class showing an example        with the transformation stuff (because it is unclear)
There is one: AthensBalloonSurfaceExamples
   - a tester canvas so that people can to
(CanvasTester testClass: CircleMorph) open.
err.. what is it?
To test morphic display on Athens you can do following:
| surf | Â Â Â surf := AthensBalloonSurface new form: (Form extent: Display extent depth: 32).
   surf drawDuring: [ :canvas |
       canvas fullDrawMorph: yourMorph. ].
Display getCanvas translucentImage: surf form at: 0@0
People could then extend the Athens package with the method in the morph.
It would be great to help adapting all morphs for Athens. Morphs, that having own draw method(s), should also have own #drawOnAthensCanvas:
I didn't covered all of them yet, so a little help with it would be nice. Also, it is good for checking the missing functionality in Athens API as well as learning it.
There's not much to learn yet :)
basicly what you should know is that you have coordinate system:
canvas pathTransform  (instance of AthensAffineTransform)
which you can manipulate to achieve desirable results.
And actual drawing:
canvas setPaint: somePaintObject. ( color, gradient, or anything which conforms to AthensPaint protocol ). canvas drawShape: Â (rect or path or anything , which responds to: 'paintFillsUsing: aPaint on: anAthensCanvas' ). canvas draw: (anything , which responds to #drawOnAthensCanvas: )
think that we are dummies willing to help and do the two things I mention above. I'm then sure you will get contributions.
Stef
-- Best regards, Igor Stasenko.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel  http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
-- Best regards, Igor Stasenko.
On Nov 24, 2011, at 12:33 AM, Fernando Olivero wrote:
Ah! So Athens is a facade, for a Canvas API, based on Paths, that could have a Cairo, OpenGl or BallonCanvas rendering engine as a backend.
Yes!!! Yo got it.
In the current case, using BallonCanvas (bit map based), i guess you are implementing the scalable fonts using the free type library? In Gaucho, i've done exactly that, i have a FontLibrary which acts as a cache for a particular font family, at a requested size. So when the canvas renders a string with a given font, it asks the library for the font at the current scale of the desired size.
fernando you should mention more often what you are doing. Because like that we can maximize impact and interaction.
Although i prefer the abstractions that are present in Athens, and will try to use it instead eventually.
Fernando pd: attached screen shot of Gaucho, using a scalable GCanvas (built on top of the free type lib and FormCanvas).
On Wed, Nov 23, 2011 at 1:08 PM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
+1
Something big is happening in the Pharo World.
Alexandre
On 23 Nov 2011, at 08:44, Stéphane Ducasse wrote:
put it in the class comments somewhere. Do not expect that people will know what you know. Make the entry simple and immediate.
Stef
On 23 November 2011 11:21, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Igor
prepare the following: - a class showing an example with the transformation stuff (because it is unclear)
There is one: AthensBalloonSurfaceExamples
- a tester canvas so that people can to
(CanvasTester testClass: CircleMorph) open.
err.. what is it?
To test morphic display on Athens you can do following:
| surf | surf := AthensBalloonSurface new form: (Form extent: Display extent depth: 32).
surf drawDuring: [ :canvas |
canvas fullDrawMorph: yourMorph. ].
Display getCanvas translucentImage: surf form at: 0@0
People could then extend the Athens package with the method in the morph.
It would be great to help adapting all morphs for Athens. Morphs, that having own draw method(s), should also have own #drawOnAthensCanvas:
I didn't covered all of them yet, so a little help with it would be nice. Also, it is good for checking the missing functionality in Athens API as well as learning it.
There's not much to learn yet :)
basicly what you should know is that you have coordinate system:
canvas pathTransform (instance of AthensAffineTransform)
which you can manipulate to achieve desirable results.
And actual drawing:
canvas setPaint: somePaintObject. ( color, gradient, or anything which conforms to AthensPaint protocol ). canvas drawShape: (rect or path or anything , which responds to: 'paintFillsUsing: aPaint on: anAthensCanvas' ). canvas draw: (anything , which responds to #drawOnAthensCanvas: )
think that we are dummies willing to help and do the two things I mention above. I'm then sure you will get contributions.
Stef
-- Best regards, Igor Stasenko.
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
<scalableText-gCanvas.jpg>
participants (3)
-
Fernando Olivero -
Igor Stasenko -
Stéphane Ducasse