Trying to present 2 images at once

Here’s my problem:

I want to display two gray scale images in two different widgets
side-by-side. I read images A and B from their files and, following
minor processing (e.g. contrast enhancement), store them in separate
shared memory buffers. From that point on, each image receives
similar handling with separate accounting for widget pointers, use of
the same 8-bit gray scale palette, etc. The basic sequence is:

  1. PtCreateWidget
  2. PtRealize Widget
  3. PgSetRegion
  4. PgDrawImagemx
  5. PgFlush

For image A:
at step 2. the A window appears with transparent interior (OK)
at step 5. a nice gray-scale image A appears (excellent)

For image B:
at step 1. window A interior goes all medium gray (bad)
at step 2. window B appears w/transparent interior (also OK)
at step 5. image B appears but using some other, colorful
palette despite having the same palette pointer
passed into the relevant functions (not OK)

There seems to be a loss of context or widget confusion in the
processing for image B. Any pointers into documentation or direct
help would be welcome.

Bob Bottemiller
Stein.DSI/Redmond, WA USA

Drawing directly into a PtWindow is not advisable. Rather, you should be
using PtLabels, in which case you could set their Pt_ARG_LABEL_IMAGE
resources and wouldn’t have to do any drawing yourself. If this isn’t
enough, you could use PtRaws and do whatever drawing (including rendering
the images) there.

But it sounds to me like your immediate problem might be related to not
setting up colors correctly. You should use PgSetTextColor(palette[1]) and
PgSetFillColor(palette[0]) prior to drawing the image, or simply use
PgDrawPhImagemx() which does all this work for you.

Not restoring the values is likely what’s causing the corruption you’re
seeing in the other widgets, which is why, once again, I will advise against
the mixing of widgets and “direct drawing”.


“Bob Bottemiller” <bob.bottemiller@deletefmcti.com> wrote in message
news:3c69b1a4.257261@inn.qnx.com

Here’s my problem:

I want to display two gray scale images in two different widgets
side-by-side. I read images A and B from their files and, following
minor processing (e.g. contrast enhancement), store them in separate
shared memory buffers. From that point on, each image receives
similar handling with separate accounting for widget pointers, use of
the same 8-bit gray scale palette, etc. The basic sequence is:

  1. PtCreateWidget
  2. PtRealize Widget
  3. PgSetRegion
  4. PgDrawImagemx
  5. PgFlush

For image A:
at step 2. the A window appears with transparent interior (OK)
at step 5. a nice gray-scale image A appears (excellent)

For image B:
at step 1. window A interior goes all medium gray (bad)
at step 2. window B appears w/transparent interior (also OK)
at step 5. image B appears but using some other, colorful
palette despite having the same palette pointer
passed into the relevant functions (not OK)

There seems to be a loss of context or widget confusion in the
processing for image B. Any pointers into documentation or direct
help would be welcome.

Bob Bottemiller
Stein.DSI/Redmond, WA USA

Thanks David. I will have a chance to apply your advice early next
week. I look forward to good results.

On Wed, 13 Feb 2002 11:12:07 -0500, “David LeBlanc” <dleblanc@qnx.com>
wrote:

Drawing directly into a PtWindow is not advisable. Rather, you should be
using PtLabels, in which case you could set their Pt_ARG_LABEL_IMAGE
resources and wouldn’t have to do any drawing yourself. If this isn’t
enough, you could use PtRaws and do whatever drawing (including rendering
the images) there.

But it sounds to me like your immediate problem might be related to not
setting up colors correctly. You should use PgSetTextColor(palette[1]) and
PgSetFillColor(palette[0]) prior to drawing the image, or simply use
PgDrawPhImagemx() which does all this work for you.

Not restoring the values is likely what’s causing the corruption you’re
seeing in the other widgets, which is why, once again, I will advise against
the mixing of widgets and “direct drawing”.


“Bob Bottemiller” <> bob.bottemiller@deletefmcti.com> > wrote in message
news:> 3c69b1a4.257261@inn.qnx.com> …
Here’s my problem:

…[delete text]

Bob Bottemiller
Stein.DSI/Redmond, WA USA

Bear in mind that if you use two Raw widgets, you’ll should provide a raw
callback function for each. This function is in the Resource tab, at the
bottom
of the list, not in the Callback tab.

-bill

“David LeBlanc” <dleblanc@qnx.com> wrote in message
news:a4e30r$7dc$1@nntp.qnx.com

Drawing directly into a PtWindow is not advisable. Rather, you should
be
using PtLabels, in which case you could set their Pt_ARG_LABEL_IMAGE
resources and wouldn’t have to do any drawing yourself. If this isn’t
enough, you could use PtRaws and do whatever drawing (including rendering
the images) there.

But it sounds to me like your immediate problem might be related to not
setting up colors correctly. You should use PgSetTextColor(palette[1])
and
PgSetFillColor(palette[0]) prior to drawing the image, or simply use
PgDrawPhImagemx() which does all this work for you.

Not restoring the values is likely what’s causing the corruption you’re
seeing in the other widgets, which is why, once again, I will advise
against
the mixing of widgets and “direct drawing”.


“Bob Bottemiller” <> bob.bottemiller@deletefmcti.com> > wrote in message
news:> 3c69b1a4.257261@inn.qnx.com> …
Here’s my problem:

I want to display two gray scale images in two different widgets
side-by-side. I read images A and B from their files and, following
minor processing (e.g. contrast enhancement), store them in separate
shared memory buffers. From that point on, each image receives
similar handling with separate accounting for widget pointers, use of
the same 8-bit gray scale palette, etc. The basic sequence is:

  1. PtCreateWidget
  2. PtRealize Widget
  3. PgSetRegion
  4. PgDrawImagemx
  5. PgFlush

For image A:
at step 2. the A window appears with transparent interior (OK)
at step 5. a nice gray-scale image A appears (excellent)

For image B:
at step 1. window A interior goes all medium gray (bad)
at step 2. window B appears w/transparent interior (also OK)
at step 5. image B appears but using some other, colorful
palette despite having the same palette pointer
passed into the relevant functions (not OK)

There seems to be a loss of context or widget confusion in the
processing for image B. Any pointers into documentation or direct
help would be welcome.

Bob Bottemiller
Stein.DSI/Redmond, WA USA

William Bull <bbull@qnx.com> wrote:
: Bear in mind that if you use two Raw widgets, you’ll should provide a raw
: callback function for each. This function is in the Resource tab, at the
: bottom
: of the list, not in the Callback tab.

That should be the Draw function. Don’t confuse it with Pt_CB_RAW.


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