7 trans2.c - entry point for the general transformation engine
11 int width, height, channels;
20 i_img *result = transform2(width, height, channels, ops, ops_count,
21 n_regs, n_regs_count, c_regs, c_regs_count,
22 in_imgs, in_imgs_count);
26 This (short) file implements the transform2() function, just iterating
27 over the image - most of the work is done in L<regmach.c>
32 i_img* i_transform2(int width, int height, int channels,
33 struct rm_op *ops, int ops_count,
34 double *n_regs, int n_regs_count,
35 i_color *c_regs, int c_regs_count,
36 i_img **in_imgs, int in_imgs_count)
46 /* since the number of images is variable and the image numbers
47 for getp? are fixed, we can check them here instead of in the
48 register machine - this will help performance */
50 for (i = 0; i < ops_count; ++i) {
51 switch (ops[i].code) {
55 if (ops[i].code - rbc_getp1 + 1 > need_images) {
56 need_images = ops[i].code - rbc_getp1 + 1;
61 if (need_images > in_imgs_count) {
62 i_push_errorf(0, "not enough images, code requires %d, %d supplied",
63 need_images, in_imgs_count);
67 new_img = i_img_empty_ch(NULL, width, height, channels);
68 for (x = 0; x < width; ++x) {
69 for (y = 0; y < height; ++y) {
72 val = rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count,
73 in_imgs, in_imgs_count);
74 i_ppix(new_img, x, y, &val);
84 Tony Cook <tony@develop-help.com>