touch up Secil's contrib, remove width arg from pokeline func
[email protected] Sat, 2 Nov 2002 14:30:33 -0800
| Newsgroups | gmane.comp.lib.ivtools.patches |
|---|---|
| Message-ID | <a04320412b9ea022e7c66@[12.236.206.76]> |
Patch: ivtools-020918-johnston-067 For: ivtools-1.0.6 Author: [email protected] Subject: touch up Secil's contrib, remove width arg from pokeline func Requires: This is an intermediate patch to ivtools-1.0.6. To apply, cd to the top-level directory of the ivtools source tree (the directory with src and config subdirs), and apply like this: patch -p0 <ThisFile Summary of Changes: - touch up Secil's contribution by removing the // SECIL comments, and removing the 'w' arg from the pokeline func. The number of arguments can easily be determined from the value list argument without traversing it, and this is more the style of other comdraw commands. If someone desired to pass a sublist this could be done several ways, including a new sublist command. Index: ComUnidraw/comeditor.c diff -c ComUnidraw/comeditor.c:1.2 ComUnidraw/comeditor.c:1.3 *** ComUnidraw/comeditor.c:1.2 Fri Sep 13 12:19:22 2002 --- src/ComUnidraw/comeditor.c Wed Sep 18 09:47:37 2002 *************** *** 149,158 **** comterp->add_command("brush", new BrushFunc(comterp, this)); comterp->add_command("pattern", new PatternFunc(comterp, this)); comterp->add_command("colors", new ColorFunc(comterp, this)); - //SECIL comterp->add_command("fontbyname", new FontByNameFunc(comterp, this)); comterp->add_command("colorsrgb", new ColorRgbFunc(comterp, this)); - //SECIL comterp->add_command("nfonts", new NFontsFunc(comterp, this)); comterp->add_command("nbrushes", new NBrushesFunc(comterp, this)); comterp->add_command("npatterns", new NPatternsFunc(comterp, this)); --- 149,156 ---- *************** *** 221,229 **** comterp->add_command("poke", new PixelPokeFunc(comterp, this)); comterp->add_command("peek", new PixelPeekFunc(comterp, this)); - //SECIL comterp->add_command("pokeline", new PixelPokeLineFunc(comterp, this)); - //SECIL comterp->add_command("pcols", new PixelColsFunc(comterp, this)); comterp->add_command("prows", new PixelRowsFunc(comterp, this)); comterp->add_command("pflush", new PixelFlushFunc(comterp, this)); --- 219,225 ---- Index: ComUnidraw/grfunc.c diff -c ComUnidraw/grfunc.c:1.2 ComUnidraw/grfunc.c:1.3 *** ComUnidraw/grfunc.c:1.2 Fri Sep 13 12:19:22 2002 --- src/ComUnidraw/grfunc.c Wed Sep 18 09:47:37 2002 *************** *** 62,74 **** #include <Unidraw/Graphic/ellipses.h> #include <InterViews/transformer.h> - //SECIL #include <IV-2_6/InterViews/world.h> #include <IV-X11/Xlib.h> #include <IV-X11/xdisplay.h> #include <IV-X11/xfont.h> #include <X11/Xatom.h> - //SECIL #include <Attribute/aliterator.h> #include <Attribute/attrlist.h> --- 62,72 ---- *************** *** 680,686 **** } /*****************************************************************************/ - //SECIL FontByNameFunc::FontByNameFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { } --- 678,683 ---- *************** *** 816,822 **** execute_log(cmd); } /*****************************************************************************/ - //SECIL BrushFunc::BrushFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { } --- 813,818 ---- Index: ComUnidraw/grfunc.h diff -c ComUnidraw/grfunc.h:1.2 ComUnidraw/grfunc.h:1.3 *** ComUnidraw/grfunc.h:1.2 Fri Sep 13 12:19:22 2002 --- src/ComUnidraw/grfunc.h Wed Sep 18 09:47:37 2002 *************** *** 131,137 **** return "%s(fontnum) -- set current font from menu order"; } }; - //SECIL //: command for setting font state variable by font name in comdraw. // fontbyname(fontname) -- set current font by name class FontByNameFunc : public UnidrawFunc { --- 131,136 ---- *************** *** 172,178 **** return "%s(fgcolornum bgcolornum) -- set current colors from menu order"; } }; - //SECIL //:comand for setting color state variables by RGB name in comdraw. // colors(fgcolorname bgcolorname). The colorname format is "#RRGGBB" class ColorRgbFunc : public UnidrawFunc { --- 171,176 ---- *************** *** 180,188 **** ColorRgbFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s(fgcolorname bgcolorname) -- set current colors by RGB name. The colorname format is \"#RGB\" for 4 bits, \"#RRGGBB\" for 8 bits,\"#RRRGGGBBB\" for 12 bits,\"#RRRRGGGGBBBB\" for 16 bits"; } }; - //SECIL //: command to select graphics in comdraw. // select([compview ...] :all :clear) -- make these graphics the current selection, --- 178,185 ---- ColorRgbFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s(fgcolorname bgcolorname) -- set current colors by RGB name.\nThe colorname format is \"#RGB\" for 4 bits, \"#RRGGBB\" for 8 bits,\n\"#RRRGGGBBB\" for 12 bits,\"#RRRRGGGGBBBB\" for 16 bits"; } }; //: command to select graphics in comdraw. // select([compview ...] :all :clear) -- make these graphics the current selection, Index: ComUnidraw/pixelfunc.c diff -c ComUnidraw/pixelfunc.c:1.2 ComUnidraw/pixelfunc.c:1.3 *** ComUnidraw/pixelfunc.c:1.2 Fri Sep 13 12:19:22 2002 --- src/ComUnidraw/pixelfunc.c Wed Sep 18 09:47:37 2002 *************** *** 28,34 **** #include <Unidraw/iterator.h> #include <Unidraw/viewer.h> #include <Attribute/attrlist.h> - //SECIL #include <IV-2_6/InterViews/world.h> /*****************************************************************************/ PixelPokeLineFunc::PixelPokeLineFunc(ComTerp* comterp, Editor* ed) : UnidrawFunc(comterp, ed) { --- 28,33 ---- *************** *** 40,53 **** ComValue rastcompv(stack_arg(0)); ComValue xv(stack_arg(1)); ComValue yv(stack_arg(2)); ! ComValue wv(stack_arg(3)); ! ComValue vallistv(stack_arg(4)); int xval = xv.int_val(); int yval = yv.int_val(); - int wval = wv.int_val(); - int pixelvals[wval]; ! if(!vallistv.is_type(ComValue::ArrayType) || vallistv.array_len() != wval){ reset_stack(); push_stack(ComValue::nullval()); return; --- 39,49 ---- ComValue rastcompv(stack_arg(0)); ComValue xv(stack_arg(1)); ComValue yv(stack_arg(2)); ! ComValue vallistv(stack_arg(3)); int xval = xv.int_val(); int yval = yv.int_val(); ! if(!vallistv.is_type(ComValue::ArrayType) || vallistv.array_len() <= 1){ reset_stack(); push_stack(ComValue::nullval()); return; *************** *** 56,61 **** --- 52,59 ---- ALIterator i; AttributeValueList* avl = vallistv.array_val(); avl->First(i); + int wval = avl->Number(); + int pixelvals[wval]; for (int j=0; j<wval && !avl->Done(i); j++){ pixelvals[j]= avl->GetAttrVal(i)->int_val(); avl->Next(i); *************** *** 80,86 **** else push_stack(ComValue::nullval()); } - //SECIL /*****************************************************************************/ --- 78,83 ---- *************** *** 101,107 **** OverlayRaster* raster = rastrect ? rastrect->GetOriginal() : nil; if (raster) { ! raster->poke(xv.int_val(), yv.int_val(), valv.float_val(), valv.float_val(), valv.float_val(), 1.0); push_stack(rastcompv); } else push_stack(ComValue::nullval()); --- 98,109 ---- OverlayRaster* raster = rastrect ? rastrect->GetOriginal() : nil; if (raster) { ! ColorIntensity r,g,b; ! int pixelcolor = valv.int_val(); ! char colorname[7]; ! sprintf(colorname,"#%06x",pixelcolor); ! Color::find(World::current()->display(),colorname, r, g, b); ! raster->poke(xv.int_val(), yv.int_val(), r, g, b, 1.0); push_stack(rastcompv); } else push_stack(ComValue::nullval()); Index: ComUnidraw/pixelfunc.h diff -c ComUnidraw/pixelfunc.h:1.2 ComUnidraw/pixelfunc.h:1.3 *** ComUnidraw/pixelfunc.h:1.2 Fri Sep 13 12:19:23 2002 --- src/ComUnidraw/pixelfunc.h Wed Sep 18 09:47:37 2002 *************** *** 26,45 **** #include <ComUnidraw/unifunc.h> - //SECIL //: command to poke a line of pixel values into raster ! // pokeline(compview x y w vallist) -- poke pixel values of a line listed in vallist into raster. w is the width of the line(length of the list). class PixelPokeLineFunc : public UnidrawFunc { public: PixelPokeLineFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s(compview x y w vallist) -- poke pixel values of a line listed in vallist into raster. w is the width of the line(length of the list)"; } }; - - //SECIL //: command to poke pixel values into raster // poke(compview x y val) -- poke pixel value into raster --- 26,42 ---- #include <ComUnidraw/unifunc.h> //: command to poke a line of pixel values into raster ! // pokeline(compview x y vallist) -- poke pixel values of a line listed in vallist into raster. class PixelPokeLineFunc : public UnidrawFunc { public: PixelPokeLineFunc(ComTerp*,Editor*); virtual void execute(); virtual const char* docstring() { ! return "%s(compview x y vallist) -- poke list of values into a raster line."; } }; //: command to poke pixel values into raster // poke(compview x y val) -- poke pixel value into raster *** /dev/null Wed Sep 18 09:47:59 PDT 2002 --- patches/ivtools-020918-johnston-067 *************** patches/ivtools-020918-johnston-067 *** 0 **** --- 1 ---- + ivtools-020918-johnston-067 ------------------------------------------------------- This sf.net email is sponsored by: See the NEW Palm Tungsten T handheld. Power & Color in a compact size! http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en