#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <cairo.h>
#include "mb_types.h"
#include "mb_redraw_man.h"
#include <math.h>
Go to the source code of this file.
Classes | |
struct | _sh_path |
Implement respective objects for SVG path tag. More... | |
Defines | |
#define | RESERVED_AIXS sizeof(co_aix[2]) |
#define | ASSERT(x) |
#define | SKIP_SPACE(x) while(*(x) && (isspace(*(x)) || *(x) == ',')) { (x)++; } |
#define | SKIP_NUM(x) |
#define | OK 0 |
#define | ERR -1 |
#define | PI 3.1415926 |
#define | TAKE_NUM(r) |
#define | INNER(x1, y1, x2, y2) ((x1) * (x2) + (y1) * (y2)) |
#define | CROSS(x1, y1, x2, y2) ((x1) * (y2) - (y1) * (x2)) |
#define | TO_ABSX islower(cmd)? x + atof(old): atof(old) |
#define | TO_ABSY islower(cmd)? y + atof(old): atof(old) |
Typedefs | |
typedef struct _sh_path | sh_path_t |
Implement respective objects for SVG path tag. | |
Functions | |
static int | calc_center_and_x_aix (co_aix x0, co_aix y0, co_aix x, co_aix y, co_aix rx, co_aix ry, co_aix x_rotate, int large, int sweep, co_aix *cx, co_aix *cy, co_aix *xx, co_aix *xy) |
Calculate center of the ellipse of an arc. | |
static int | sh_path_arc_cmd_arg_fill (char cmd, char **cmds_p, const char **data_p, co_aix **args_p, int **fix_args_p) |
void | sh_path_arc_path (cairo_t *cr, const co_aix **args_p, const int **fix_args_p) |
Make path for arcs in a path. | |
static void | sh_path_free (shape_t *shape) |
static int | sh_path_cmd_arg_cnt (char *data, int *cmd_cntp, int *arg_cntp, int *fix_arg_cntp) |
Count number of arguments. | |
static int | sh_path_cmd_arg_fill (char *data, sh_path_t *path) |
shape_t * | rdman_shape_path_new (redraw_man_t *rdman, char *data) |
Create a path from value of 'data' of SVG path. | |
void | sh_path_transform (shape_t *shape) |
Transform a path from user space to device space. | |
static void | sh_path_path (shape_t *shape, cairo_t *cr) |
void | sh_path_draw (shape_t *shape, cairo_t *cr) |
#define ASSERT | ( | x | ) |
Definition at line 29 of file shape_path.c.
#define CROSS | ( | x1, | |||
y1, | |||||
x2, | |||||
y2 | ) | ((x1) * (y2) - (y1) * (x2)) |
Definition at line 220 of file shape_path.c.
#define ERR -1 |
Definition at line 42 of file shape_path.c.
#define INNER | ( | x1, | |||
y1, | |||||
x2, | |||||
y2 | ) | ((x1) * (x2) + (y1) * (y2)) |
Definition at line 219 of file shape_path.c.
#define OK 0 |
Definition at line 41 of file shape_path.c.
#define PI 3.1415926 |
Definition at line 43 of file shape_path.c.
#define RESERVED_AIXS sizeof(co_aix[2]) |
Definition at line 27 of file shape_path.c.
#define SKIP_NUM | ( | x | ) |
Value:
while(*(x) && \ (isdigit(*(x)) || \ *(x) == 'e' || \ *(x) == 'E' || \ *(x) == '-' || \ *(x) == '+' || \ *(x) == '.')) { \ (x)++; \ }
Definition at line 31 of file shape_path.c.
#define SKIP_SPACE | ( | x | ) | while(*(x) && (isspace(*(x)) || *(x) == ',')) { (x)++; } |
Definition at line 30 of file shape_path.c.
#define TAKE_NUM | ( | r | ) |
Value:
do { \ SKIP_SPACE(p); \ old = p; \ SKIP_NUM(p); \ if(p == old) \ return ERR; \ r = atof(old); \ } while(0);
Definition at line 146 of file shape_path.c.
#define TO_ABSX islower(cmd)? x + atof(old): atof(old) |
Definition at line 487 of file shape_path.c.
#define TO_ABSY islower(cmd)? y + atof(old): atof(old) |
Definition at line 488 of file shape_path.c.
Implement respective objects for SVG path tag.
In user_data or dev_data, 0x00 bytes are padding after commands. No commands other than 0x00 can resident after 0x00 itself. It means command processing code can skip commands after a 0x00.
Shapes should check if shape_t::geo is assigned. Once transformation matrics are changed, shape objects should update shape_t::geo if it is assigned.
static int calc_center_and_x_aix | ( | co_aix | x0, | |
co_aix | y0, | |||
co_aix | x, | |||
co_aix | y, | |||
co_aix | rx, | |||
co_aix | ry, | |||
co_aix | x_rotate, | |||
int | large, | |||
int | sweep, | |||
co_aix * | cx, | |||
co_aix * | cy, | |||
co_aix * | xx, | |||
co_aix * | xy | |||
) | [static] |
Calculate center of the ellipse of an arc.
Definition at line 84 of file shape_path.c.
static int sh_path_arc_cmd_arg_fill | ( | char | cmd, | |
char ** | cmds_p, | |||
const char ** | data_p, | |||
co_aix ** | args_p, | |||
int ** | fix_args_p | |||
) | [static] |
Definition at line 155 of file shape_path.c.
void sh_path_arc_path | ( | cairo_t * | cr, | |
const co_aix ** | args_p, | |||
const int ** | fix_args_p | |||
) |
Make path for arcs in a path.
Definition at line 224 of file shape_path.c.
static int sh_path_cmd_arg_cnt | ( | char * | data, | |
int * | cmd_cntp, | |||
int * | arg_cntp, | |||
int * | fix_arg_cntp | |||
) | [static] |
Count number of arguments.
Definition at line 311 of file shape_path.c.
static int sh_path_cmd_arg_fill | ( | char * | data, | |
sh_path_t * | path | |||
) | [static] |
static void sh_path_free | ( | shape_t * | shape | ) | [static] |
Definition at line 300 of file shape_path.c.
static void sh_path_path | ( | shape_t * | shape, | |
cairo_t * | cr | |||
) | [static] |
Definition at line 752 of file shape_path.c.