Re: [Pharo-dev] [ANN] Sparta v1.0

2016-09-12 Thread Nicolai Hess
2016-09-05 11:50 GMT+02:00 Aliaksei Syrel :

> Hi
>
> I am happy to announce the release of Sparta v1.0 for Pharo 5 and Pharo 6.
> https://github.com/syrel/Sparta/tree/v1.0
> For a moment only Linux and Mac are supported.
>
> It can be bootstrapped with the following script:
>
> Metacello new
>   baseline: 'Sparta';
>   repository: 'github://syrel/sparta:v1.0/src';
>   load: #file:core
>
>
> (on linux install 32bit libgtk-2, lingtk-3 and libstdc++)
> (script for ubuntu http://ws.stfx.eu/IEAWCUC18BH)
>
> Sparta is an almost stateless vector graphics API for Pharo that provides
> bindings to the Moz2D rendering backend. Moz2D is the extracted graphical
> engine from Mozilla Firefox compiled as standalone shared library together
> with the extern C bindings required to call the engine from Pharo.
>
> - developed with the help of Iceberg
>  (thanks!) on Github.
> - integrated into travis-ci  using
> smalltalkCI  (great job!).
> - documented using Pillar  (so
> better!) syntax.
>
>
I tried it on linux mint 18 (32 Bit) and executing any moz-example makes
the image crashing.
I will try to find out what exactly happens or do you have an idea what is
missing?



> Cheers,
> Alex
>


Re: [Pharo-dev] [ANN] Sparta v1.0

2016-09-05 Thread Aliaksei Syrel
Moz2D is used in Firefox to render webpages. For us it means that it
supports all latest web features (concerning graphics) and allows us to
finally implement the whole SVG standard.

> "Why would one use it rather than the
other existing Pharo libraries/wrappers?"

As far as I know there are two 2D libraries in Pharo: BitBlt and Athens
(backend Cairo). Obviously BitBlt does not fit all our needs :) Athens is
nice vector graphics abstraction. However, it does not support shadows,
filters, clipping by arbitrary path, only works in global coordinates and
has primitive text rendering. All those features were not necessary at the
time it was developed. Another problem is statefullness of Athens (state is
shared between draw operation) which does not fit so good when it comes to
the rendering of an element tree. There is a modern trend to move from
statefull to stateless frameworks.

It is almost impossible to extend Athens without breaking user applications
that use it.

So, Sparta is Athens2 that adds support of all mentioned features. It is
inspired and based on amazing work of Igor Stasenko.

In Pharo we have bindings to Cairo. Which is old, lacks on features and no
more maintained so good as it was before. To be performant we need to use
native backends on every platform: D2D1 on Windows, X11 on Linux,
CoreGraphics on Mac. Just imagine how much work is needed to implement
bindings for every mentioned backend :) And do not forget that CoreGraphics
is Object-C and can not be directly called through FFI, it has to be
wrapped in C first...
With Moz2D we get them all out of box for fee :)

Cheers
Alex

On Sep 5, 2016 16:28, "Sean P. DeNigris"  wrote:

> Aliaksei Syrel wrote
> > bindings to the Moz2D rendering backend.
>
> Great! What is the use case for Moz2D? Why would one use it rather than the
> other existing Pharo libraries/wrappers?
>
>
>
> -
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/ANN-
> Sparta-v1-0-tp4914154p4914184.html
> Sent from the Pharo Smalltalk Developers mailing list archive at
> Nabble.com.
>
>


Re: [Pharo-dev] [ANN] Sparta v1.0

2016-09-05 Thread Sean P. DeNigris
Aliaksei Syrel wrote
> bindings to the Moz2D rendering backend.

Great! What is the use case for Moz2D? Why would one use it rather than the
other existing Pharo libraries/wrappers?



-
Cheers,
Sean
--
View this message in context: 
http://forum.world.st/ANN-Sparta-v1-0-tp4914154p4914184.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.



Re: [Pharo-dev] [ANN] Sparta v1.0

2016-09-05 Thread Aliaksei Syrel
>
> How does this handles accelerated graphics?


Nice question :)

There are 3 ways to create a canvas:

