/*! Adds an ellipse object to pattern (\a p) with its center at the absolute position (\a cx,\a cy) with radii of (\a rx,\a ry). Positive y is up. Units are in millimeters. */ void embPattern_addEllipseObjectAbs(EmbPattern* p, double cx, double cy, double rx, double ry) { EmbEllipseObject ellipseObj = embEllipseObject_make(cx, cy, rx, ry); if(!p) { embLog_error("emb-pattern.c embPattern_addEllipseObjectAbs(), p argument is null\n"); return; } if(embEllipseObjectList_empty(p->ellipseObjList)) { p->ellipseObjList = p->lastEllipseObj = embEllipseObjectList_create(ellipseObj); } else { p->lastEllipseObj = embEllipseObjectList_add(p->lastEllipseObj, ellipseObj); } }
/* Adds an ellipse with its center at the absolute position (cx,cy) with radii of (rx,ry). Positive y is up. Units are in millimeters. */ void embPattern_addEllipseObjectAbs(EmbPattern* p, double cx, double cy, double rx, double ry) { EmbEllipseObject ellipseObj = embEllipseObject_make(cx, cy, rx, ry); if(!p) { embLog_error("emb-pattern.c embPattern_addEllipseObjectAbs(), p argument is null\n"); return; } if(!(p->ellipseObjList)) { p->ellipseObjList = (EmbEllipseObjectList*)malloc(sizeof(EmbEllipseObjectList)); if(!p->ellipseObjList) { embLog_error("emb-pattern.c embPattern_addEllipseObjectAbs(), cannot allocate memory for p->ellipseObjList\n"); return; } p->ellipseObjList->ellipseObj = ellipseObj; p->ellipseObjList->next = 0; p->lastEllipseObj = p->ellipseObjList; } else { embEllipseObjectList_add(p->lastEllipseObj, ellipseObj); p->lastEllipseObj = p->lastEllipseObj->next; } }
/* Adds an ellipse with its center at the absolute position (cx,cy) with radii of (rx,ry). Positive y is up. Units are in millimeters. */ void embPattern_addEllipseObjectAbs(EmbPattern* p, double cx, double cy, double rx, double ry) { /* TODO: pointer safety */ EmbEllipseObject ellipseObj = embEllipseObject_make(cx, cy, rx, ry); if(!(p->ellipseObjList)) { p->ellipseObjList = (EmbEllipseObjectList*)malloc(sizeof(EmbEllipseObjectList)); /* TODO: malloc fail error */ p->ellipseObjList->ellipseObj = ellipseObj; p->ellipseObjList->next = 0; p->lastEllipseObj = p->ellipseObjList; } else { embEllipseObjectList_add(p->lastEllipseObj, ellipseObj); p->lastEllipseObj = p->lastEllipseObj->next; } }