GimpRGB get_image_color (gdouble u, gdouble v, gint *inside) { gint x1, y1, x2, y2; GimpRGB p[4]; pos_to_int (u, v, &x1, &y1); if (mapvals.tiled == TRUE) { *inside = TRUE; if (x1 < 0) x1 = (width-1) - (-x1 % width); else x1 = x1 % width; if (y1 < 0) y1 = (height-1) - (-y1 % height); else y1 = y1 % height; x2 = (x1 + 1) % width; y2 = (y1 + 1) % height; p[0] = peek (x1, y1); p[1] = peek (x2, y1); p[2] = peek (x1, y2); p[3] = peek (x2, y2); return gimp_bilinear_rgba (u * width, v * height, p); } if (checkbounds (x1, y1) == FALSE) { *inside =FALSE; return background; } x2 = (x1 + 1); y2 = (y1 + 1); if (checkbounds (x2, y2) == FALSE) { *inside = TRUE; return peek (x1, y1); } *inside=TRUE; p[0] = peek (x1, y1); p[1] = peek (x2, y1); p[2] = peek (x1, y2); p[3] = peek (x2, y2); return gimp_bilinear_rgba (u * width, v * height, p); }
/* ML type : dbresult_ -> int -> int -> bool */ EXTERNML value db_getisnull(value dbresval, value tupno, value fieldno) { MYSQL_ROW row; checkbounds(dbresval, tupno, fieldno, "db_getisnull"); row = seekandgetrow(dbresval, Long_val(tupno)); if (row == NULL) failwith("db_getisnull"); return Val_bool(row[Long_val(fieldno)]==NULL); }
/* ML type : dbresult_ -> int -> int -> string */ EXTERNML value db_getstring(value dbresval, value tupno, value fieldno) { MYSQL_ROW row; checkbounds(dbresval, tupno, fieldno, "db_getstring"); row = seekandgetrow(dbresval, Long_val(tupno)); if (row == NULL) failwith("db_getint"); return copy_string(row[Long_val(fieldno)]); }
/* ML type : dbresult_ -> int -> int -> real */ EXTERNML value db_getreal(value dbresval, value tupno, value fieldno) { MYSQL_ROW row; checkbounds(dbresval, tupno, fieldno, "db_getreal"); row = seekandgetrow(dbresval, Long_val(tupno)); if (row == NULL) failwith("db_getreal"); return copy_double(atof(row[Long_val(fieldno)])); }
/* ML type : dbresult_ -> int -> int -> int */ EXTERNML value db_getint(value dbresval, value tupno, value fieldno) { MYSQL_ROW row; checkbounds(dbresval, tupno, fieldno, "db_getint"); row = seekandgetrow(dbresval, Long_val(tupno)); if (row == NULL) failwith("db_getint 2"); return Val_long(atoi(row[Long_val(fieldno)])); }
/* ML type : pgresult_ -> int -> int -> bool */ EXTERNML value pq_getbool(value pgresval, value tupno, value fieldno) { char* v; checkbounds(pgresval, tupno, fieldno, "pq_getbool"); v = PQgetvalue(PGresult_val(pgresval), Long_val(tupno), Long_val(fieldno)); if (v == NULL) failwith("pq_getbool"); return Val_bool(!strcmp(v, "t")); }
/* ML type : pgresult_ -> int -> int -> string */ EXTERNML value pq_getstring(value pgresval, value tupno, value fieldno) { char* v; checkbounds(pgresval, tupno, fieldno, "pq_getstring"); v = PQgetvalue(PGresult_val(pgresval), Long_val(tupno), Long_val(fieldno)); if (v == NULL) failwith("pq_getstring"); return copy_string(v); }
/* ML type : pgresult_ -> int -> int -> int */ EXTERNML value pq_getint(value pgresval, value tupno, value fieldno) { char* v; checkbounds(pgresval, tupno, fieldno, "pq_getint"); v = PQgetvalue(PGresult_val(pgresval), Long_val(tupno), Long_val(fieldno)); if (v == NULL) failwith("pq_getint"); return Val_long(atoi(v)); }
/* ML type : pgresult_ -> int -> int -> real */ value pq_getreal(value pgresval, value tupno, value fieldno) { char* v; checkbounds(pgresval, tupno, fieldno, "pq_getreal"); v = PQgetvalue(PGresult_val(pgresval), Long_val(tupno), Long_val(fieldno)); if (v == NULL) failwith("pq_getreal"); return copy_double(atof(v)); }
int update(void) { int y; int pix_offset = 0; int maxheight; maxheight = checkbounds(); for (y=0; y < maxheight; y++){ pix_offset = (0+Ox*BPP) + ((Oy+y) * finfo.line_length); waitforvsync(); memcpy(fbp+pix_offset, tmp_buf+pix_offset, width4); } return 0; }
int clearbuffer(char *buffy) { /* * utility function * either clear buffer * or framebuffer */ int c = 0; int y; int pix_offset = 0; int maxheight; maxheight = checkbounds(); for (y=0; y < maxheight; y++){ pix_offset = (0+Ox*BPP) + ((Oy+y) * finfo.line_length); memset(buffy+pix_offset, c, finfo.line_length); } //update(); return 0; }
/* ML type : pgresult_ -> int -> int -> bool */ EXTERNML value pq_getisnull(value pgresval, value tupno, value fieldno) { checkbounds(pgresval, tupno, fieldno, "pq_getisnull"); return Val_bool(PQgetisnull(PGresult_val(pgresval), Long_val(tupno), Long_val(fieldno))); }