1) canvas for offscreen rendering. In this case it must be rasterized in
order to be displayed on the screen. (requres pixel copying)
2) canvas for existing pixel buffer. In this case every draw operation
directly manipulates pixels. For example there is a way to get a pointer to
pixel buffer of SDL Window and create sparta canvas that would wrap it (no
pixel copying required, very fast).
3) canvas for GL context. For example we could create an SDL window with
OpenGL support, get GLContext and create canvas that would operate on it.
(fast but a bit complicated).

First way can result in either software or hardware rendering. For example
on Mac users can choose one of the following backends: CoreGraphics CPU or
CoreGraphics GPU, Skia CPU or Skia GPU and even Cairo.

Second way does not allow to use GPU Accelerated backends, since canvas is
created for pixel buffer. On Mac it is CoreGraphics CPU, Skia CPU or Cairo.

Third way actually allows to create GPU accelerated canvas. For example
Skia GPU renders everything using OpenGL. It is supported on all platforms:
windows, linux, mac, android, iOS.

The most simple way to create a new canvas is:

> canvas := MozCanvas extent: 500@400.


Behind the scenes it chooses the best backend for current platform: D2D1 on
Windows, CoreGraphics on Mac and Skia+X11 mixture on Linux.

Important to mention that Sparta allows developers to manually select which
backend to use.

Cheers,
Alex

On 5 September 2016 at 14:51, philippe.b...@highoctane.be <
philippe.b...@gmail.com> wrote:

> Sweet.
>
> How does this handles accelerated graphics?
>
> Phil
>
> Le 5 sept. 2016 11:52, "Aliaksei Syrel"  a écrit :
>
>> Hi
>>
>> I am happy to announce the release of Sparta v1.0 for Pharo 5 and Pharo 6.
>> https://github.com/syrel/Sparta/tree/v1.0
>> For a moment only Linux and Mac are supported.
>>
>> It can be bootstrapped with the following script:
>>
>> Metacello new
>>   baseline: 'Sparta';
>>   repository: 'github://syrel/sparta:v1.0/src';
>>   load: #file:core
>>
>>
>> (on linux install 32bit libgtk-2, lingtk-3 and libstdc++)
>> (script for ubuntu http://ws.stfx.eu/IEAWCUC18BH)
>>
>> Sparta is an almost stateless vector graphics API for Pharo that provides
>> bindings to the Moz2D rendering backend. Moz2D is the extracted graphical
>> engine from Mozilla Firefox compiled as standalone shared library together
>> with the extern C bindings required to call the engine from Pharo.
>>
>> - developed with the help of Iceberg
>>  (thanks!) on Github.
>> - integrated into travis-ci  using
>> smalltalkCI  (great job!).
>> - documented using Pillar  (so
>> better!) syntax.
>>
>> Cheers,
>> Alex
>>
>


Re: [Pharo-dev] [ANN] Sparta v1.0

2016-09-05 Thread philippe.b...@highoctane.be
Sweet.

How does this handles accelerated graphics?

Phil

Le 5 sept. 2016 11:52, "Aliaksei Syrel"  a écrit :

> Hi
>
> I am happy to announce the release of Sparta v1.0 for Pharo 5 and Pharo 6.
> https://github.com/syrel/Sparta/tree/v1.0
> For a moment only Linux and Mac are supported.
>
> It can be bootstrapped with the following script:
>
> Metacello new
>   baseline: 'Sparta';
>   repository: 'github://syrel/sparta:v1.0/src';
>   load: #file:core
>
>
> (on linux install 32bit libgtk-2, lingtk-3 and libstdc++)
> (script for ubuntu http://ws.stfx.eu/IEAWCUC18BH)
>
> Sparta is an almost stateless vector graphics API for Pharo that provides
> bindings to the Moz2D rendering backend. Moz2D is the extracted graphical
> engine from Mozilla Firefox compiled as standalone shared library together
> with the extern C bindings required to call the engine from Pharo.
>
> - developed with the help of Iceberg
>  (thanks!) on Github.
> - integrated into travis-ci  using
> smalltalkCI  (great job!).
> - documented using Pillar  (so
> better!) syntax.
>
> Cheers,
> Alex
>