4 char evalstr[]="Mandlebrot renderer";
6 /* Example Mandlebrot generator */
9 image is the image object.
17 mandel(float x, float y) {
21 /* Z(n+1) = Z(n) ^2 + c */
23 /* printf("(%.2f, %.2f) -> \n", x,y); */
28 while( xo*xo+yo*yo <= 10 && iter < MXITER) {
35 return (iter == MXITER)?0:iter;
40 void mandlebrot(void *INP) {
52 icl[i].rgb.r = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
53 icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
54 icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
63 if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); }
65 fprintf(stderr,"mandlebrot: parameters: (im %p)\n",im);
68 fprintf(stderr, "mandlebrot: image info:\n size (%d,%d)\n channels (%d)\n",
69 im->xsize,im->ysize,im->channels);
78 fprintf(stderr, "Divider: %f \n", div);
79 for(y = 0; y < im->ysize; y ++) {
80 for(x = 0; x < im->xsize; x ++ ) {
81 idx = mandel(x*div-xs , y*div-ys);
82 idx = (idx>255)?255:idx;
83 i_ppix(im,x,y,&icl[idx]);
90 func_ptr function_list[]={
94 "callseq => ['image'], \
95 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,0,\\%hsh); } \
101 /* Remember to double backslash backslashes within Double quotes in C */