Copyright (C) Kevin Larke 2009-2020

This file is part of libcm.

libcm is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

libcm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See the GNU General Public License distributed with the libcm package or look here: .


cmSvgWriter : SVG file writer.


enum
{
  kOkSvgRC = cmOkRC,
  kFileFailSvgRC,
  kPrintFailSvgRC,
  kLHeapFailSvgRC
};

typedef cmRC_t     cmSvgRC_t;
typedef cmHandle_t cmSvgH_t;

extern cmSvgH_t cmSvgNullHandle;

cmSvgRC_t cmSvgWriterAlloc( cmCtx_t* ctx, cmSvgH_t* hp );
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 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 );

// Write the SVG file.  Note that header on this file references the CSS file 'cssFn'
// and the Javascript file svg-pan-zoom.min.js from https://github.com/ariutta/svg-pan-zoom.
// Both the CSS file and svg-pan-zoom.min.js should therefore be in the same directory
// as the output HTML file.
cmSvgRC_t cmSvgWriterWrite( cmSvgH_t h, const cmChar_t* cssFn, const cmChar_t* outFn, bool standaloneFl, bool panZoomFl );