Ejemplo n.º 1
0
/*! Adds a rectangle object to pattern (\a p) at the absolute position (\a x,\a y) with a width of (\a w) and a height of (\a h). Positive y is up. Units are in millimeters. */
void embPattern_addRectObjectAbs(EmbPattern* p, double x, double y, double w, double h)
{
    EmbRectObject rectObj = embRectObject_make(x, y, w, h);

    if(!p) { embLog_error("emb-pattern.c embPattern_addRectObjectAbs(), p argument is null\n"); return; }
    if(embRectObjectList_empty(p->rectObjList))
    {
        p->rectObjList = p->lastRectObj = embRectObjectList_create(rectObj);
    }
    else
    {
        p->lastRectObj = embRectObjectList_add(p->lastRectObj, rectObj);
    }
}
Ejemplo n.º 2
0
/* Adds a rectangle at the absolute position (x,y) with a width of (w) and a height of (h). Positive y is up. Units are in millimeters. */
void embPattern_addRectObjectAbs(EmbPattern* p, double x, double y, double w, double h)
{
    EmbRectObject rectObj = embRectObject_make(x, y, w, h);

    if(!p) { embLog_error("emb-pattern.c embPattern_addRectObjectAbs(), p argument is null\n"); return; }
    if(!(p->rectObjList))
    {
        p->rectObjList = (EmbRectObjectList*)malloc(sizeof(EmbRectObjectList));
        if(!p->rectObjList) { embLog_error("emb-pattern.c embPattern_addRectObjectAbs(), cannot allocate memory for p->rectObjList\n"); return; }
        p->rectObjList->rectObj = rectObj;
        p->rectObjList->next = 0;
        p->lastRectObj = p->rectObjList;
    }
    else
    {
        embRectObjectList_add(p->lastRectObj, rectObj);
        p->lastRectObj = p->lastRectObj->next;
    }
}
Ejemplo n.º 3
0
/* Adds a rectangle at the absolute position (x,y) with a width of (w) and a height of (h). Positive y is up. Units are in millimeters. */
void embPattern_addRectObjectAbs(EmbPattern* p, double x, double y, double w, double h)
{
    /* TODO: pointer safety */
    EmbRectObject rectObj = embRectObject_make(x, y, w, h);

    if(!(p->rectObjList))
    {
        p->rectObjList = (EmbRectObjectList*)malloc(sizeof(EmbRectObjectList));
        /* TODO: malloc fail error */
        p->rectObjList->rectObj = rectObj;
        p->rectObjList->next = 0;
        p->lastRectObj = p->rectObjList;
    }
    else
    {
        embRectObjectList_add(p->lastRectObj, rectObj);
        p->lastRectObj = p->lastRectObj->next;
    }
}