From 4e1705f6ffcb44f6ce01417068d441ee9a795a03 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 17 Oct 2003 20:58:57 +0000 Subject: Version 0.12.9 ( added pdp_shape ) svn path=/trunk/externals/pidip/; revision=1101 --- CHANGES.LOG | 4 + Makefile | 5 +- acinclude.m4 | 2 +- aclocal.m4 | 2 +- config.log | 8 +- config.status | 4 +- configure | 2 +- configure.ac | 2 +- doc/help-pdp_ctrack.pd | 4 +- doc/help-pdp_cycle.pd | 14 +- doc/help-pdp_pen.pd | 66 ++++-- modules/Makefile | 2 +- modules/Makefile.in | 2 +- modules/pdp_canvas.c | 2 +- modules/pdp_pen.c | 165 ++++++++++++++ modules/pdp_ripple.c | 2 +- modules/pdp_shape.c | 582 +++++++++++++++++++++++++++++++++++++++++++++++++ system/pidip.c | 2 + 18 files changed, 821 insertions(+), 49 deletions(-) create mode 100644 modules/pdp_shape.c diff --git a/CHANGES.LOG b/CHANGES.LOG index e0c4c60..b940d44 100644 --- a/CHANGES.LOG +++ b/CHANGES.LOG @@ -1,3 +1,7 @@ +0.12.9 + added pdp_shape : a shape recognition object (based on color, similar to color tracker ) + added "fill" in pdp_pen + ( on request from ben ) 0.12.8 added pdp_pen : a free hand drawing object ( on request from patrick/11h11.com ) diff --git a/Makefile b/Makefile index e1d4f14..e887c74 100644 --- a/Makefile +++ b/Makefile @@ -8,8 +8,8 @@ IMLIB_LIBS = -L/usr/local/lib -lImlib2 -lttf -lm -ldl -lXext -lXext -lX11 -L/usr AALIB_CFLAGS = -I/usr/local/include AALIB_LIBS = -L/usr/local/lib -Wl,-rpath,/usr/local/lib -laa -lm -L/usr/X11R6/lib -lX11 -lgpm -lslang MAGICK_CFLAGS = -I/usr/X11R6/include -g -O2 -Wall -MAGICK_LIBS = -L/usr/X11R6/lib -lMagick -ltiff -lfreetype -ljasper -ljpeg -lpng -lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -L/usr/local/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/local/lib -PDP_PIDIP_VERSION = 0.12.4 +MAGICK_LIBS = -L/usr/X11R6/lib -lMagick -lMagick -ltiff -lfreetype -ljasper -ljpeg -lpng -lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -L/usr/local/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/local/lib +PDP_PIDIP_VERSION = 0.12.9 PDP_PIDIP_DISTRO = /mnt/c/ydegoyon.free.fr/pidip-$(PDP_PIDIP_VERSION) PDP_PIDIP_TARBALL = $(PDP_PIDIP_DISTRO).tar.gz @@ -41,6 +41,7 @@ clean: install: cp fonts/* /usr/X11R6/lib/X11/fonts/TTF + cp -f --remove-destination doc/* $(PD_DIR)/doc/5.reference distro: clean all rm */*.o diff --git a/acinclude.m4 b/acinclude.m4 index 6e1c420..a750fc5 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -24,7 +24,7 @@ dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK) dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount) dnl dnl @author Angus Lees -dnl @version $Id: acinclude.m4,v 1.1 2003-08-11 04:26:00 eighthave Exp $ +dnl @version $Id: acinclude.m4,v 1.2 2003-10-17 20:54:40 sevyves Exp $ AC_DEFUN(AC_PATH_GENERIC, [dnl diff --git a/aclocal.m4 b/aclocal.m4 index cdbfaeb..bca282a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -36,7 +36,7 @@ dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK) dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount) dnl dnl @author Angus Lees -dnl @version $Id: aclocal.m4,v 1.1 2003-08-11 04:26:00 eighthave Exp $ +dnl @version $Id: aclocal.m4,v 1.2 2003-10-17 20:54:40 sevyves Exp $ AC_DEFUN(AC_PATH_GENERIC, [dnl diff --git a/config.log b/config.log index ed3905a..11db3da 100644 --- a/config.log +++ b/config.log @@ -10,14 +10,14 @@ generated by GNU Autoconf 2.53. Invocation command line was ## Platform. ## ## --------- ## -hostname = dhcp-60-101 +hostname = dhcp-93-1541 uname -m = i686 uname -r = 2.5.7 uname -s = Linux -uname -v = #18 SMP Thu Jul 3 02:12:40 CEST 2003 +uname -v = #152 SMP Sat Oct 4 21:01:57 EDT 2003 /usr/bin/uname -p = unknown -/bin/uname -X = +/bin/uname -X = unknown /bin/arch = i686 /usr/bin/arch -k = unknown @@ -293,7 +293,7 @@ generated by GNU Autoconf 2.53. Invocation command line was CONFIG_COMMANDS = $ ./config.status -on dhcp-60-101 +on dhcp-93-1541 config.status:578: creating Makefile config.status:578: creating system/Makefile diff --git a/config.status b/config.status index 5a908c3..3f71b5c 100755 --- a/config.status +++ b/config.status @@ -445,8 +445,8 @@ s,@IMLIB2_LIBS@,-L/usr/local/lib -lImlib2 -lttf -lm -ldl -lXext -lXext -lX11 -L/ s,@AALIB_CONFIG@,/usr/local/bin/aalib-config,;t t s,@AALIB_LIBS@,-L/usr/local/lib -Wl,-rpath,/usr/local/lib -laa -lm -L/usr/X11R6/lib -lX11 -lgpm -lslang,;t t s,@AALIB_CFLAGS@,-I/usr/local/include,;t t -s,@PDP_PIDIP_VERSION@,0.12.4,;t t -s,@MAGICK_LIBS@,-L/usr/X11R6/lib -lMagick -ltiff -lfreetype -ljasper -ljpeg -lpng -lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -L/usr/local/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/local/lib,;t t +s,@PDP_PIDIP_VERSION@,0.12.9,;t t +s,@MAGICK_LIBS@,-L/usr/X11R6/lib -lMagick -lMagick -ltiff -lfreetype -ljasper -ljpeg -lpng -lXext -lSM -lICE -lX11 -lbz2 -lxml2 -lz -lpthread -lm -L/usr/local/lib -L/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/local/lib,;t t s,@MAGICK_CFLAGS@,-I/usr/X11R6/include -g -O2 -Wall ,;t t s,@PD_DIR@,/usr/local/pd,;t t s,@PDP_DIR@,/usr/local/pd/pdp,;t t diff --git a/configure b/configure index d4bdd84..4d33e5c 100755 --- a/configure +++ b/configure @@ -1154,7 +1154,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -PDP_PIDIP_VERSION=0.12.8 +PDP_PIDIP_VERSION=0.12.9 PD_DIR=/usr/local/pd PDP_DIR=/usr/local/pd/pdp FFMPEG_SOURCE_DIR=/SOURCES/ffmpeg diff --git a/configure.ac b/configure.ac index 056b99d..d0cfa3c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT -PDP_PIDIP_VERSION=0.12.8 +PDP_PIDIP_VERSION=0.12.9 PD_DIR=/usr/local/pd PDP_DIR=/usr/local/pd/pdp FFMPEG_SOURCE_DIR=/SOURCES/ffmpeg diff --git a/doc/help-pdp_ctrack.pd b/doc/help-pdp_ctrack.pd index c57a6d9..85687c4 100644 --- a/doc/help-pdp_ctrack.pd +++ b/doc/help-pdp_ctrack.pd @@ -3,7 +3,7 @@ #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 123 136 loop \$1; -#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 +#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1; #X msg 370 44 open \$1; #X obj 369 20 openpanel; @@ -68,7 +68,7 @@ #X msg 118 379 setcur \$1 \$2; #X text 6 378 Set the cursor; #X msg 12 527 cursor \$1; -#X obj 85 529 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +#X obj 85 529 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X floatatom 123 591 5 0 0 0 - - -; #X floatatom 173 592 5 0 0 0 - - -; diff --git a/doc/help-pdp_cycle.pd b/doc/help-pdp_cycle.pd index 384d9e5..e60ee90 100644 --- a/doc/help-pdp_cycle.pd +++ b/doc/help-pdp_cycle.pd @@ -3,13 +3,13 @@ #X obj 268 64 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; #X msg 123 136 loop \$1; -#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 1 +#X obj 124 114 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1; #X msg 370 44 open \$1; #X obj 369 20 openpanel; #X obj 354 3 bng 15 250 50 0 empty empty empty 20 8 0 8 -262144 -1 -1; -#X floatatom 316 99 5 0 0; +#X floatatom 316 99 5 0 0 0 - - -; #X msg 225 65 stop; #X obj 323 68 hsl 300 15 0 1000 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; @@ -22,21 +22,21 @@ #X msg 442 170 open /dev/video; #X obj 252 167 pdp_yqt; #X obj 283 243 dac~; -#X obj 351 264 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 351 264 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 363 286 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 363 286 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 374 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 374 305 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 377 263 Cycle Y; #X text 390 284 Cycle U; #X text 396 306 Cycle V; #X obj 264 334 pdp_cycle; -#X obj 469 381 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 +#X obj 469 381 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 469 433 pdp_control; #X msg 469 406 thread \$1; -#X floatatom 469 494 5 0 0; +#X floatatom 469 494 5 0 0 0 - - -; #X obj 469 465 route pdp_drop; #X connect 1 0 10 0; #X connect 2 0 16 0; diff --git a/doc/help-pdp_pen.pd b/doc/help-pdp_pen.pd index e0ccda0..34a98b5 100644 --- a/doc/help-pdp_pen.pd +++ b/doc/help-pdp_pen.pd @@ -20,18 +20,17 @@ -1; #X msg 432 102 stop; #X msg 517 133 open /dev/video; -#X obj 561 456 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +#X obj 567 476 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; -#X obj 561 508 pdp_control; -#X msg 561 481 thread \$1; -#X floatatom 561 569 5 0 0 0 - - -; -#X obj 561 540 route pdp_drop; +#X obj 567 528 pdp_control; +#X msg 567 501 thread \$1; +#X floatatom 567 589 5 0 0 0 - - -; +#X obj 567 560 route pdp_drop; #X obj 239 343 pdp_pen; #X text 85 498 pdp_pen : free hand drawing object; #X text 85 514 written by Yves Degoyon ( ydegoyon@free.fr ); #X text 85 528 on request from patrick ( 11h11.com ); #X obj 238 387 pdp_xv; -#X obj 238 419 route press drag release; #X msg 282 463 draw \$1 \$2; #X msg 163 344 cursor 1; #X msg 372 228 clear; @@ -55,6 +54,15 @@ 1; #X text 464 353 Mode ( 0=drawing \, 1=erase ); #X text 464 366 ( default=0 ); +#X obj 459 389 unpack f f; +#X obj 462 411 f; +#X obj 508 411 f; +#X msg 374 388 fill \$1 \$2; +#X obj 462 434 pack f f; +#X obj 544 390 t b b; +#X msg 593 390 bang; +#X text 633 391 Fill a region; +#X obj 238 419 route press drag release; #X connect 0 0 9 0; #X connect 1 0 10 0; #X connect 2 0 1 0; @@ -66,7 +74,7 @@ #X connect 8 0 6 0; #X connect 9 0 10 0; #X connect 10 0 21 0; -#X connect 10 0 28 0; +#X connect 10 0 27 0; #X connect 11 0 21 0; #X connect 12 0 11 0; #X connect 13 0 12 0; @@ -77,21 +85,31 @@ #X connect 18 0 17 0; #X connect 20 0 19 0; #X connect 21 0 25 0; -#X connect 25 0 26 0; -#X connect 26 1 27 0; -#X connect 27 0 21 0; -#X connect 28 0 25 0; -#X connect 29 0 21 0; -#X connect 31 0 21 0; -#X connect 32 0 31 0; -#X connect 34 0 21 0; +#X connect 25 0 56 0; +#X connect 26 0 21 0; +#X connect 27 0 25 0; +#X connect 28 0 21 0; +#X connect 30 0 21 0; +#X connect 31 0 30 0; +#X connect 33 0 21 0; +#X connect 34 0 33 0; #X connect 35 0 34 0; -#X connect 36 0 35 0; -#X connect 38 0 43 0; -#X connect 39 0 41 0; -#X connect 41 0 35 0; -#X connect 41 1 35 2; -#X connect 43 0 35 0; -#X connect 43 1 35 1; -#X connect 45 0 21 0; -#X connect 46 0 45 0; +#X connect 37 0 42 0; +#X connect 38 0 40 0; +#X connect 40 0 34 0; +#X connect 40 1 34 2; +#X connect 42 0 34 0; +#X connect 42 1 34 1; +#X connect 44 0 21 0; +#X connect 45 0 44 0; +#X connect 48 0 49 1; +#X connect 48 1 50 1; +#X connect 49 0 52 0; +#X connect 50 0 52 1; +#X connect 51 0 21 0; +#X connect 52 0 51 0; +#X connect 53 0 49 0; +#X connect 53 1 50 0; +#X connect 54 0 53 0; +#X connect 56 0 48 0; +#X connect 56 1 26 0; diff --git a/modules/Makefile b/modules/Makefile index f5acdc5..de4ad7d 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -14,6 +14,6 @@ OBJECTS = pdp_intrusion.o pdp_yqt.o pdp_simura.o pdp_underwatch.o \ pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \ pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \ pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \ - pdp_canvas.o pdp_pen.o + pdp_canvas.o pdp_pen.o pdp_shape.o all_modules: $(OBJECTS) diff --git a/modules/Makefile.in b/modules/Makefile.in index f5acdc5..de4ad7d 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -14,6 +14,6 @@ OBJECTS = pdp_intrusion.o pdp_yqt.o pdp_simura.o pdp_underwatch.o \ pdp_ffmpeg~.o pdp_live~.o pdp_segsnd~.o pdp_noquark.o \ pdp_juxta.o pdp_capture.o pdp_smuck.o pdp_lumafilt.o \ pdp_transition.o pdp_imgloader.o pdp_imgsaver.o pdp_cache.o \ - pdp_canvas.o pdp_pen.o + pdp_canvas.o pdp_pen.o pdp_shape.o all_modules: $(OBJECTS) diff --git a/modules/pdp_canvas.c b/modules/pdp_canvas.c index 1099fe8..d86f57c 100644 --- a/modules/pdp_canvas.c +++ b/modules/pdp_canvas.c @@ -203,7 +203,7 @@ static void pdp_canvas_drag(t_pdp_canvas *x, t_floatarg X, t_floatarg Y) { X = X*x->x_owidth; Y = Y*x->x_oheight; - // post( "pdp_canvas : drag %f %f", dx, dy ); + // post( "pdp_canvas : drag %f %f", X, Y ); if ( x->x_current != -1 ) { x->x_xoffsets[ x->x_current ] += (X-x->x_xmouse); diff --git a/modules/pdp_pen.c b/modules/pdp_pen.c index d682285..d5549da 100644 --- a/modules/pdp_pen.c +++ b/modules/pdp_pen.c @@ -30,6 +30,8 @@ static char *pdp_pen_version = "pdp_pen: version 0.1, free hand drawing object written by Yves Degoyon (ydegoyon@free.fr)"; +static t_int nbits=0; // number of recursive calls + typedef struct pdp_pen_struct { t_object x_obj; @@ -120,6 +122,168 @@ static void pdp_pen_draw(t_pdp_pen *x, t_floatarg X, t_floatarg Y) } } +static void pdp_pen_do_fill(t_pdp_pen *x, t_floatarg X, t_floatarg Y) +{ + short int *pbY, *pbU, *pbV; + short int nX, nY; + + nbits++; + // post( "pdp_pen_do_fill : X=%d, Y=%d stack=%d", (t_int)X, (t_int)Y, nbits ); + + pbY = x->x_bdata; + pbU = (x->x_bdata+x->x_vsize); + pbV = (x->x_bdata+x->x_vsize+(x->x_vsize>>2)); + + if ( ( (t_int)X < 0 ) || ( (t_int)X >= x->x_vwidth ) || + ( (t_int)Y < 0 ) || ( (t_int)Y >= x->x_vheight ) ) + { + nbits--; + return; + } + + nX = (t_int) X; + nY = (t_int) Y; + if ( *(pbY+(t_int)Y*x->x_vwidth+(t_int)X) != 0 ) + { + nbits--; + return; + } + else + { + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X+1; + nY = (t_int) Y; + if ( (*(pbY+nY*x->x_vwidth+nX)) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X-1; + nY = (t_int) Y; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X-1; + nY = (t_int) Y-1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X; + nY = (t_int) Y-1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X+1; + nY = (t_int) Y-1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X-1; + nY = (t_int) Y+1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X; + nY = (t_int) Y+1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nX = (t_int) X+1; + nY = (t_int) Y+1; + if ( *(pbY+nY*x->x_vwidth+nX) == 0 ) + { + pdp_pen_do_fill( x, nX, nY ); + *(pbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + + nbits--; +} + +static void pdp_pen_fill(t_pdp_pen *x, t_floatarg X, t_floatarg Y) +{ + X = X*x->x_vwidth; + Y = Y*x->x_vheight; + // post( "pdp_pen : draw %f %f", X, Y ); + if ( (X<0) || (X>x->x_vwidth) ) + { + // post( "pdp_pen : fill : wrong X position : %f", X ); + return; + } + if ( (Y<0) || (Y>x->x_vheight) ) + { + // post( "pdp_pen : fill : wrong Y position : %f", Y ); + return; + } + + pdp_pen_do_fill( x, X, Y ); +} + static void pdp_pen_clear(t_pdp_pen *x) { if ( x->x_vsize > 0 ) @@ -329,6 +493,7 @@ void pdp_pen_setup(void) class_addmethod(pdp_pen_class, (t_method)pdp_pen_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); class_addmethod(pdp_pen_class, (t_method)pdp_pen_draw, gensym("draw"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_pen_class, (t_method)pdp_pen_fill, gensym("fill"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); class_addmethod(pdp_pen_class, (t_method)pdp_pen_clear, gensym("clear"), A_NULL); class_addmethod(pdp_pen_class, (t_method)pdp_pen_width, gensym("width"), A_DEFFLOAT, A_NULL); class_addmethod(pdp_pen_class, (t_method)pdp_pen_rgb, gensym("rgb"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_NULL); diff --git a/modules/pdp_ripple.c b/modules/pdp_ripple.c index ab7209b..e0ceca7 100644 --- a/modules/pdp_ripple.c +++ b/modules/pdp_ripple.c @@ -28,7 +28,7 @@ #include "pdp.h" #include -#define MAGIC_THRESHOLD 30 +#define MAGIC_THRESHOLD 5 static unsigned int fastrand_val; #define inline_fastrand() (fastrand_val=fastrand_val*1103515245+12345) diff --git a/modules/pdp_shape.c b/modules/pdp_shape.c new file mode 100644 index 0000000..50e76db --- /dev/null +++ b/modules/pdp_shape.c @@ -0,0 +1,582 @@ +/* + * PiDiP module. + * Copyright (c) by Yves Degoyon (ydegoyon@free.fr) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + +/* This object is a shape recognition object + * Written by Yves Degoyon + */ + +#include "pdp.h" +#include "yuv.h" +#include + +static char *pdp_shape_version = "pdp_shape: version 0.1, shape recongnition object written by Yves Degoyon (ydegoyon@free.fr)"; + +typedef struct pdp_shape_struct +{ + t_object x_obj; + t_float x_f; + + t_outlet *x_outlet0; + t_int x_packet0; + t_int x_packet1; + t_int x_dropped; + t_int x_queue_id; + + t_int x_vwidth; + t_int x_vheight; + t_int x_vsize; + + t_int x_red; + t_int x_green; + t_int x_blue; + + t_int x_cursX; + t_int x_cursY; + + t_int x_colorY; // YUV components of selected color + t_int x_colorU; + t_int x_colorV; + + t_int x_tolerance; // tolerance + t_int x_paint; // paint option + t_int x_luminosity; // use luminosity or not + + short int *x_bdata; + short int *x_bbdata; + char *x_checked; + + t_outlet *x_x1; // output x1 coordinate of blob + t_outlet *x_y1; // output y1 coordinate of blob + t_outlet *x_x2; // output x2 coordinate of blob + t_outlet *x_y2; // output y2 coordinate of blob + t_int x_vx1; // x1 coordinate of blob + t_int x_vx2; // x1 coordinate of blob + t_int x_vy1; // x1 coordinate of blob + t_int x_vy2; // x1 coordinate of blob + + +} t_pdp_shape; + +static void pdp_shape_allocate(t_pdp_shape *x, t_int newsize) +{ + int i; + + if ( x->x_bdata ) freebytes( x->x_bdata, (( x->x_vsize + (x->x_vsize>>1))<<1)); + if ( x->x_bbdata ) freebytes( x->x_bbdata, (( x->x_vsize + (x->x_vsize>>1))<<1)); + if ( x->x_checked ) freebytes( x->x_checked, x->x_vsize ); + + x->x_vsize = newsize; + + x->x_bdata = (short int *)getbytes((( x->x_vsize + (x->x_vsize>>1))<<1)); + x->x_bbdata = (short int *)getbytes((( x->x_vsize + (x->x_vsize>>1))<<1)); + x->x_checked = (char *)getbytes( x->x_vsize ); +} + +static void pdp_shape_tolerance(t_pdp_shape *x, t_floatarg ftolerance ) +{ + if ( ftolerance >= 0 ) + { + x->x_tolerance = (int)ftolerance; + } +} + +static void pdp_shape_luminosity(t_pdp_shape *x, t_floatarg fluminosity ) +{ + if ( ( fluminosity == 0 ) || ( fluminosity == 1 ) ) + { + x->x_luminosity = (int)fluminosity; + } +} + +static void pdp_shape_paint(t_pdp_shape *x, t_floatarg fpaint ) +{ + if ( ( (t_int)fpaint == 0 ) || ( (t_int)fpaint == 1 ) ) + { + x->x_paint = (t_int)fpaint; + } +} + +static void pdp_shape_do_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y); +static void pdp_shape_frame_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y); + +static t_int pdp_shape_check_point(t_pdp_shape *x, t_int nX, t_int nY) +{ + short int *pbY, *pbU, *pbV; + short int y, v, u; + t_int diff; + + if ( ( nX < 0 ) || ( nX >= x->x_vwidth ) || + ( nY < 0 ) || ( nY >= x->x_vheight ) ) + { + return 0; + } + + pbY = x->x_bdata; + pbU = (x->x_bdata+x->x_vsize); + pbV = (x->x_bdata+x->x_vsize+(x->x_vsize>>2)); + y = *(pbY+nY*x->x_vwidth+nX); + v = *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)); + u = *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)); + diff = (abs(u-x->x_colorU)>>8)+(abs(v-x->x_colorV)>>8); + if ( x->x_luminosity ) diff += (abs(y-x->x_colorY)>>7); + if ( diff <= x->x_tolerance ) + { + x->x_cursX = nX; + x->x_cursY = nY; + return 1; + } + return 0; +} + +static void pdp_shape_propagate(t_pdp_shape *x, t_int nX, t_int nY) +{ + + if ( ( nX >= 0 ) && ( nX < x->x_vwidth ) && + ( nY >= 0 ) && ( nY < x->x_vheight ) && + ( !*(x->x_checked + nY*x->x_vwidth + nX) ) + ) + { + pdp_shape_do_detect( x, nX, nY ); + } +} + +static void pdp_shape_do_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y) +{ + short int *pbY, *pbU, *pbV; + short int *pbbY, *pbbU, *pbbV; + short int nX, nY, y, v, u; + short int *data; + t_int diff, px, py, inc, maxXY; + + pbY = x->x_bdata; + pbU = (x->x_bdata+x->x_vsize); + pbV = (x->x_bdata+x->x_vsize+(x->x_vsize>>2)); + pbbY = x->x_bbdata; + pbbU = (x->x_bbdata+x->x_vsize); + pbbV = (x->x_bbdata+x->x_vsize+(x->x_vsize>>2)); + + if ( ( (t_int)X < 0 ) || ( (t_int)X >= x->x_vwidth ) || + ( (t_int)Y < 0 ) || ( (t_int)Y >= x->x_vheight ) ) + { + return; + } + + nX = (t_int) X; + nY = (t_int) Y; + *(x->x_checked + nY*x->x_vwidth + nX) = 1; + + y = *(pbY+nY*x->x_vwidth+nX); + v = *(pbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)); + u = *(pbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)); + diff = (abs(u-x->x_colorU)>>8)+(abs(v-x->x_colorV)>>8); + if ( x->x_luminosity ) diff += (abs(y-x->x_colorY)>>7); + if ( diff > x->x_tolerance ) + { + // paint it white + // post( "pdp_shape_do_detect : paint : %d %d", nX, nY ); + *(pbbY+nY*x->x_vwidth+nX) = (0xff<<7); + *(pbbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8); + *(pbbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = (0xff<<8); + + if ( ( nX < x->x_vx1 ) || ( x->x_vx1 == -1 ) ) + { + x->x_vx1 = nX; + } + if ( ( nX > x->x_vx2 ) || ( x->x_vx2 == -1 ) ) + { + x->x_vx2 = nX; + } + if ( ( nY < x->x_vy1 ) || ( x->x_vy1 == -1 ) ) + { + x->x_vy1 = nY; + } + if ( ( nY > x->x_vy2 ) || ( x->x_vy2 == -1 ) ) + { + x->x_vy2 = nY; + } + + maxXY = ( x->x_vwidth > x->x_vheight ) ? x->x_vwidth : x->x_vheight; + + if ( ( nX == x->x_cursX ) && ( nY == x->x_cursY ) ) + { + for ( inc=0; inc<=maxXY; inc++ ) + { + nX = (t_int) X+inc; + nY = (t_int) Y; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X-inc; + nY = (t_int) Y; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X-inc; + nY = (t_int) Y-inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X; + nY = (t_int) Y-inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X+inc; + nY = (t_int) Y-inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X-inc; + nY = (t_int) Y+inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X; + nY = (t_int) Y+inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + nX = (t_int) X+inc; + nY = (t_int) Y+inc; + if ( pdp_shape_check_point( x, nX, nY ) ) + { + pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + return; + } + + } + } + return; + } + else + { + if ( x->x_paint ) + { + *(pbbY+nY*x->x_vwidth+nX) = + (yuv_RGBtoY( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))<<7; + *(pbbU+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoU( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + *(pbbV+(nY>>1)*(x->x_vwidth>>1)+(nX>>1)) = + (yuv_RGBtoV( (x->x_blue << 16) + (x->x_green << 8) + x->x_red ))-128<<8; + } + } + + nX = (t_int) X+1; + nY = (t_int) Y; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X-1; + nY = (t_int) Y; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X-1; + nY = (t_int) Y-1; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X; + nY = (t_int) Y-1; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X+1; + nY = (t_int) Y-1; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X-1; + nY = (t_int) Y+1; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X; + nY = (t_int) Y+1; + pdp_shape_propagate(x, nX, nY); + + nX = (t_int) X+1; + nY = (t_int) Y+1; + pdp_shape_propagate(x, nX, nY); + +} + +static void pdp_shape_pick(t_pdp_shape *x, t_floatarg X, t_floatarg Y) +{ + t_int y,u,v; + + x->x_cursX = (t_int) (X*(t_float)x->x_vwidth); + x->x_cursY = (t_int) (Y*(t_float)x->x_vheight); + post( "pdp_shape : pick color at : %d,%d", x->x_cursX, x->x_cursY ); + if ( ( x->x_cursX >= 0 ) && ( x->x_cursX < x->x_vwidth ) + && ( x->x_cursY >= 0 ) && ( x->x_cursY < x->x_vheight ) ) + { + x->x_colorY = *(x->x_bdata + x->x_cursY*x->x_vwidth+x->x_cursX);; + x->x_colorV = (*(x->x_bdata + x->x_vsize + (x->x_cursY>>1)*(x->x_vwidth>>1)+(x->x_cursX>>1))); + x->x_colorU = + (*(x->x_bdata + x->x_vsize + (x->x_vsize>>2) + (x->x_cursY>>1)*(x->x_vwidth>>1)+(x->x_cursX>>1))); + y = x->x_colorY>>7; + v = (x->x_colorV>>8)+128; + u = (x->x_colorU>>8)+128; + x->x_red = yuv_YUVtoR( y, u, v ); + x->x_green = yuv_YUVtoG( y, u, v ); + x->x_blue = yuv_YUVtoB( y, u, v ); + post( "pdp_shape : picked color set to : %d,%d,%d", x->x_red, x->x_green, x->x_blue ); + } +} + +static void pdp_shape_frame_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y) +{ + if ( x->x_bdata == NULL ) return; + + // post( "pdp_shape : detect %d %d", (t_int)x->x_cursX, (t_int)x->x_cursY ); + x->x_vx1 = -1; + x->x_vx2 = -1; + x->x_vy1 = -1; + x->x_vy2 = -1; + memset( x->x_checked, 0x0, x->x_vsize ); + pdp_shape_do_detect( x, x->x_cursX, x->x_cursY ); + + outlet_float( x->x_x1, x->x_vx1 ); + outlet_float( x->x_y1, x->x_vy1 ); + outlet_float( x->x_x2, x->x_vx2 ); + outlet_float( x->x_y2, x->x_vy2 ); +} + +static void pdp_shape_detect(t_pdp_shape *x, t_floatarg X, t_floatarg Y) +{ + t_int wX, wY; + + wX = (t_int) (X*(t_float)x->x_vwidth); + wY = (t_int) (Y*(t_float)x->x_vheight); + post( "pdp_shape : detect %d %d", wX, wY ); + if ( (wX<0) || (wX>x->x_vwidth) ) + { + // post( "pdp_shape : fill : wrong X position : %f", wX ); + return; + } + if ( (wY<0) || (wY>x->x_vheight) ) + { + // post( "pdp_shape : fill : wrong Y position : %f", wY ); + return; + } + + x->x_cursX = wX; + x->x_cursY = wY; +} + +static void pdp_shape_rgb(t_pdp_shape *x, t_floatarg r, t_floatarg g, t_floatarg b) +{ + if ( ( r >= 0. ) && ( r <= 255. ) && + ( g >= 0. ) && ( g <= 255. ) && + ( b >= 0. ) && ( b <= 255. ) ) + { + x->x_red = (int) r; + x->x_green = (int) g; + x->x_blue = (int) b; + } +} + +static void pdp_shape_process_yv12(t_pdp_shape *x) +{ + t_pdp *header = pdp_packet_header(x->x_packet0); + short int *data = (short int *)pdp_packet_data(x->x_packet0); + t_pdp *newheader = pdp_packet_header(x->x_packet1); + short int *newdata = (short int *)pdp_packet_data(x->x_packet1); + short int *pbbY, *pbbU, *pbbV; + + /* allocate all ressources */ + if ( ((t_int)header->info.image.width != x->x_vwidth ) || + ((t_int)header->info.image.height != x->x_vheight ) ) + { + pdp_shape_allocate(x, header->info.image.width*header->info.image.height ); + post( "pdp_shape : reallocating buffers" ); + } + + x->x_vwidth = header->info.image.width; + x->x_vheight = header->info.image.height; + x->x_vsize = x->x_vwidth*x->x_vheight; + + newheader->info.image.encoding = header->info.image.encoding; + newheader->info.image.width = x->x_vwidth; + newheader->info.image.height = x->x_vheight; + + memcpy( x->x_bdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 ); + memcpy( x->x_bbdata, data, (x->x_vsize+(x->x_vsize>>1))<<1 ); + + if ( x->x_cursX != -1 ) pdp_shape_frame_detect( x, x->x_cursX, x->x_cursY ); + + // paint cursor in red for debug purpose + pbbY = x->x_bbdata; + pbbU = (x->x_bbdata+x->x_vsize); + pbbV = (x->x_bbdata+x->x_vsize+(x->x_vsize>>2)); + *(pbbY+x->x_cursY*x->x_vwidth+x->x_cursX) = (yuv_RGBtoY( 0xff ))<<7; + *(pbbU+(x->x_cursY>>1)*(x->x_vwidth>>1)+(x->x_cursX>>1)) = ((yuv_RGBtoU( 0xff )-128)<<8); + *(pbbV+(x->x_cursY>>1)*(x->x_vwidth>>1)+(x->x_cursX>>1)) = ((yuv_RGBtoV( 0xff )-128)<<8); + + memcpy( newdata, x->x_bbdata, (x->x_vsize+(x->x_vsize>>1))<<1 ); + + return; +} + +static void pdp_shape_sendpacket(t_pdp_shape *x) +{ + /* release the packet */ + pdp_packet_mark_unused(x->x_packet0); + x->x_packet0 = -1; + + /* unregister and propagate if valid dest packet */ + pdp_packet_pass_if_valid(x->x_outlet0, &x->x_packet1); +} + +static void pdp_shape_process(t_pdp_shape *x) +{ + int encoding; + t_pdp *header = 0; + + /* check if image data packets are compatible */ + if ( (header = pdp_packet_header(x->x_packet0)) + && (PDP_IMAGE == header->type)) + { + /* pdp_shape_process inputs and write into active inlet */ + switch(pdp_packet_header(x->x_packet0)->info.image.encoding){ + + case PDP_IMAGE_YV12: + x->x_packet1 = pdp_packet_clone_rw(x->x_packet0); + pdp_queue_add(x, pdp_shape_process_yv12, pdp_shape_sendpacket, &x->x_queue_id); + break; + + case PDP_IMAGE_GREY: + // pdp_shape_process_packet(x); + break; + + default: + /* don't know the type, so dont pdp_shape_process */ + break; + + } + } +} + +static void pdp_shape_input_0(t_pdp_shape *x, t_symbol *s, t_floatarg f) +{ + /* if this is a register_ro message or register_rw message, register with packet factory */ + + if (s== gensym("register_rw")) + { + x->x_dropped = pdp_packet_convert_ro_or_drop(&x->x_packet0, (int)f, pdp_gensym("image/YCrCb/*") ); + } + + if ((s == gensym("process")) && (-1 != x->x_packet0) && (!x->x_dropped)) + { + /* add the process method and callback to the process queue */ + pdp_shape_process(x); + } +} + +static void pdp_shape_free(t_pdp_shape *x) +{ + int i; + + pdp_queue_finish(x->x_queue_id); + pdp_packet_mark_unused(x->x_packet0); + +} + +t_class *pdp_shape_class; + +void *pdp_shape_new(void) +{ + int i; + + t_pdp_shape *x = (t_pdp_shape *)pd_new(pdp_shape_class); + + x->x_outlet0 = outlet_new(&x->x_obj, &s_anything); + + x->x_x1 = outlet_new(&x->x_obj, &s_float); + x->x_y1 = outlet_new(&x->x_obj, &s_float); + x->x_x2 = outlet_new(&x->x_obj, &s_float); + x->x_y2 = outlet_new(&x->x_obj, &s_float); + + x->x_packet0 = -1; + x->x_packet1 = -1; + x->x_queue_id = -1; + + x->x_vsize = -1; + + x->x_red = 255; + x->x_green = 255; + x->x_blue = 255; + + x->x_tolerance = 20; + x->x_paint = 0; + x->x_luminosity = 1; + + x->x_cursX = -1; + x->x_cursY = -1; + + x->x_bdata = NULL; + x->x_bbdata = NULL; + x->x_checked = NULL; + + return (void *)x; +} + + +#ifdef __cplusplus +extern "C" +{ +#endif + + +void pdp_shape_setup(void) +{ +// post( pdp_shape_version ); + pdp_shape_class = class_new(gensym("pdp_shape"), (t_newmethod)pdp_shape_new, + (t_method)pdp_shape_free, sizeof(t_pdp_shape), 0, A_NULL); + class_sethelpsymbol( pdp_shape_class, gensym("pdp_shape.pd") ); + + class_addmethod(pdp_shape_class, (t_method)pdp_shape_input_0, gensym("pdp"), A_SYMBOL, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_shape_class, (t_method)pdp_shape_pick, gensym("pick"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_shape_class, (t_method)pdp_shape_detect, gensym("detect"), A_DEFFLOAT, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_shape_class, (t_method)pdp_shape_rgb, gensym("rgb"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_NULL); + class_addmethod(pdp_shape_class, (t_method)pdp_shape_tolerance, gensym("tolerance"), A_FLOAT, A_NULL); + class_addmethod(pdp_shape_class, (t_method)pdp_shape_paint, gensym("paint"), A_FLOAT, A_NULL); + +} + +#ifdef __cplusplus +} +#endif diff --git a/system/pidip.c b/system/pidip.c index 73e2036..c27edc2 100644 --- a/system/pidip.c +++ b/system/pidip.c @@ -58,6 +58,7 @@ extern "C" void pdp_cache_setup(void); void pdp_canvas_setup(void); void pdp_pen_setup(void); + void pdp_shape_setup(void); /* library setup routine */ @@ -114,6 +115,7 @@ void pidip_setup(void){ pdp_cache_setup(); pdp_canvas_setup(); pdp_pen_setup(); + pdp_shape_setup(); } -- cgit v1.2.1