//| Copyright: (C) 2020-2024 Kevin Larke //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file. #ifndef cwSvg_h #define cwSvg_h namespace cw { namespace svg { typedef handle handle_t; enum { kStandardColorMapId, kGrayScaleColorMapId, kInvGrayScaleColorMapId, kHeatColorMapId, kBaseUserColorMapId }; rc_t create( handle_t& h ); rc_t destroy( handle_t& h ); rc_t install_color_map( handle_t h, const unsigned* colorV, unsigned colorN, unsigned colorId=kBaseUserColorMapId ); void offset( handle_t h, double dx, double dy ); unsigned color( handle_t h, unsigned colorMapId, double colorMin, double colorMax, double colorValue ); unsigned color( handle_t h, unsigned colorMapId, unsigned colorIdx ); rc_t _set_attr( handle_t h, const char* selectorStr, const char* attrLabel, const char* value, const char* suffix ); rc_t _set_attr( handle_t h, const char* selectorStr, const char* attrLabel, const unsigned& value, const char* suffix ); rc_t _set_attr( handle_t h, const char* selectorStr, const char* attrLabel, const int& value, const char* suffix ); rc_t _set_attr( handle_t h, const char* selectorStr, const char* attrLabel, const double& value, const char* suffix ); inline rc_t _parse_attr( handle_t h, const char* selectorStr ){ return kOkRC; } template rc_t _parse_attr( handle_t h, const char* selectorStr, const char* attrLabel, const T& val, const char* suffix, ARGS&&... args ) { rc_t rc; if((rc = _set_attr(h, selectorStr, attrLabel, val, suffix)) == kOkRC ) rc =_parse_attr( h, selectorStr, std::forward(args)...); return rc; } // Install a CSS selector record. // Style attributes are encoded as triples "