4 char evalstr[]="Mandlebrot renderer";
6 /* Example Mandlebrot generator */
9 image is the image object.
17 mandel(float x, float y) {
22 /* Z(n+1) = Z(n) ^2 + c */
24 /* printf("(%.2f, %.2f) -> \n", x,y); */
29 while( xo*xo+yo*yo <= 10 && iter < MXITER) {
36 return (iter == MXITER)?0:iter;
41 void mandlebrot(void *INP) {
54 icl[i].rgb.r = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
55 icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
56 icl[i].rgb.g = 100+(int) (155.0*rand()/(RAND_MAX+1.0));
65 if ( !getOBJ("image","Imager::ImgRaw",&im) ) { fprintf(stderr,"Error: image is missing\n"); }
67 fprintf(stderr,"mandlebrot: parameters: (im 0x%x)\n",im);
70 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);
79 fprintf(stderr, "Divider: %f \n", div);
80 for(y = 0; y < im->ysize; y ++) {
81 for(x = 0; x < im->xsize; x ++ ) {
82 idx = mandel(x*div-xs , y*div-ys);
83 idx = (idx>255)?255:idx;
84 i_ppix(im,x,y,&icl[idx]);
91 func_ptr function_list[]={
95 "callseq => ['image'], \
96 callsub => sub { my %hsh=@_; DSO_call($DSO_handle,0,\\%hsh); } \
102 /* Remember to double backslash backslashes within Double quotes in C */