Lines Matching refs:arg

111 color_of(const char *arg)  in color_of()  argument
117 if (strcmp(colors[icolor].name, arg) == 0) in color_of()
121 fprintf(stderr, "genpng: invalid color %s\n", arg); in color_of()
126 width_of(const char *arg) in width_of() argument
128 if (strcmp(arg, "filled") == 0) in width_of()
134 double w = strtod(arg, &ep); in width_of()
140 fprintf(stderr, "genpng: invalid line width %s\n", arg); in width_of()
145 coordinate_of(const char *arg) in coordinate_of() argument
148 double w = strtod(arg, &ep); in coordinate_of()
153 fprintf(stderr, "genpng: invalid coordinate value %s\n", arg); in coordinate_of()
157 struct arg; /* forward declaration */
159 typedef int (*shape_fn_ptr)(const struct arg *arg, double x, double y);
173 struct arg struct
294 alpha_calc(const struct arg *arg, double x, double y) in alpha_calc() argument
300 switch (arg->check_fn(arg, x, y)) in alpha_calc()
327 if (wx != 0 && arg->inside_fn(arg, x+dx/16, y+dy/16)) in alpha_calc()
365 inside_square_filled(const struct arg *arg, double x, double y) in inside_square_filled() argument
367 return square_check(x, y, arg->x1, arg->y1, arg->x2, arg->y2); in inside_square_filled()
371 square_check_line(const struct arg *arg, double x, double y, double w) in square_check_line() argument
385 double cx = (arg->x1+arg->x2)/2; in square_check_line()
386 double wx = fabs(arg->x1-arg->x2)/2; in square_check_line()
387 double cy = (arg->y1+arg->y2)/2; in square_check_line()
388 double wy = fabs(arg->y1-arg->y2)/2; in square_check_line()
407 check_square_filled(const struct arg *arg, double x, double y) in check_square_filled() argument
414 return square_check_line(arg, x, y, FILTER_WIDTH); in check_square_filled()
418 inside_square(const struct arg *arg, double x, double y) in inside_square() argument
423 return square_check_line(arg, x, y, arg->width/2) == 0; in inside_square()
427 check_square(const struct arg *arg, double x, double y) in check_square() argument
431 double w = arg->width/2; in check_square()
433 if (square_check_line(arg, x, y, w+FILTER_WIDTH) == 0) in check_square()
440 if (w > 0 && square_check_line(arg, x, y, w) == 0) in check_square()
482 inside_circle_filled(const struct arg *arg, double x, double y) in inside_circle_filled() argument
484 return circle_check(x, y, arg->x1, arg->y1, arg->x2, arg->y2); in inside_circle_filled()
488 circle_check_line(const struct arg *arg, double x, double y, double w) in circle_check_line() argument
494 double cx = (arg->x1+arg->x2)/2; in circle_check_line()
495 double wx = fabs(arg->x1-arg->x2)/2; in circle_check_line()
496 double cy = (arg->y1+arg->y2)/2; in circle_check_line()
497 double wy = fabs(arg->y1-arg->y2)/2; in circle_check_line()
516 check_circle_filled(const struct arg *arg, double x, double y) in check_circle_filled() argument
518 return circle_check_line(arg, x, y, FILTER_WIDTH); in check_circle_filled()
522 inside_circle(const struct arg *arg, double x, double y) in inside_circle() argument
524 return circle_check_line(arg, x, y, arg->width/2) == 0; in inside_circle()
528 check_circle(const struct arg *arg, double x, double y) in check_circle() argument
531 double w = arg->width/2; in check_circle()
533 if (circle_check_line(arg, x, y, w+FILTER_WIDTH) == 0) in check_circle()
537 if (w > 0 && circle_check_line(arg, x, y, w) == 0) in check_circle()
600 inside_line(const struct arg *arg, double x, double y) in inside_line() argument
602 return line_check(x, y, arg->x1, arg->y1, arg->x2, arg->y2, arg->width/2, 0); in inside_line()
606 check_line(const struct arg *arg, double x, double y) in check_line() argument
611 if (line_check(x, y, arg->x1, arg->y1, arg->x2, arg->y2, arg->width/2, in check_line()
617 if (arg->width > 2*FILTER_WIDTH && in check_line()
618 line_check(x, y, arg->x1, arg->y1, arg->x2, arg->y2, arg->width/2, in check_line()
653 shape_of(const char *arg, double width, int f) in shape_of() argument
657 for (i=0; i<shape_count; ++i) if (strcmp(shape_defs[i].name, arg) == 0) in shape_of()
665 width == 0 ? "filled" : "unfilled", arg); in shape_of()
669 fprintf(stderr, "genpng: %s: not a valid shape name\n", arg); in shape_of()
674 parse_arg(struct arg *arg, const char **argv/*7 arguments*/) in parse_arg() argument
677 arg->color = color_of(argv[0]); in parse_arg()
678 arg->width = width_of(argv[1]); in parse_arg()
679 arg->inside_fn = shape_of(argv[2], arg->width, FN_INSIDE); in parse_arg()
680 arg->check_fn = shape_of(argv[2], arg->width, FN_CHECK); in parse_arg()
681 arg->x1 = coordinate_of(argv[3]); in parse_arg()
682 arg->y1 = coordinate_of(argv[4]); in parse_arg()
683 arg->x2 = coordinate_of(argv[5]); in parse_arg()
684 arg->y2 = coordinate_of(argv[6]); in parse_arg()
702 pixel(png_uint_16p p, struct arg *args, int nargs, double x, double y) in pixel()
761 struct arg arg_list[max_shapes]; in main()