Tips

Question is about Photon 1.14 but I guess it’s also valid for Photon 2.

I need to display overlapping text. The text will come in from serial port
(with X,Y coordinates), the text is to be display on top of what is already
there. That tells me widgets can’t be used because it would consume all ram
after a while :wink: For example the letter A could be display at every pixels
which would endup turning the screen all black.

I though about using a PtRaw and PgText but that’s no good because to redraw
the widget would mean keeping a track of all the text in order to rebuild
the view.

What I plan on doing is create a memory context with an image and have the
PgText function draw in the image, which will then be render. That does
seems like overkill to me since for every character received the whole image
would need to be refresh everytime (image could be 640x480). I don’t
beleive that’s an issue because if I setup the image in share memory is
going to be very fast.

I wonder if anyone had a better idea.

  • Mario

Mario Charest wrote:

Question is about Photon 1.14 but I guess it’s also valid for Photon 2.

I need to display overlapping text. The text will come in from serial port
(with X,Y coordinates), the text is to be display on top of what is already
there. That tells me widgets can’t be used because it would consume all ram
after a while > :wink: > For example the letter A could be display at every pixels
which would endup turning the screen all black.

I though about using a PtRaw and PgText but that’s no good because to redraw
the widget would mean keeping a track of all the text in order to rebuild
the view.

What I plan on doing is create a memory context with an image and have the
PgText function draw in the image, which will then be render. That does
seems like overkill to me since for every character received the whole image
would need to be refresh everytime (image could be 640x480). I don’t
beleive that’s an issue because if I setup the image in share memory is
going to be very fast.

Sending it to the graphics driver will be very fast; still, it would be
good to tell the driver that only a little part of the image needs to be
copied to the screen. The easiest way to do that is by setting a
clipping. The easiest way to set the clipping is by using
PtDamageExtent() to damage the affected area of a widget rather than the
whole widget.

Use a PtRaw widget. In the widget’s draw function, just draw the whole
image of the memory context, without paying attention to what the damage
list is or trying to figure out why the draw function has been called.

When you receive data from the serial port, calculate the position and
size of your string, draw the string into the memory context, and damage
the extent of the string.

(In Photon 2, you might want to use an offscreen context rather than a
memory context.)

“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:ctds7a$auv$2@inn.qnx.com

Mario Charest wrote:
Question is about Photon 1.14 but I guess it’s also valid for Photon 2.

I need to display overlapping text. The text will come in from serial
port (with X,Y coordinates), the text is to be display on top of what is
already there. That tells me widgets can’t be used because it would
consume all ram after a while > :wink: > For example the letter A could be
display at every pixels which would endup turning the screen all black.

I though about using a PtRaw and PgText but that’s no good because to
redraw the widget would mean keeping a track of all the text in order to
rebuild the view.

What I plan on doing is create a memory context with an image and have
the PgText function draw in the image, which will then be render. That
does seems like overkill to me since for every character received the
whole image would need to be refresh everytime (image could be 640x480).
I don’t beleive that’s an issue because if I setup the image in share
memory is going to be very fast.

Sending it to the graphics driver will be very fast; still, it would be
good to tell the driver that only a little part of the image needs to be
copied to the screen. The easiest way to do that is by setting a
clipping. The easiest way to set the clipping is by using
PtDamageExtent() to damage the affected area of a widget rather than the
whole widget.

Use a PtRaw widget. In the widget’s draw function, just draw the whole
image of the memory context, without paying attention to what the damage
list is or trying to figure out why the draw function has been called.

When you receive data from the serial port, calculate the position and
size of your string, draw the string into the memory context, and damage
the extent of the string.

I see. Thanks Wojtek (you can’t notice it but I’ve type Wojtek with a
Polish r accent)

(In Photon 2, you might want to use an offscreen context rather than a
memory context.)

Mario Charest wrote:

I see. Thanks Wojtek (you can’t notice it but I’ve type Wojtek with a
Polish r accent)

That’s curious. A Polish r accent? I’ve never heard of it! What does
it look like? Which letter would have it? The normal Polish spelling
of “Wojtek” doesn’t have any accents…

“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:cte10m$auv$3@inn.qnx.com

Mario Charest wrote:
I see. Thanks Wojtek (you can’t notice it but I’ve type Wojtek with a
Polish r accent)

That’s curious. A Polish r accent? I’ve never heard of it! What does it
look like? Which letter would have it? The normal Polish spelling of
“Wojtek” doesn’t have any accents…

Accent has in the way it sounds :wink:

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:cteeoo$skm$1@inn.qnx.com

“Wojtek Lerch” <> Wojtek_L@yahoo.ca> > wrote in message
news:cte10m$auv$> 3@inn.qnx.com> …
Mario Charest wrote:
I see. Thanks Wojtek (you can’t notice it but I’ve type Wojtek with a
Polish r accent)

That’s curious. A Polish r accent? I’ve never heard of it! What does
it look like? Which letter would have it? The normal Polish spelling
of “Wojtek” doesn’t have any accents…

Accent has in the way it sounds > :wink:

Sorry, but I still don’t get it… You’ve typed Wojtek in a way that
doesn’t look, but does sound, like it had a “Polish r accent”???

Can you send me an mp3 of it?

“Wojtek Lerch” <Wojtek_L@yahoo.ca> wrote in message
news:ctep30$640$1@inn.qnx.com

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:cteeoo$skm$> 1@inn.qnx.com> …
“Wojtek Lerch” <> Wojtek_L@yahoo.ca> > wrote in message
news:cte10m$auv$> 3@inn.qnx.com> …
Mario Charest wrote:
I see. Thanks Wojtek (you can’t notice it but I’ve type Wojtek with a
Polish r accent)

That’s curious. A Polish r accent? I’ve never heard of it! What does
it look like? Which letter would have it? The normal Polish spelling
of “Wojtek” doesn’t have any accents…

Accent has in the way it sounds > :wink:

Sorry, but I still don’t get it… You’ve typed Wojtek in a way that
doesn’t look, but does sound, like it had a “Polish r accent”???

Grrr, just reread my post the r in “Polish raccent” is a typo, shouldn’t be
there.

I was just trying to be extra polite (given the fast response) by
acknowledging the root of your name through a attempt at clever humor.

Can you send me an mp3 of it?

“Mario Charest” postmaster@127.0.0.1 wrote in message
news:cthi71$6f0$1@inn.qnx.com

Grrr, just reread my post the r in “Polish raccent” is a typo, shouldn’t
be there.

Ah, a typo!!! You should have mentioned it – it made me stuck on the silly
theory that you thought my name is spelled with a tiny little “r” sitting on
top of one of the letters. It’s all your fault that I’ve made a fool of
myself! Don’t you ever try to be polite to me again! :wink:

I was just trying to be extra polite (given the fast response) by
acknowledging the root of your name through a attempt at clever humor.

Yeah, I get it now. Sorry for drilling you like that. It’s a dangerous
mix – clever humour and typos…

(Still, you’ve made me curious about what your Polish accent sounds like…
Can you send me an mp3? :wink: