|
@@ -167,6 +167,24 @@ void _cmSvgSize( cmSvg_t* p, double* widthRef, double* heightRef )
|
167
|
167
|
*heightRef = max_y - min_y;
|
168
|
168
|
}
|
169
|
169
|
|
|
170
|
+void _cmSvgWriterFlipY( cmSvg_t* p, unsigned height )
|
|
171
|
+{
|
|
172
|
+ cmSvgEle_t* e = p->elist;
|
|
173
|
+ for(; e!=NULL; e=e->link)
|
|
174
|
+ {
|
|
175
|
+ e->y0 = (-e->y0) + height;
|
|
176
|
+ e->y1 = (-e->y1) + height;
|
|
177
|
+
|
|
178
|
+ if( e->id == kRectSvgId )
|
|
179
|
+ {
|
|
180
|
+ double t = e->y1;
|
|
181
|
+ e->y1 = e->y0;
|
|
182
|
+ e->y0 = t;
|
|
183
|
+ }
|
|
184
|
+
|
|
185
|
+ }
|
|
186
|
+}
|
|
187
|
+
|
170
|
188
|
|
171
|
189
|
cmSvgRC_t cmSvgWriterWrite( cmSvgH_t h, const cmChar_t* cssFn, const cmChar_t* outFn )
|
172
|
190
|
{
|
|
@@ -178,6 +196,8 @@ cmSvgRC_t cmSvgWriterWrite( cmSvgH_t h, const cmChar_t* cssFn, const cmChar_t*
|
178
|
196
|
cmFileH_t fH = cmFileNullHandle;
|
179
|
197
|
|
180
|
198
|
_cmSvgSize(p, &svgWidth, &svgHeight );
|
|
199
|
+
|
|
200
|
+ _cmSvgWriterFlipY( p, svgHeight );
|
181
|
201
|
|
182
|
202
|
if( cmFileOpen(&fH,outFn,kWriteFileFl,p->err.rpt) != kOkFileRC )
|
183
|
203
|
return cmErrMsg(&p->err,kFileFailSvgRC,"SVG file create failed for '%s'.",cmStringNullGuard(outFn));
|