]> git.imager.perl.org - imager.git/blob - trans2.c
was sizeof(int *)
[imager.git] / trans2.c
1 #include "image.h"
2 #include "regmach.h"
3
4 /* foo test */
5
6 i_img* i_transform2(int width, int height, int channels,
7                     struct rm_op *ops, int ops_count, 
8                     double *n_regs, int n_regs_count, 
9                     i_color *c_regs, int c_regs_count, 
10                     i_img **in_imgs, int in_imgs_count)
11 {
12   i_img *new_img;
13   int x, y;
14   i_color val;
15   int i;
16   
17   /* since the number of images is variable and the image numbers
18      for getp? are fixed, we can check them here instead of in the 
19      register machine - this will help performance */
20   for (i = 0; i < ops_count; ++i) {
21     switch (ops[i].code) {
22     case rbc_getp1:
23     case rbc_getp2:
24     case rbc_getp3:
25       if (ops[i].code - rbc_getp1 + 1 > in_imgs_count) {
26         /* Foo */
27         return NULL;
28       }
29     }
30   }
31
32   new_img = i_img_empty_ch(NULL, width, height, channels);
33   for (x = 0; x < width; ++x) {
34     for (y = 0; y < height; ++y) {
35       n_regs[0] = x;
36       n_regs[1] = y;
37       val = rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count, 
38                    in_imgs, in_imgs_count);
39       i_ppix(new_img, x, y, &val);
40     }
41   }
42   
43   return new_img;
44 }