[PD] drawing off screen with plain pd?

Krzysztof Czaja czaja at chopin.edu.pl
Thu Feb 13 12:28:13 CET 2003


hi Orm,

your first method is quite easy to code within an external.

The code is quoted below, in case you would just preferred to add
it to some stuff of yours.  In case not, I have uploaded a simple,
little 'tot' (hope German-speakers will not mind) external to

http://suita.chopin.edu.pl/~czaja/miXed/externs/toys.html

First create [tot <window-name>].  An argument, if given (without
a 'pd-' prefix), refers to a patch/subpatch window, and if
omitted, then it defaults to the patch window containing the 'tot'
object.

Click on 'tot' to hide window contents, click again to bring it
back.  Or send it 'cover'/'uncover' messages.

Any new item drawn in a covered window is being hidden under the
cover as well.

There is another feature that could be handy -- 'tot' accepts
any valid tk widget command invoked on the main window's canvas,
which means you may draw, paint, write text, animate...

See the included tot-test.pd.

Now, for the code -- it takes just a few lines to cover things:

   sys_vgui("canvas .x%x.c.cover -width %d -height %d -bg white -bd 0\n",
     cv, cv->gl_screenx2 - cv->gl_screenx1,
     cv->gl_screeny2 - cv->gl_screeny1);
   sys_vgui("pack .x%x.c.cover\n", cv);

and one line to uncover:

   sys_vgui("destroy .x%x.c.cover\n", cv);

where 'cv' might be the 'current-canvas' or any other canvas
'found-by-class'.

Krzysztof

Orm Finnendahl wrote:
...
 > - put an opaque canvas (maybe in a subpatcher) on top of it until all
 >   objects are redrawn and then clear the canvas.
...
 > The opaque canvas method doesn't seem to work as new objects even in a
 > canvas below the opaque canvas will get redrawn on top of it.





More information about the Pd-list mailing list