about overlap function on PtRaw

Hi developers…

Please help me!!
I have a question.

I am using graphic function and raw-draw in Photon.
I create only one window.
In this window, I draw a lot of lines and polygons on PtRaw.

Now, I’d like to perform kind of “Layer Effect Function”.
In other words, in one window, I want to make lower and higher screen
so that I want to change lower screen image by PgDraw*
but don’t want to change the fixed-image on higher screen.
It looks like overlap effect.

for example,
(1)draw one line horizontally on center at lower screen.
(2)draw one line vertically on center at higher screen.

Result:
It will show “+”

Is it possble?
Would you please give me some advice?

Thanx in advance…

KJ

ppojung@yahoo.co.kr

Hi,

Sorry it took so long for someone to get back to you.

I have spoken to one of the developers and he has a few ideas.

My first thought is to use two offscreen contexts
(PdCreateOffscreenContext), one for the lower
layer and one for the higher layer, and use PgContextBlits to copy the
layers to the screen with a chroma key.

Alternativly if the layers only use one color for the drawing (ie: top
layer only draws in blue while lower layer only draws in red) then you
could enable chroma so that it only draws when the destination pixel
isn’t the upper layers color while renderering the lower layer (top layer
gets rendered first).

The first method is the easiest and is more flexible (doesn’t matter what
colors you use in the different layers so long as you don’t use the
chroma color) and it can also mean a speed increase when responding to
expose events (your draw function is called when the widget isn’t
damaged like when the user drags a window over top of yours), as you
won’t have to re-render the polygons and lines, just blit from offscreen
since they’ve already been rendered. The tradeoff is increased use of
video ram, and if there isn’t enough video ram to create the offscreen
buffers, then the buffer will be created in system ram (removing any chance
of hardware acceleration).

If you can’t reserve a color for chroma keying for whatever reason the
other alternative is to create memory contexts (PmMemCreateMC()) for each
layer and use them like you would the offscreen contexts, but since
memory contexts use PhImage_t’s you can create a transparency mask based
on the rendering you are doing (which could prove tricky since you’d have
to figure out what changed after using the PgDraw* funcs and update
your transparency mask accordingly), and use PgDrawPhImagemx to draw
the layers. I wouldn’t recommend this one personally but it may be the
only option…depending on the requirements. You could also use an Alpha
map to acheive the same results but you’re still faced with the problem
of creating the map to match the changes made to the PhImage_t.

Hope this helps
Regards
Brenda


ppojung <ppojung@yahoo.co.kr> wrote:

Hi developers…

Please help me!!
I have a question.

I am using graphic function and raw-draw in Photon.
I create only one window.
In this window, I draw a lot of lines and polygons on PtRaw.

Now, I’d like to perform kind of “Layer Effect Function”.
In other words, in one window, I want to make lower and higher screen
so that I want to change lower screen image by PgDraw*
but don’t want to change the fixed-image on higher screen.
It looks like overlap effect.

for example,
(1)draw one line horizontally on center at lower screen.
(2)draw one line vertically on center at higher screen.

Result:
It will show “+”

Is it possble?
Would you please give me some advice?

Thanx in advance…

KJ

ppojung@yahoo.co.kr