cmSvgWriter.c : Added _cmSgWriterFlipY().
This commit is contained in:
parent
be6dc19ade
commit
bd1d645e81
@ -167,6 +167,24 @@ void _cmSvgSize( cmSvg_t* p, double* widthRef, double* heightRef )
|
||||
*heightRef = max_y - min_y;
|
||||
}
|
||||
|
||||
void _cmSvgWriterFlipY( cmSvg_t* p, unsigned height )
|
||||
{
|
||||
cmSvgEle_t* e = p->elist;
|
||||
for(; e!=NULL; e=e->link)
|
||||
{
|
||||
e->y0 = (-e->y0) + height;
|
||||
e->y1 = (-e->y1) + height;
|
||||
|
||||
if( e->id == kRectSvgId )
|
||||
{
|
||||
double t = e->y1;
|
||||
e->y1 = e->y0;
|
||||
e->y0 = t;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cmSvgRC_t cmSvgWriterWrite( cmSvgH_t h, const cmChar_t* cssFn, const cmChar_t* outFn )
|
||||
{
|
||||
@ -179,6 +197,8 @@ cmSvgRC_t cmSvgWriterWrite( cmSvgH_t h, const cmChar_t* cssFn, const cmChar_t*
|
||||
|
||||
_cmSvgSize(p, &svgWidth, &svgHeight );
|
||||
|
||||
_cmSvgWriterFlipY( p, svgHeight );
|
||||
|
||||
if( cmFileOpen(&fH,outFn,kWriteFileFl,p->err.rpt) != kOkFileRC )
|
||||
return cmErrMsg(&p->err,kFileFailSvgRC,"SVG file create failed for '%s'.",cmStringNullGuard(outFn));
|
||||
|
||||
|
@ -21,7 +21,7 @@ enum
|
||||
cmSvgRC_t cmSvgWriterFree( cmSvgH_t* hp );
|
||||
bool cmSvgWriterIsValid( cmSvgH_t h );
|
||||
|
||||
cmSvgRC_t cmSvgWriterRect( cmSvgH_t h, double x, double y, double ww, double hh, const cmChar_t* cssClassLabel );
|
||||
cmSvgRC_t cmSvgWriterRect( cmSvgH_t h, double x, double y, double ww, double hh, const cmChar_t* cssClassLabel );
|
||||
cmSvgRC_t cmSvgWriterLine( cmSvgH_t h, double x0, double y0, double x1, double y1, const cmChar_t* cssClassLabel );
|
||||
cmSvgRC_t cmSvgWriterText( cmSvgH_t h, double x, double y, const cmChar_t* text, const cmChar_t* cssClassLabel );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user