From 89700af0b9d4e11988f649b1ca36f7b3e5264dfc Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Tue, 12 Nov 1996 17:52:14 +0100
Subject: [PATCH] ...

Rev: lib/master.pike:1.4
Rev: src/modules/image/blit.c:1.4
Rev: src/modules/image/doc/image.html:1.7
---
 lib/master.pike                  | 9 +++++++--
 src/modules/image/blit.c         | 5 ++++-
 src/modules/image/doc/image.html | 6 ++++++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/lib/master.pike b/lib/master.pike
index 0f3b44e397..c5947dee41 100644
--- a/lib/master.pike
+++ b/lib/master.pike
@@ -24,6 +24,11 @@ void create()
   add_constant("mkmultiset",lambda(mixed *a) { return aggregate_multiset(@a); });
   add_constant("strlen",sizeof);
 
+  add_constant("clone",lambda(program p,mixed ... a) 
+                   	{ return p(@a); } );
+  add_constant("new",lambda(program p,mixed ... a) 
+                   	{ return p(@a); } );
+
   random_seed(time() + (getpid() * 0x11111111));
 }
 
@@ -103,7 +108,7 @@ object cast_to_object(string oname)
 
   if(ret=objects[oname]) return ret;
 
-  return objects[oname]=clone(cast_to_program(oname));
+  return objects[oname]=cast_to_program(oname)();
 }
 
 mapping (string:string) environment=([]);
@@ -136,7 +141,7 @@ void _main(string *argv, string *env)
   add_constant("getenv",getenv);
   add_constant("putenv",putenv);
 
-  add_constant("write",clone(cast_to_program("/precompiled/file"),"stdout")->write);
+  add_constant("write",cast_to_program("/precompiled/file")("stdout")->write);
 
   a=backtrace()[-1][0];
   q=a/"/";
diff --git a/src/modules/image/blit.c b/src/modules/image/blit.c
index 9d33009f0b..8520160028 100644
--- a/src/modules/image/blit.c
+++ b/src/modules/image/blit.c
@@ -213,7 +213,6 @@ void image_paste(INT32 args)
       y1=sp[2-args].u.integer;
    }
    else x1=y1=0;
-   pop_n_elems(args-1);
 
    x2=x1+img->xsize-1;
    y2=y1+img->ysize-1;
@@ -227,6 +226,10 @@ void image_paste(INT32 args)
 	    blitheight,
 	    THIS->xsize,
 	    img->xsize);
+
+   pop_n_elems(args);
+   THISOBJ->refs++;
+   push_object(THISOBJ);
 }
 
 void image_paste_alpha(INT32 args)
diff --git a/src/modules/image/doc/image.html b/src/modules/image/doc/image.html
index 3de2b77bb3..a7f513e221 100644
--- a/src/modules/image/doc/image.html
+++ b/src/modules/image/doc/image.html
@@ -557,4 +557,10 @@ object image->skewx_expand(int diff,rgb);
 object image->skewy_expand(int diff,rgb);
 object image->rotate(int|float angle,rgb);
 object image->rotate_expand(int|float angle,rgb);
+object image->turbulence(colorrange,int octaves=3,float scale=1,
+			 float xdiff=0,float ydiff=0,float cscale=1);
+object image->noise(colorrange,float scale=0.1,
+	 	    float xdiff=0,float ydiff=0,float cscale=1);
+    where colorrange is ({ float position=0..1, ({r,g,b}),
+       			   float position=0..1, ({r,g,b}), ... })
 </pre>
\ No newline at end of file
-- 
GitLab