Rendering text to bitmap buffer then paintImage to a canvas

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

Rendering text to bitmap buffer then paintImage to a canvas

Ben Coman
I need to improve the performance of a lot of text that drawn on screen
while the screen is being dragged around and would like to experiment
with rendering the text to a bitmap buffer then painting that onto a
canvas.  How might that be achieved?  And from Workspace can I test
this?  I have been searching for a couple of hours already so thought
I'd just ask.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Jesus Nuñez
Take a look at Athenas, the package Athenas-Text may help. There are some tests in the same package so you can give it a try. (It may not work on pharo 1.4 since the Athenas version is outdated and the tests may fail, however make them work should be straightforward)

Regards,

Jesus
2013/1/10 Ben Coman <[hidden email]>
the text to a bitmap buffer then painting that onto a canvas.  How might that be achieved?  And from Workspace can I test this?  I have been searching for a couple of hours already so thought I'd just ask.


Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Igor Stasenko
In reply to this post by Ben Coman
On 10 January 2013 14:42, Ben Coman <[hidden email]> wrote:
> I need to improve the performance of a lot of text that drawn on screen
> while the screen is being dragged around and would like to experiment with
> rendering the text to a bitmap buffer then painting that onto a canvas.  How
> might that be achieved?  And from Workspace can I test this?  I have been
> searching for a couple of hours already so thought I'd just ask.
>

easy.

form := Form extent: 100@100 depth: 32.

canvas := form getCanvas.
canvas drawString... whatever.

and then:

displayCanvas drawImage: form.



> cheers -ben
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Igor Stasenko
In reply to this post by Jesus Nuñez
On 10 January 2013 20:15, Jesus Nuñez <[hidden email]> wrote:
> Take a look at Athenas, the package Athenas-Text may help. There are some
> tests in the same package so you can give it a try. (It may not work on
> pharo 1.4 since the Athenas version is outdated and the tests may fail,
> however make them work should be straightforward)
>
apart from some tests and examples, the work on text is not finished
(especially in anything related to morphic),
so i would not recommend it as a good source of examples.
But indeed some of them are actually using same pattern of rendering
stuff into separate buffer, and after done, blitting on screen.


> Regards,
>
> Jesus
>
> 2013/1/10 Ben Coman <[hidden email]>
>>
>> the text to a bitmap buffer then painting that onto a canvas.  How might
>> that be achieved?  And from Workspace can I test this?  I have been
>> searching for a couple of hours already so thought I'd just ask.
>
>
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Ben Coman
In reply to this post by Igor Stasenko
Thanks Igor. That was exactly what I was looking for.

Igor Stasenko wrote:

> On 10 January 2013 14:42, Ben Coman <[hidden email]> wrote:
>  
>> I need to improve the performance of a lot of text that drawn on screen
>> while the screen is being dragged around and would like to experiment with
>> rendering the text to a bitmap buffer then painting that onto a canvas.  How
>> might that be achieved?  And from Workspace can I test this?  I have been
>> searching for a couple of hours already so thought I'd just ask.
>>
>>    
>
> easy.
>
> form := Form extent: 100@100 depth: 32.
>
> canvas := form getCanvas.
> canvas drawString... whatever.
>
> and then:
>
> displayCanvas drawImage: form.
>
>
>
>  
>> cheers -ben
>>
>>    
>
>
>
>  


Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Jesus Nuñez
@Igor Thanks for the aclaration, I am quite new to pharo and I just wanted to help with what I've seen

Cheers


2013/1/11 Ben Coman <[hidden email]>
Thanks Igor. That was exactly what I was looking for.


Igor Stasenko wrote:
On 10 January 2013 14:42, Ben Coman <[hidden email]> wrote:
 
I need to improve the performance of a lot of text that drawn on screen
while the screen is being dragged around and would like to experiment with
rendering the text to a bitmap buffer then painting that onto a canvas.  How
might that be achieved?  And from Workspace can I test this?  I have been
searching for a couple of hours already so thought I'd just ask.

   

easy.

form := Form extent: 100@100 depth: 32.

canvas := form getCanvas.
canvas drawString... whatever.

and then:

displayCanvas drawImage: form.



 
cheers -ben

   



 



Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Igor Stasenko
On 12 January 2013 03:16, Jesus Nuñez <[hidden email]> wrote:
> @Igor Thanks for the aclaration, I am quite new to pharo and I just wanted
> to help with what I've seen
>
No problem.
I need to finish that thing..
the dilemma there is that supporting old fashing text rendering is not
going to show good results.
Writing a new text support + layout is another piece of work, we're
just started.. but it if far from
finishing.

But do not confuse: you can render strings with any truetype font
using Athens, but what you cannot
do is to use it for rendering TextMorph(s) contents.
Because TextMorph is heavily hardcoded for using balloon canvas.. with
lots of optimizations
and complexity.

> Cheers
>
>
> 2013/1/11 Ben Coman <[hidden email]>
>>
>> Thanks Igor. That was exactly what I was looking for.
>>
>>
>> Igor Stasenko wrote:
>>>
>>> On 10 January 2013 14:42, Ben Coman <[hidden email]> wrote:
>>>
>>>>
>>>> I need to improve the performance of a lot of text that drawn on screen
>>>> while the screen is being dragged around and would like to experiment
>>>> with
>>>> rendering the text to a bitmap buffer then painting that onto a canvas.
>>>> How
>>>> might that be achieved?  And from Workspace can I test this?  I have
>>>> been
>>>> searching for a couple of hours already so thought I'd just ask.
>>>>
>>>>
>>>
>>>
>>> easy.
>>>
>>> form := Form extent: 100@100 depth: 32.
>>>
>>> canvas := form getCanvas.
>>> canvas drawString... whatever.
>>>
>>> and then:
>>>
>>> displayCanvas drawImage: form.
>>>
>>>
>>>
>>>
>>>>
>>>> cheers -ben
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

Jesus Nuñez
@Igor, I think my post was deleted because was in the wrong place, but  "NBCallout initialize" did the trick with my last issue thank you so much again for caring,

Cheers


2013/1/12 Igor Stasenko <[hidden email]>
On 12 January 2013 03:16, Jesus Nuñez <[hidden email]> wrote:
> @Igor Thanks for the aclaration, I am quite new to pharo and I just wanted
> to help with what I've seen
>
No problem.
I need to finish that thing..
the dilemma there is that supporting old fashing text rendering is not
going to show good results.
Writing a new text support + layout is another piece of work, we're
just started.. but it if far from
finishing.

But do not confuse: you can render strings with any truetype font
using Athens, but what you cannot
do is to use it for rendering TextMorph(s) contents.
Because TextMorph is heavily hardcoded for using balloon canvas.. with
lots of optimizations
and complexity.

> Cheers
>
>
> 2013/1/11 Ben Coman <[hidden email]>
>>
>> Thanks Igor. That was exactly what I was looking for.
>>
>>
>> Igor Stasenko wrote:
>>>
>>> On 10 January 2013 14:42, Ben Coman <[hidden email]> wrote:
>>>
>>>>
>>>> I need to improve the performance of a lot of text that drawn on screen
>>>> while the screen is being dragged around and would like to experiment
>>>> with
>>>> rendering the text to a bitmap buffer then painting that onto a canvas.
>>>> How
>>>> might that be achieved?  And from Workspace can I test this?  I have
>>>> been
>>>> searching for a couple of hours already so thought I'd just ask.
>>>>
>>>>
>>>
>>>
>>> easy.
>>>
>>> form := Form extent: 100@100 depth: 32.
>>>
>>> canvas := form getCanvas.
>>> canvas drawString... whatever.
>>>
>>> and then:
>>>
>>> displayCanvas drawImage: form.
>>>
>>>
>>>
>>>
>>>>
>>>> cheers -ben
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>



--
Best regards,
Igor Stasenko.


Reply | Threaded
Open this post in threaded view
|

Re: Rendering text to bitmap buffer then paintImage to a canvas

artjureallove
Banned User
This post was updated on .
In reply to this post by Igor Stasenko
CONTENTS DELETED
The author has deleted this message.