PtRaw questions

I am trying to do a Sketchpad type app with a PtRaw widget as the
canvas…now my problem exists in that you cant draw on the canvas
until the widget his been redraw (another window placed on top and
then removed) and then only to the area affected…and then of course
it doesnt redraw if any damage is done to the widget

(i think this may be a case of me not using PtRaw properly, so feel
free to inform me of its proper use)

just to give a little background info…

i do the drawing with PgDrawPixel() inside the PtRaw RawCB when the
mouse button is held down…

thanx in advance…
-troy

Troy Tuttle <jokker@kingston.net> wrote:

I am trying to do a Sketchpad type app with a PtRaw widget as the
canvas…now my problem exists in that you cant draw on the canvas
until the widget his been redraw (another window placed on top and
then removed) and then only to the area affected…and then of course
it doesnt redraw if any damage is done to the widget

(i think this may be a case of me not using PtRaw properly, so feel
free to inform me of its proper use)

just to give a little background info…

i do the drawing with PgDrawPixel() inside the PtRaw RawCB when the
mouse button is held down…

Tipically you use a ptraw widget to store some kind of image and than
draw it’s contains with the draw function.

A sketchpad can be done in this way:
You allocate some buffer to contain the image (a PtLabel could help
in this case). In the draw function you simply transfer the buffer
to the screen (If you use a PtLabel that contain an image this is done
automatically).

To handle the mouse (to be able to sketch) you can use PtAddEventHandler()
and add an handler for mouse pressure and movement that draws both
in the buffer and in the screen.

thanx in advance…
-troy

A sketchpad can be done in various ways. This is only an outline.


Wave++

On 12 Oct 2001 04:14:52 GMT, “Wave++” <wavexx@apexmail.com> wrote:

Troy Tuttle <> jokker@kingston.net> > wrote:
I am trying to do a Sketchpad type app with a PtRaw widget as the
canvas…now my problem exists in that you cant draw on the canvas
until the widget his been redraw (another window placed on top and
then removed) and then only to the area affected…and then of course
it doesnt redraw if any damage is done to the widget

(i think this may be a case of me not using PtRaw properly, so feel
free to inform me of its proper use)

just to give a little background info…

i do the drawing with PgDrawPixel() inside the PtRaw RawCB when the
mouse button is held down…

Tipically you use a ptraw widget to store some kind of image and than
draw it’s contains with the draw function.

forgive me for being a newbie but:

how would you store the contents of a Ptraw widget in an image?

A sketchpad can be done in this way:
You allocate some buffer to contain the image (a PtLabel could help
in this case). In the draw function you simply transfer the buffer
to the screen (If you use a PtLabel that contain an image this is done
automatically).

To handle the mouse (to be able to sketch) you can use PtAddEventHandler()
and add an handler for mouse pressure and movement that draws both
in the buffer and in the screen.



thanx in advance…
-troy

A sketchpad can be done in various ways. This is only an outline.


Wave++

Troy Tuttle <jokker@kingston.net> wrote:

On 12 Oct 2001 04:14:52 GMT, “Wave++” <> wavexx@apexmail.com> > wrote:

Troy Tuttle <> jokker@kingston.net> > wrote:
forgive me for being a newbie but:

sorry

how would you store the contents of a Ptraw widget in an image?

I don’t understand this question. You must think a PtRaw as a
sensitive area that give you events, not as an image.
You can’t store an image (you could use the internal data pointer
but it’s another question) in a PtRaw. It’s up to you to draw
WHERE PtRaw indicates you.

In the SketchPad case you could easily use a PtLabel to store and
display your image data. Under mouse pressure you draw into the
PtLabel buffer and then you damage the widget to redraw its
contains.

If instead you use a PtRaw there’s no image buffers. PtRaw is
intended to receive expose and resize events. You could use it
as an image by allocating an indipendent buffer and then draw
manually the buffer into the widget WHEN PtRaw receives an expose
event.

If you draw on the surface only of a PtRaw widget, the surface
will be damaged on an expose event. So you always must keep
track of the image in some kind of buffers.

If you’re looking to transfer the surface of the PtRaw widget
on a buffer before it becomes damaged look at the
“Getting gabby under photon” article on qdn.qnx.com

A sketchpad can be done in this way:
You allocate some buffer to contain the image (a PtLabel could help
in this case). In the draw function you simply transfer the buffer
to the screen (If you use a PtLabel that contain an image this is done
automatically).

To handle the mouse (to be able to sketch) you can use PtAddEventHandler()
and add an handler for mouse pressure and movement that draws both
in the buffer and in the screen.



thanx in advance…
-troy

A sketchpad can be done in various ways. This is only an outline.


Wave++


Wave++