Rendering text to bitmap buffer then paintImage to a canvas
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
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 <btc@openinworld.com>
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.
On 10 January 2013 20:15, Jesus Nuñez <poissonbreaker@gmail.com> 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 <btc@openinworld.com>
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.
On 10 January 2013 14:42, Ben Coman <btc@openinworld.com> 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.
Thanks Igor. That was exactly what I was looking for. Igor Stasenko wrote:
On 10 January 2013 14:42, Ben Coman <btc@openinworld.com> 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
@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 <btc@openinworld.com>
Thanks Igor. That was exactly what I was looking for.
Igor Stasenko wrote:
On 10 January 2013 14:42, Ben Coman <btc@openinworld.com> 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
On 12 January 2013 03:16, Jesus Nuñez <poissonbreaker@gmail.com> 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 <btc@openinworld.com>
Thanks Igor. That was exactly what I was looking for.
Igor Stasenko wrote:
On 10 January 2013 14:42, Ben Coman <btc@openinworld.com> 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.
@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 <siguctua@gmail.com>
On 12 January 2013 03:16, Jesus Nuñez <poissonbreaker@gmail.com> 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 <btc@openinworld.com>
Thanks Igor. That was exactly what I was looking for.
Igor Stasenko wrote:
On 10 January 2013 14:42, Ben Coman <btc@openinworld.com> 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.
participants (3)
-
Ben Coman -
Igor Stasenko -
Jesus Nuñez