Raw drawing without PtRAW ?

Hello,


How do I do raw drawing without using PtRAW ?
For example:
I have created many windows using PtCreateWidget(PtWindow,…), and now I
want to draw a image with PgDrawImage or PgDrawImagemx when a window
receive a Ph_EV_EXPOSE event.
How do I say to photon: use must draw into THIS window, before call any
PgXXX function ?

Regards,
Henri

On Tue, 20 Feb 2001 13:19:06 +0100, “Henri Michelon”
<michelon@iiriam.fr> wrote:


Look into the regions documentation… Basically everything
in photon is a some level a region… You can use this to create
applications/user interfaces without any widgets.

Hello,


How do I do raw drawing without using PtRAW ?
For example:
I have created many windows using PtCreateWidget(PtWindow,…), and now I
want to draw a image with PgDrawImage or PgDrawImagemx when a window
receive a Ph_EV_EXPOSE event.
How do I say to photon: use must draw into THIS window, before call any
PgXXX function ?

Regards,
Henri

I have tried this:

PgSetRegion(PgWidgetRid(mywindow.photonhandle));
PgSetStrokeColor(Pg_RED);
PgDrawILine(0, 0, mywindow.width, mywindow.height);
PgFlush();

But I nothing appears in the window internal area.

“William M. Derby Jr.” <derbyw@derbtronics.com> a écrit dans le message
news: 3a927bcb.1316333@inn.qnx.com

On Tue, 20 Feb 2001 13:19:06 +0100, “Henri Michelon”
michelon@iiriam.fr> > wrote:


Look into the regions documentation… Basically everything
in photon is a some level a region… You can use this to create
applications/user interfaces without any widgets.

On Tue, 20 Feb 2001 15:45:18 +0100, “Henri Michelon”
<michelon@iiriam.fr> wrote:

I have tried this:

PgSetRegion(PgWidgetRid(mywindow.photonhandle));
PgSetStrokeColor(Pg_RED);
PgDrawILine(0, 0, mywindow.width, mywindow.height);
PgFlush();

But I nothing appears in the window internal area.

Your update is probably being clobbered by the refresh of the
window itself - which happens after the code above executes…
There is an example in the documentation for using raw regions
to put stuff up on the screen…

In your case since it appears that you want the rest of the window and
probably want the drag, resize and other functions of the window
manager, I would suggest that each window contain 1 raw widget that
covers the window. Do your drawing in the expose event for that raw
widget and use the region ID of the RAW widget for PgSetRegion. This
works well and has minimal overhead…

Based on the title of the question I assume you have some reason for
not wanting a Raw widget in the window. (a la the above example)
Why is that?

Another way to go about this is to create a new region which is the
child of the window and then do the drawing in that. (child regions
will be in front of the parent) – of course, thats all a raw widget
is anyway…

-Bill



“William M. Derby Jr.” <> derbyw@derbtronics.com> > a écrit dans le message
news: > 3a927bcb.1316333@inn.qnx.com> …
On Tue, 20 Feb 2001 13:19:06 +0100, “Henri Michelon”
michelon@iiriam.fr> > wrote:


Look into the regions documentation… Basically everything
in photon is a some level a region… You can use this to create
applications/user interfaces without any widgets.

“William M. Derby Jr.” <derbyw@derbtronics.com> a écrit dans le message
news: 3a929285.685461@inn.qnx.com

Your update is probably being clobbered by the refresh of the
window itself - which happens after the code above executes…

Maybe this is the problem.
I have tried with the Ph_NORMAL_EXPOSE kind of Ph_EV_EXPOSE events, maybe
the others kinds of expose events works differently.I must give them a try.

Based on the title of the question I assume you have some reason for
not wanting a Raw widget in the window. (a la the above example)
Why is that?

Only for following my coding guidelines: since I do all the window event
handling (including refreshing the content) in one, global, “window
callback” function for all operating systems and window managers, I just try
to follow this rule for Photon.

Another way to go about this is to create a new region which is the
child of the window and then do the drawing in that. (child regions
will be in front of the parent) – of course, thats all a raw widget
is anyway…

-Bill

If I can’t find a solution for the EXPOSE events, I will give a change to
PtRaw.
Thanks for your feedback.

Henri Michelon Henri.Michelon@iiriam.fr

http://nmo-sdk.sourceforge.net/ The Universal SDK.

“Henri Michelon” <michelon@iiriam.fr> a écrit dans le message news:
96u7b0$s0j$1@inn.qnx.com

“William M. Derby Jr.” <> derbyw@derbtronics.com> > a écrit dans le message
news: > 3a929285.685461@inn.qnx.com> …
Your update is probably being clobbered by the refresh of the
window itself - which happens after the code above executes…

Maybe this is the problem.
I have tried with the Ph_NORMAL_EXPOSE kind of Ph_EV_EXPOSE events, maybe
the others kinds of expose events works differently.I must give them a
try.

I fact this works great, but I also have to implement the DRAW event, since
the EXPOSE event ins’t emitted after the window is realized or resized,
unlike, for example, the X11 expose event.

On Tue, 20 Feb 2001 18:37:54 +0100, “Henri Michelon”
<michelon@iiriam.fr> wrote:

“Henri Michelon” <> michelon@iiriam.fr> > a écrit dans le message news:
96u7b0$s0j$> 1@inn.qnx.com> …

“William M. Derby Jr.” <> derbyw@derbtronics.com> > a écrit dans le message
news: > 3a929285.685461@inn.qnx.com> …
Your update is probably being clobbered by the refresh of the
window itself - which happens after the code above executes…

Maybe this is the problem.
I have tried with the Ph_NORMAL_EXPOSE kind of Ph_EV_EXPOSE events, maybe
the others kinds of expose events works differently.I must give them a
try.


I fact this works great, but I also have to implement the DRAW event, since
the EXPOSE event ins’t emitted after the window is realized or resized,
unlike, for example, the X11 expose event.

There are seperate events for these items as well, BTW you need to be
careful of clipping on these events - sometimes your drawings can
disappear behind a list of clip rectangles but this is more likely
when you are doing pure raw regions…

Also, look at the P?DamageWidget/Regions call to force redisplay
i.e. EXPOSE.

-Bill

Henri Michelon <michelon@iiriam.fr> wrote:
: “William M. Derby Jr.” <derbyw@derbtronics.com> a ecrit dans le message
: news: 3a929285.685461@inn.qnx.com
:> Based on the title of the question I assume you have some reason for
:> not wanting a Raw widget in the window. (a la the above example)
:> Why is that?

: Only for following my coding guidelines: since I do all the window event
: handling (including refreshing the content) in one, global, “window
: callback” function for all operating systems and window managers, I just try
: to follow this rule for Photon.

I recommend using a PtRaw – it’s easy to use (just follow the instructions
in the Programmer’s Guide), and it handles all the damage and expose stuff
for you.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems