Update of /cvsroot/pure-data/externals/pidip/modules In directory sc8-pr-cvs1:/tmp/cvs-serv31538/pidip/modules
Modified Files: Makefile Makefile.in pdp_canvas.c pdp_pen.c pdp_ripple.c Log Message: Version 0.12.9 ( added pdp_shape )
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 8 Oct 2003 14:59:54 -0000 1.4 --- Makefile 17 Oct 2003 20:54:40 -0000 1.5 *************** *** 15,19 **** 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
all_modules: $(OBJECTS) --- 15,19 ---- 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_shape.o
all_modules: $(OBJECTS)
Index: Makefile.in =================================================================== RCS file: /cvsroot/pure-data/externals/pidip/modules/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 8 Oct 2003 15:00:06 -0000 1.4 --- Makefile.in 17 Oct 2003 20:54:40 -0000 1.5 *************** *** 15,19 **** 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
all_modules: $(OBJECTS) --- 15,19 ---- 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_shape.o
all_modules: $(OBJECTS)
Index: pdp_canvas.c =================================================================== RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_canvas.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pdp_canvas.c 26 Sep 2003 00:19:33 -0000 1.2 --- pdp_canvas.c 17 Oct 2003 20:54:40 -0000 1.3 *************** *** 204,208 **** X = X*x->x_owidth; Y = Y*x->x_oheight; ! // post( "pdp_canvas : drag %f %f", dx, dy ); if ( x->x_current != -1 ) { --- 204,208 ---- X = X*x->x_owidth; Y = Y*x->x_oheight; ! // post( "pdp_canvas : drag %f %f", X, Y ); if ( x->x_current != -1 ) {
Index: pdp_pen.c =================================================================== RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_pen.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pdp_pen.c 8 Oct 2003 15:00:57 -0000 1.1 --- pdp_pen.c 17 Oct 2003 20:54:40 -0000 1.2 *************** *** 31,34 **** --- 31,36 ---- 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 { *************** *** 121,124 **** --- 123,288 ---- }
+ 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) { *************** *** 330,333 **** --- 494,498 ---- 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);
Index: pdp_ripple.c =================================================================== RCS file: /cvsroot/pure-data/externals/pidip/modules/pdp_ripple.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pdp_ripple.c 17 Sep 2003 20:08:00 -0000 1.2 --- pdp_ripple.c 17 Oct 2003 20:54:40 -0000 1.3 *************** *** 29,33 **** #include <math.h>
! #define MAGIC_THRESHOLD 30
static unsigned int fastrand_val; --- 29,33 ---- #include <math.h>
! #define MAGIC_THRESHOLD 5
static unsigned int fastrand_val;