]> git.imager.perl.org - imager.git/blobdiff - dynfilt/mandelbrot.c
avoid ignoring the result of i_io_getc()
[imager.git] / dynfilt / mandelbrot.c
index fdab28ecebd591054fabd1d65eeccfe4f44576e0..a323d31a5d5ba3508ab0de8ea06bf58049454f54 100644 (file)
@@ -1,5 +1,5 @@
 #include "pluginst.h"
-
+#include <stdlib.h>
 
 char evalstr[]="Mandlebrot renderer";
 
@@ -14,9 +14,9 @@ char evalstr[]="Mandlebrot renderer";
 
 static
 int
-mandel(float x, float y) {
-  float xn, yn;
-  float xo, yo;
+mandel(double x, double y) {
+  double xn, yn;
+  double xo, yo;
   int iter = 1;
   /*   Z(n+1) = Z(n) ^2 + c */
 
@@ -40,33 +40,33 @@ mandel(float x, float y) {
 void mandlebrot(void *INP) {
 
   i_img *im;
-  i_color vl;
-  int i,bytes,x,y;
+  int i;
+  i_img_dim x,y;
   int idx;
   
-  float xs, ys;
-  float div;
+  double xs, ys;
+  double div;
 
   i_color icl[256];
   srand(12235);
   for(i=1;i<256; i++) {
-    icl[i].rgb.r = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
-    icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
-    icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
+    icl[i].rgb.r = 100+(int) (156.0*rand()/(RAND_MAX+1.0));
+    icl[i].rgb.g = 100+(int) (156.0*rand()/(RAND_MAX+1.0));
+    icl[i].rgb.b = 100+(int) (156.0*rand()/(RAND_MAX+1.0));
   }
 
   icl[0].rgb.r = 0;
   icl[0].rgb.g = 0;
-  icl[0].rgb.g = 0;
+  icl[0].rgb.b = 0;
     
 
   
   if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); }
   
   fprintf(stderr,"mandlebrot: parameters: (im %p)\n",im);
-  bytes=im->bytes;
 
-  fprintf(stderr, "mandlebrot: image info:\n size (%d,%d)\n channels (%d)\n channel mask (%d)\n bytes (%d)\n",im->xsize,im->ysize,im->channels,im->ch_mask,im->bytes); 
+  fprintf(stderr, "mandlebrot: image info:\n size (" i_DFp ")\n channels (%d)\n",
+         i_DFcp(im->xsize,im->ysize),im->channels); 
   div = 2.5;
 
   xs = 0.8*div;