#include "ninox.h" #define Influence 0.9 double * create_weight_buffer_decrease_lr(int w, int h) { double *ptr,*buf = ZeroMalloc(w * h * sizeof(double)); int x,y,W; W = w * Influence; for(y=0; yL) d=L; return 1.0 - d/L; } double * create_weight_buffer_decrease_tl(int w, int h) { double W,H,M,*ptr,*buf = ZeroMalloc(w * h * sizeof(double)); int x,y,inc; W = w * Influence; H = Influence * h; M = W+H; inc = w-W; ptr=buf; for(y=0; ywidth + x; unsigned char *ptr; if (x<0 || y<0 || x >= img->width || y >= img->height) return 0; if (val<0) val=0; if (val>255) val=255; switch(img->depth) { case 8: ptr = img->data+o; *ptr ^= val; break; case 16: ptr = img->data+o*2; *(ptr++) ^= val; *(ptr++) ^= val; break; case 24: ptr = img->data+o*3; *(ptr++) ^= val; *(ptr++) ^= val; *(ptr++) ^= val; break; } return 1; } int map_control_points(struct morph_point *m, int npoints, struct Image *img) { struct morph_point *pt; int i; Print("Mapping %d control points\n",npoints); for(i=0; iw || pt->h) { //draw_point(img,pt->x,pt->y,0xff); draw_point(img,pt->x+pt->x_offset,pt->y+pt->y_offset,0xff); } } return 1; }