[Pharo-dev] Fast render of a bitmap in Athens?

Igor Stasenko siguctua at gmail.com
Mon Apr 7 20:40:10 EDT 2014


On 7 April 2014 19:42, Alexandre Bergel <alexandre.bergel at me.com> wrote:

> Hi!
>
> How can a form be quickly displayed in a surface? Is it correct to do?
>
>         athensCanvas pathTransform restoreAfter: [
>                 athensCanvas setPaint: self form.
>                 athensCanvas draw ]
>
> Apparently, the root is AthensCairoSurface>>#fromForm: is really slow. How
> to have a fast bitmap rendering in Athens?
>
> yes, converting from form to paint is slow, because it copies contents
(form's bits)
into new cairo surface.
to speed things up , cache the result:

        athensCanvas pathTransform restoreAfter: [

paint := ( canvas cacheAt: self form
    ifAbsetPut: [ (self form asAthensPaintOn: canvas) ]).

athensCanvas setPaint: paint.

(and before saying draw, you have to set shape first, isn't?)
athensCanvas setShape: ....

                athensCanvas draw ]



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


-- 
Best regards,
Igor Stasenko.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140408/e7d1a006/attachment-0002.html>


More information about the Pharo-dev mailing list