static void RAPHAEL_Rect(double x0, double y0, double x1, double y1, const pGEcontext gc, pDevDesc dev) { DOCDesc *pd = (DOCDesc *) dev->deviceSpecific; DOC_ClipRect(x0, y0, x1, y1, dev); x0 = pd->clippedx0;y0 = pd->clippedy0; x1 = pd->clippedx1;y1 = pd->clippedy1; int idx = get_and_increment_idx(dev); register_element( dev ); double temp; if( y1 < y0 ){ temp = y1; y1 = y0; y0 = temp; } if( x1 < x0 ){ temp = x1; x1 = x0; x0 = temp; } fprintf(pd->dmlFilePointer, "var elt_%d = %s.rect(", idx, pd->objectname ); fprintf(pd->dmlFilePointer, "%.0f,%.0f", x0, y0); fprintf(pd->dmlFilePointer, ",%.0f,%.0f", x1-x0, y1-y0); fputs(");\n", pd->dmlFilePointer ); RAPHAEL_SetLineSpec(dev, gc, idx); RAPHAEL_SetFillColor(dev, gc, idx); fflush(pd->dmlFilePointer); }
static void PPTX_Rect(double x0, double y0, double x1, double y1, const pGEcontext gc, pDevDesc dev) { double tmp; DOCDesc *pd = (DOCDesc *) dev->deviceSpecific; int idx = get_and_increment_idx(dev); if (x0 >= x1) { tmp = x0; x0 = x1; x1 = tmp; } if (y0 >= y1) { tmp = y0; y0 = y1; y1 = tmp; } DOC_ClipRect(x0, y0, x1, y1, dev); x0 = pd->clippedx0;y0 = pd->clippedy0; x1 = pd->clippedx1;y1 = pd->clippedy1; fputs(pptx_elt_tag_start, pd->dmlFilePointer ); if( pd->editable < 1 ) fprintf(pd->dmlFilePointer, "<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Rectangle %d\" />%s</p:nvSpPr>", idx, idx, pptx_lock_properties); else fprintf(pd->dmlFilePointer, "<p:nvSpPr><p:cNvPr id=\"%d\" name=\"Rectangle %d\" />%s</p:nvSpPr>", idx, idx, pptx_unlock_properties); fputs("<p:spPr><a:xfrm>", pd->dmlFilePointer ); fprintf(pd->dmlFilePointer, "<a:off x=\"%.0f\" y=\"%.0f\"/>", p2e_(pd->offx + x0), p2e_(pd->offy + y0)); fprintf(pd->dmlFilePointer, "<a:ext cx=\"%.0f\" cy=\"%.0f\"/>", p2e_(x1 - x0), p2e_(y1 - y0)); fputs("</a:xfrm><a:prstGeom prst=\"rect\"><a:avLst /></a:prstGeom>", pd->dmlFilePointer ); DML_SetFillColor(dev, gc); DML_SetLineSpec(dev, gc); fputs("</p:spPr>", pd->dmlFilePointer ); fputs("<p:txBody><a:bodyPr /><a:lstStyle /><a:p/></p:txBody>", pd->dmlFilePointer ); fputs(pptx_elt_tag_end, pd->dmlFilePointer ); // fprintf(pd->dmlFilePointer, "\n"); fflush(pd->dmlFilePointer); }