[GEM-cvs] Gem/src/Pixes pix_hit.cpp,1.1,1.2 pix_hit.h,1.1,1.2
Brought to you by:
zmoelnig
From: IOhannes m z. <zmo...@us...> - 2005-12-15 17:45:59
|
Update of /cvsroot/pd-gem/Gem/src/Pixes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1938 Modified Files: pix_hit.cpp pix_hit.h Log Message: removed loading/saving removed "point" area-type changed (float) to (unsigned char) where possible (at least where it was obvious to do) Index: pix_hit.h =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_hit.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pix_hit.h 15 Dec 2005 12:17:01 -0000 1.1 --- pix_hit.h 15 Dec 2005 17:45:50 -0000 1.2 *************** *** 31,35 **** -----------------------------------------------------------------*/ #define NUM_hit_areas 256 ! #define DEF_TRESHOLD 0.5 #define DEF_MINIMUM 1 #define DEF_MIN_DISTANCE 0.01 --- 31,35 ---- -----------------------------------------------------------------*/ #define NUM_hit_areas 256 ! #define DEF_TRESHOLD 127 #define DEF_MINIMUM 1 #define DEF_MIN_DISTANCE 0.01 *************** *** 38,42 **** enum areaTypes { - point, rectangle, circle, --- 38,41 ---- *************** *** 62,66 **** ////////// // Constructor ! pix_hit(t_symbol*s); protected: --- 61,65 ---- ////////// // Constructor ! pix_hit(void); protected: *************** *** 79,83 **** void set_show(int val); void del(float min); - void createPoint(int n, float x, float y); void createRectangle(int n, float x, float y, float w, float h); void createCircle(int n, float x, float y, float r); --- 78,81 ---- *************** *** 85,92 **** void move(int n, float x, float y, float w, float h); void del(int n); ! void save(char *filename); ! void load(char *filename); ! ! float getGreyValue(imageStruct &image, unsigned char *data, float *color, int xPos); --- 83,87 ---- void move(int n, float x, float y, float w, float h); void del(int n); ! unsigned char getGreyValue(GLenum format, unsigned char *data); *************** *** 95,99 **** float buffer[NUM_hit_areas]; ! float minimum_treshold; short int minimum_pixels; float min_distance; --- 90,94 ---- float buffer[NUM_hit_areas]; ! unsigned char minimum_treshold; short int minimum_pixels; float min_distance; *************** *** 108,118 **** static void min_distanceCallback(void *data, t_floatarg min); static void deleteCallback(void *data, t_floatarg id); - static void createPointCallback(void *data, t_symbol *sl, int argc, t_atom *argv); static void createRectangleCallback(void *data, t_symbol *sl, int argc, t_atom *argv); static void createCircleCallback(void *data, t_symbol *sl, int argc, t_atom *argv); static void createLineCallback(void *data, t_symbol *sl, int argc, t_atom *argv); static void moveCallback(void *data, t_symbol *sl, int argc, t_atom *argv); - static void saveCallback(void *data, t_symbol*s); - static void loadCallback(void *data, t_symbol*s); static void showCallback(void *data, t_floatarg val); --- 103,110 ---- Index: pix_hit.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Pixes/pix_hit.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pix_hit.cpp 15 Dec 2005 12:17:01 -0000 1.1 --- pix_hit.cpp 15 Dec 2005 17:45:46 -0000 1.2 *************** *** 12,16 **** #include "pix_hit.h" ! CPPEXTERN_NEW_WITH_ONE_ARG(pix_hit, t_symbol *, A_DEFSYM) ///////////////////////////////////////////////////////// --- 12,16 ---- #include "pix_hit.h" ! CPPEXTERN_NEW(pix_hit) ///////////////////////////////////////////////////////// *************** *** 22,26 **** // ///////////////////////////////////////////////////////// ! pix_hit :: pix_hit(t_symbol*s) : minimum_treshold(DEF_TRESHOLD), minimum_pixels(DEF_MINIMUM), --- 22,26 ---- // ///////////////////////////////////////////////////////// ! pix_hit :: pix_hit() : minimum_treshold(DEF_TRESHOLD), minimum_pixels(DEF_MINIMUM), *************** *** 28,34 **** show(false) { - //inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("symbol"), gensym("pix_hit")); // create the new inlet for the messages - //inlet_new(this->x_obj, &this->x_obj->ob_pd, gensym("float"), gensym("messages")); m_hits = outlet_new(this->x_obj, 0); // init the array of active hit_areas --- 28,32 ---- *************** *** 38,44 **** buffer[i]=0; } - - if((NULL!=s) && (&s_!=s) && (NULL!=s->s_name)) - load(s->s_name); } --- 36,39 ---- *************** *** 52,96 **** } ! float pix_hit :: getGreyValue(imageStruct &image, unsigned char *data, float *color, int xPos) { - float grayVal = 0.f; - // is this a gray8 or RGBA? ! switch(image.format) { // Gray scale case(GL_LUMINANCE): ! grayVal=data[chGray] / 256.f; ! color[0] = color[1] = color[2] = grayVal; ! break; // YUV case(GL_YCBCR_422_GEM): ! ! if ( xPos % 2) { //odd ! color[0] = data[1]; ! color[1] = data[-2]; ! color[2] = data[0]; ! }else{ ! color[0] = data[1]; ! color[1] = data[0]; ! color[2] = data[2]; ! } ! grayVal=color[0]; break; // RGB, RGBA case(GL_RGB): case (GL_RGBA): ! color[0] = data[chRed] / 256.f; ! color[1] = data[chGreen] / 256.f; ! color[2] = data[chBlue] / 256.f; ! grayVal=(color[0] * 0.3086f + color[1] * 0.06094f + color[2] * 0.0820f); break; default : error("GEM: pix_data: unknown image format"); return 0; ! // break; } - // float grayVal = (color[0] + color[1] + color[2]) / 3.f; - return grayVal; } --- 47,72 ---- } ! unsigned char pix_hit :: getGreyValue(GLenum format, unsigned char *data) { // is this a gray8 or RGBA? ! switch(format) { // Gray scale case(GL_LUMINANCE): ! return data[chGray]; break; // YUV case(GL_YCBCR_422_GEM): ! return data[chY1]; break; // RGB, RGBA case(GL_RGB): case (GL_RGBA): ! return (data[chRed]*79+data[chGreen]*156+data[chBlue]*21)>>8; break; default : error("GEM: pix_data: unknown image format"); return 0; ! break; } } *************** *** 108,353 **** unsigned char *src=image.data; unsigned char data[3]; - float color[3]; int pixels_found; bool go_on; ! for (int i=0; i<NUM_hit_areas; i++) ! { ! if (area_active[i]) { ! switch (hit_areas[i].type) ! { ! case point: ! { ! int xPos = (int)(hit_areas[i].x * (float)image.xsize); ! int yPos = (int)(hit_areas[i].y * (float)image.ysize); ! int position = yPos * image.xsize * image.csize + ! xPos * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! float grayVal = getGreyValue(image, data, color, xPos); ! if (grayVal >= minimum_treshold) ! { ! // hit! ! if (buffer[i]==0) ! { ! // TODO: build list with |i 1( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)1); ! outlet_list(m_hits, gensym("list"), 2, atom); ! buffer[i]=1; ! } ! } else ! { ! if (buffer[i]==1) ! { ! // TODO: build list with |i 0( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)0); ! outlet_list(m_hits, gensym("list"), 2, atom); ! buffer[i]=0; ! } ! } ! break; ! } ! case rectangle: ! { ! int xPos = (int)(hit_areas[i].x * (float)image.xsize); ! int yPos = (int)(hit_areas[i].y * (float)image.ysize); ! int Width = (int)(hit_areas[i].width * (float)image.xsize); ! int Height = (int)(hit_areas[i].height * (float)image.ysize); ! go_on=true; ! bool hit=false; ! pixels_found=0; ! // for each line in this rectangle.. ! for (int this_y = yPos; go_on && (this_y < yPos+Height) && (this_y<image.ysize); this_y++) ! { ! // for each pixle in this line ! for (int this_x = xPos; go_on && (this_x < xPos + Width) && (this_x < image.xsize); this_x++) ! { ! // get this pixel ! int position = (this_y * image.xsize + this_x) * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show) { ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; ! } ! // get grey val ! float grayVal = getGreyValue(image, data, color, xPos); ! if (grayVal >= minimum_treshold) ! { ! pixels_found++; ! if (pixels_found>=minimum_pixels) ! { ! // hit! ! hit=true; ! // exit the loop.. ! go_on=false; ! } ! } ! } ! } ! if (hit) ! { ! if (buffer[i]==0) ! { ! buffer[i]=1; ! // TODO: build list with |i 1( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)1); ! outlet_list(m_hits, gensym("list"), 2, atom); ! } ! } else ! { ! if (buffer[i]==1) ! { ! buffer[i]=0; ! // TODO: build list with |i 0( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)0); ! outlet_list(m_hits, gensym("list"), 2, atom); ! } ! } ! break; } ! case circle: ! //todo ! break; ! case line: ! { ! // i need to get the line equation f(x) ! // then ! // for each x bewteen x1 and x2 ! // get y=f(x) ! // and do the hit test in x,y ! // if grayValue > treshold ! // HIT! ! /* ! equation of the line passing from p1 and p2: ! (y-y1)/(y2-y1)=(x-x1)/(x2-x1) ! so ! y = (x-x1)(y2-y1)/(x2-x1) + y1 ! and ! x = (y-y1(x2-x1))/(y2-y1) - x1 ! */ ! int x1 = (int)(hit_areas[i].x * (float)image.xsize); ! int y1 = (int)(hit_areas[i].y * (float)image.ysize); ! int x2 = (int)(hit_areas[i].width * (float)image.xsize); ! int y2 = (int)(hit_areas[i].height * (float)image.ysize); ! int diffx = abs(x2-x1); ! int diffy = abs(y2-y1); ! int counter=0; ! if ((diffx==diffy)&&(diffx==0)) ! break;//faulty line ! if (diffx>diffy) ! { ! // x leads the game ! // y = (x-x1)(y2-y1)/(x2-x1) + y1 ! int incr = 1; ! if ((x2-x1)<0) ! incr = -1; ! int x=x1; ! while (x!=x2) ! { ! // NB diffx can't be == 0 ! // (i would not be here) ! int y = (x-x1)*(y2-y1)/(x2-x1) + y1; ! int position = y * image.xsize * image.csize + ! x * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show){ ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; ! } ! float grayVal = getGreyValue(image, data, color, x); ! if (grayVal >= minimum_treshold) ! { ! float where = (float) ((float)counter/(float)diffx); ! // hit! ! if (fabs(buffer[i] - where) > min_distance) ! { ! ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_float) where); ! outlet_list(m_hits, gensym("list"), 2, atom); ! buffer[i]=where; ! } ! } ! counter++; ! x+=incr; ! } ! } else ! { ! // y rulez ! // x = (y-y1(x2-x1))/(y2-y1) + x1 ! int incr = 1; ! if ((y2-y1)<0) ! incr = -1; ! int y=y1; ! while (y!=y2) ! { ! // NB diffy can't be == 0 ! // (i would not be here) ! int x = (y-y1)*(x2-x1)/(y2-y1) + x1; ! int position = y * image.xsize * image.csize + ! x * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show){ ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; ! } ! float grayVal = getGreyValue(image, data, color, x); ! if (grayVal >= minimum_treshold) ! { ! float where = (float) ((float)counter/(float)diffy); ! // hit! ! if (fabs(buffer[i] - where) > min_distance) ! { ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_float) where); ! outlet_list(m_hits, gensym("list"), 2, atom); ! buffer[i]=where; ! } ! } ! counter++; ! y+=incr; ! } ! } ! ! break; } } } } } - - void pix_hit :: threshold(float thresh) { --- 84,266 ---- unsigned char *src=image.data; unsigned char data[3]; int pixels_found; bool go_on; ! for (int i=0; i<NUM_hit_areas; i++) { ! if (area_active[i]) { ! switch (hit_areas[i].type) { ! case rectangle: { ! int xPos = (int)(hit_areas[i].x * (float)image.xsize); ! int yPos = (int)(hit_areas[i].y * (float)image.ysize); ! int Width = (int)(hit_areas[i].width * (float)image.xsize); ! int Height = (int)(hit_areas[i].height * (float)image.ysize); ! go_on=true; ! bool hit=false; ! pixels_found=0; ! // for each line in this rectangle.. ! for (int this_y = yPos; go_on && (this_y < yPos+Height) && (this_y<image.ysize); this_y++) { ! // for each pixle in this line ! for (int this_x = xPos; go_on && (this_x < xPos + Width) && (this_x < image.xsize); this_x++) { ! // get this pixel ! int position = (this_y * image.xsize + this_x) * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show) { ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; } ! // get grey val ! if(getGreyValue(image.format, data) >= minimum_treshold) { ! pixels_found++; ! if (pixels_found>=minimum_pixels) { ! // hit! ! hit=true; ! // exit the loop.. ! go_on=false; ! } ! } ! } ! } ! if (hit) { ! if (buffer[i]==0) { ! buffer[i]=1; ! // TODO: build list with |i 1( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)1); ! outlet_list(m_hits, gensym("list"), 2, atom); ! } ! } else { ! if (buffer[i]==1) { ! buffer[i]=0; ! // TODO: build list with |i 0( ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_int)0); ! outlet_list(m_hits, gensym("list"), 2, atom); ! } ! } ! break; ! } ! case circle: ! //todo ! break; ! case line: ! { ! // i need to get the line equation f(x) ! // then ! // for each x bewteen x1 and x2 ! // get y=f(x) ! // and do the hit test in x,y ! // if grayValue > treshold ! // HIT! ! /* ! equation of the line passing from p1 and p2: ! (y-y1)/(y2-y1)=(x-x1)/(x2-x1) ! so ! y = (x-x1)(y2-y1)/(x2-x1) + y1 ! and ! x = (y-y1(x2-x1))/(y2-y1) - x1 ! */ ! int x1 = (int)(hit_areas[i].x * (float)image.xsize); ! int y1 = (int)(hit_areas[i].y * (float)image.ysize); ! int x2 = (int)(hit_areas[i].width * (float)image.xsize); ! int y2 = (int)(hit_areas[i].height * (float)image.ysize); ! int diffx = abs(x2-x1); ! int diffy = abs(y2-y1); ! int counter=0; ! if ((diffx==diffy)&&(diffx==0)) ! break;//faulty line ! if (diffx>diffy) { ! // x leads the game ! // y = (x-x1)(y2-y1)/(x2-x1) + y1 ! int incr = 1; ! if ((x2-x1)<0) ! incr = -1; ! int x=x1; ! while (x!=x2) { ! // NB diffx can't be == 0 ! // (i would not be here) ! int y = (x-x1)*(y2-y1)/(x2-x1) + y1; ! int position = y * image.xsize * image.csize + ! x * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show){ ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; ! } ! if(getGreyValue(image.format, data) >= minimum_treshold) { ! float where = (float) ((float)counter/(float)diffx); ! // hit! ! if (fabs(buffer[i] - where) > min_distance) { ! t_atom atom[2]; ! SETFLOAT(&atom[0], (t_int)i); ! SETFLOAT(&atom[1], (t_float) where); ! outlet_list(m_hits, gensym("list"), 2, atom); ! buffer[i]=where; ! } ! } ! counter++; ! x+=incr; ! } ! } else { ! // y rulez ! // x = (y-y1(x2-x1))/(y2-y1) + x1 ! int incr = 1; ! if ((y2-y1)<0) ! incr = -1; ! int y=y1; ! while (y!=y2) { ! // NB diffy can't be == 0 ! // (i would not be here) ! int x = (y-y1)*(x2-x1)/(y2-y1) + x1; ! int position = y * image.xsize * image.csize + ! x * image.csize; ! data[0] = src[position]; ! data[1] = src[position+1]; ! data[2] = src[position+2]; ! if (show){ ! // src[position]=src[position+1]=src[position+2] = 0; ! src[position+0]=~src[position+0]; ! src[position+1]=~src[position+1]; ! src[position+2]=~src[position+2]; } + if(getGreyValue(image.format, data) >= minimum_treshold) { + float where = (float) ((float)counter/(float)diffy); + // hit! + if (fabs(buffer[i] - where) > min_distance) { + t_atom atom[2]; + SETFLOAT(&atom[0], (t_int)i); + SETFLOAT(&atom[1], (t_float) where); + outlet_list(m_hits, gensym("list"), 2, atom); + buffer[i]=where; + } + } + counter++; + y+=incr; } + } + break; } + } } + } } void pix_hit :: threshold(float thresh) { *************** *** 357,361 **** return; } ! minimum_treshold = thresh; } --- 270,274 ---- return; } ! minimum_treshold = (unsigned char)(thresh*255); } *************** *** 385,407 **** } - void pix_hit :: createPoint(int n, float x, float y) - { - if ((n<0) || (n>NUM_hit_areas-1)) - { - error("the id must be an integer between 0 and %i",NUM_hit_areas); - return; - } - if ((x<0) || (x>1) || (y<0) || (y>1)) - { - error("invalid input coordinates"); - return; - } - hit_areas[n].x = x; - hit_areas[n].y = y; - hit_areas[n].type = point; - area_active[n]=true; - - } - void pix_hit :: createRectangle(int n, float x, float y, float w, float h) { --- 298,301 ---- *************** *** 494,615 **** } - void pix_hit :: save(char *filename) - { - FILE *fp; - fp=fopen(filename, "w+b"); - int tmp_byte; - - for (int m=0; m<NUM_hit_areas; m++) - { - if (area_active[m]) - { - post("saving index %i", m); - fputc(1, fp); // first byte tells us if area is active or not - unsigned short int tipo; - switch (hit_areas[m].type) - { - case point: - tipo=0; - break; - case rectangle: - tipo=1; - break; - case circle: - tipo=2; - break; - case line: - tipo=3; - } - // scrivi tutti i campi di hit_areas[i] - unsigned short int tmp[5]; - tmp[0] = tipo; - tmp[1] = (short) (hit_areas[m].x * 65535); - tmp[2] = (short) (hit_areas[m].y * 65535); - tmp[3] = (short) (hit_areas[m].width * 65535); - tmp[4] = (short) (hit_areas[m].height * 65535); - for (int i=0; i<5; i++) - { - // this should avoids problems little/big endian - // i force little endian (most significant byte first) - fputc(tmp[0]>>8, fp); - tmp_byte = tmp[0]<<8; - tmp_byte = tmp_byte >> 8; - fputc(tmp_byte, fp); - } - } else - { - - fputc(0, fp); - // scrivi tanti 0 quanti sono i campi di hit_areas[i] - for (int i=0; i<5; i++) - { - fputc(0, fp); - fputc(0, fp); - } - } - } - if (DEBUG) - post("areas wrote to file %s",filename); - fclose(fp); - } - - void pix_hit :: load(char *filename) - { - FILE *fp; - int i, j, m; - unsigned char tmp[2]; - if ((fp=fopen(filename, "r+b"))==NULL) - { - post("error: can't open file %s", filename); - return; - } - - for (m=0; m<NUM_hit_areas; m++) - { - - area_active[m] = (fgetc(fp) > 0 ? true : false); - unsigned short int tmp_x, tmp_y, tmp_w, tmp_h; - // this should avoids problems little/big endian - // i force little endian (most significant byte first) - tmp[0] = fgetc(fp); - tmp[1] = fgetc(fp); - unsigned short int tipo = (tmp[0]<<8)|(tmp[1]); - switch (tipo) - { - case 0: - hit_areas[m].type = point; - break; - case 1: - hit_areas[m].type = rectangle; - break; - case 2: - hit_areas[m].type = circle; - break; - case 3: - hit_areas[m].type = line; - } - tmp[0] = fgetc(fp); - tmp[1] = fgetc(fp); - tmp_x = (tmp[0]<<8)|(tmp[1]); - hit_areas[m].x = (float) ((float) tmp_x / (float)65535); - tmp[0] = fgetc(fp); - tmp[1] = fgetc(fp); - tmp_y = (tmp[0]<<8)|(tmp[1]); - hit_areas[m].y = (float) ((float) tmp_y / (float)65535); - tmp[0] = fgetc(fp); - tmp[1] = fgetc(fp); - tmp_w = (tmp[0]<<8)|(tmp[1]); - hit_areas[m].width = (float) ((float) tmp_w / (float)65535); - tmp[0] = fgetc(fp); - tmp[1] = fgetc(fp); - tmp_h = (tmp[0]<<8)|(tmp[1]); - hit_areas[m].height = (float) ((float) tmp_h / (float)65535); - if (area_active[m]) - post("loading index %i hit_areas[m].x=%f hit_areas[m].y=%f", m, hit_areas[m].x, hit_areas[m].y); - } - if (DEBUG) - post("areas from file %s",filename); - fclose(fp); - } ///////////////////////////////////////////////////////// --- 388,391 ---- *************** *** 625,630 **** class_addmethod(classPtr, (t_method)&pix_hit::min_distanceCallback, gensym("min_distance"), A_FLOAT, A_NULL); - class_addmethod(classPtr, (t_method)&pix_hit::createPointCallback, - gensym("point"), A_GIMME, A_NULL); class_addmethod(classPtr, (t_method)&pix_hit::createRectangleCallback, gensym("rectangle"), A_GIMME, A_NULL); --- 401,404 ---- *************** *** 637,644 **** class_addmethod(classPtr, (t_method)&pix_hit::deleteCallback, gensym("delete"), A_FLOAT, A_NULL); - class_addmethod(classPtr, (t_method)&pix_hit::saveCallback, - gensym("save"), A_SYMBOL, A_NULL); - class_addmethod(classPtr, (t_method)&pix_hit::loadCallback, - gensym("load"), A_SYMBOL, A_NULL); class_addmethod(classPtr, (t_method)&pix_hit::showCallback, gensym("show"), A_FLOAT, A_NULL); } --- 411,414 ---- *************** *** 674,690 **** } - void pix_hit :: createPointCallback(void *data, t_symbol *sl, int argc, t_atom *argv) - { - int n; - float x,y; - // check for correct number of floats... - n = atom_getint(argv++); - x = atom_getfloat(argv++); - y = atom_getfloat(argv++); - - - GetMyClass(data)->createPoint(n,x,y); - } - void pix_hit :: createRectangleCallback(void *data, t_symbol *sl, int argc, t_atom *argv) { --- 444,447 ---- *************** *** 731,753 **** void pix_hit :: deleteCallback(void *data, t_floatarg id) { - //int n = (int) FLOAT_CLAMP((float)id); - //post("n=%i id =%f", n, id); GetMyClass(data)->del((int)id); } - void pix_hit :: saveCallback(void *data, t_symbol*s) - { - GetMyClass(data)->save(s->s_name); - } - - void pix_hit :: loadCallback(void *data, t_symbol*s) - { - GetMyClass(data)->load(s->s_name); - } - void pix_hit :: showCallback(void *data, t_floatarg val) { - //int n = (int) FLOAT_CLAMP((float)id); - //post("n=%i id =%f", n, id); GetMyClass(data)->set_show((int)val); } --- 488,496 ---- |