comparison src/shape_path.c @ 1370:bae104d8d247

Add clone functions for shape types
author Thinker K.F. Li <thinker@codemud.net>
date Sat, 05 Mar 2011 22:00:16 +0800
parents 9f2b5a1a0d84
children
comparison
equal deleted inserted replaced
1369:9ad74b29e011 1370:bae104d8d247
1202 rdman_man_shape(rdman, (shape_t *)path); 1202 rdman_man_shape(rdman, (shape_t *)path);
1203 1203
1204 return (shape_t *)path; 1204 return (shape_t *)path;
1205 } 1205 }
1206 1206
1207 shape_t *
1208 rdman_shape_path_clone(redraw_man_t *rdman, const shape_t *_src_path) {
1209 const sh_path_t *src_path = (const sh_path_t *)_src_path;
1210 sh_path_t *new_path;
1211 char *udata;
1212 char *cmds;
1213 co_aix *pnts, *float_args;
1214
1215 udata = src_path->user_data;
1216 cmds = udata;
1217 pnts = (co_aix *)(udata + src_path->cmd_len);
1218 float_args = pnts + src_path->pnt_len;
1219 new_path =
1220 (sh_path_t *)rdman_shape_path_new_from_binary(rdman,
1221 cmds,
1222 pnts, src_path->pnt_len,
1223 float_args,
1224 src_path->float_arg_len);
1225 if(new_path == NULL)
1226 return NULL;
1227
1228 sh_copy_style(rdman, (shape_t *)src_path, (shape_t *)new_path);
1229
1230 return (shape_t *)new_path;
1231 }
1232
1207 1233
1208 /*! \brief Transform a path from user space to device space. 1234 /*! \brief Transform a path from user space to device space.
1209 * 1235 *
1210 */ 1236 */
1211 void sh_path_transform(shape_t *shape) { 1237 void sh_path_transform(shape_t *shape) {