{"id":19338172,"url":"https://github.com/jserv/svgirl","last_synced_at":"2025-08-21T02:06:59.840Z","repository":{"id":146557336,"uuid":"131482131","full_name":"jserv/svgirl","owner":"jserv","description":"SVG Instant Rendering Library with focus on embedded systems","archived":false,"fork":false,"pushed_at":"2024-04-24T07:28:32.000Z","size":375,"stargazers_count":44,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-16T00:50:05.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jserv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-29T09:36:39.000Z","updated_at":"2025-07-27T02:14:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"5915e8fe-b66f-412a-98dd-19c95cda3a14","html_url":"https://github.com/jserv/svgirl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jserv/svgirl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fsvgirl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fsvgirl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fsvgirl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fsvgirl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jserv","download_url":"https://codeload.github.com/jserv/svgirl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jserv%2Fsvgirl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271415496,"owners_count":24755639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:16:33.749Z","updated_at":"2025-08-21T02:06:59.822Z","avatar_url":"https://github.com/jserv.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVGirl\n\n## Overview\n\nSVGirl stands for SVG Instant Rendering Library.\nIt is a library for parsing SVG files into a simplified internal representation suitable for display or manipulation.\nThis library is derived from [libsvgtiny](https://www.netsurf-browser.org/projects/libsvgtiny/) and focuses on minimal dependencies and embedded systems.\n\nThe overall idea of the library is to take SVG files as input and return a list of paths and texts that can be rendered easily.\nThe library does not perform the actual rendering.\n\nAll supported SVG objects, such as circles, lines, and gradient-filled shapes, are converted into flat-filled paths or fragments of text.\nAll coordinates are converted and transformed to pixels.\n\nSVGirl is freely redistributable under the [MIT License](https://opensource.org/license/mit).\n\n## SVG support\n\nSVGirl is initially aiming to implement SVG Tiny, as defined in\n[Scalable Vector Graphics (SVG) Tiny Specification](https://www.w3.org/TR/SVGMobile/).\n\nSVG Tiny elements supported: defs, g, svg, circle, line, path, polygon,\npolyline, rect, text\n\nSVG Tiny elements not yet supported: desc, metadata, title, use, a,\nswitch, ellipse, image, font, font-face, font-face-name, font-face-src,\nglyph, hkern, missing-glyph, animate, animateColor, animateMotion,\nanimateTransform, mpath, set, foreignObject\n\nAdditional elements supported: linearGradient, stop\n\nText support is incomplete: no fonts. linearGradient support is\nincomplete: They parse, but the internal data structure doesn't (yet)\nrepresent the gradient.\n\nThe style attribute is supported.\n\n## Building SVGirl\n\nCompile all sources along with the test programs:\n```shell\n$ make\n```\n\nLaunch test suite:\n```shell\nmake check\n```\n\nBuild reference SVG viewer on X Window System:\n```shell\n$ make bin/display_x11\n```\n\n## Using SVGirl\n\nThe interface is in the header `svgtiny.h`\n```c\n#include \"svgtiny.h\"\n```\n\nFirst create a `svgtiny_diagram` using `svgtiny_create()`:\n```c\nstruct svgtiny_diagram *diagram;\ndiagram = svgtiny_create();\n```\n\nThis will return a pointer to a new diagram, or NULL if there was not enough memory available.\n\nSVGs are parsed from memory using `svgtiny_parse()`:\n```c\nsvgtiny_code code = svgtiny_parse(diagram, buffer, size, url, 1000, 1000);\n```\n\nThe arguments include the pointer returned by `svgtiny_create()`,\na buffer containing the SVG data, the size of the SVG in bytes,\nthe URL from which the SVG was sourced, and the target viewport width and height in pixels.\n\nThe function returns `svgtiny_OK` if there are no problems, and the diagram is updated.\nThe diagram can then be rendered by looping through the array `diagram-\u003eshape[0..diagram-\u003eshape_count]`:\n```c\nfor (unsigned int i = 0; i != diagram-\u003eshape_count; i++) {\n```\n\nPath shapes have a non-`NULL` path pointer.\nThe path consists of an array of floats with a length defined by `path_length`.\nThis array contains segment type codes followed by 0 to 3 pairs of coordinates,\ndepending on the segment type:\n- `svgtiny_PATH_MOVE x y`\n- `svgtiny_PATH_CLOSE`\n- `svgtiny_PATH_LINE x y`\n- `svgtiny_PATH_BEZIER x1 y1 x2 y2 x3 y3`\n\nA path always starts with a `MOVE`.\n\nThe fill and stroke attributes specify the colors of the path,\nor `svgtiny_TRANSPARENT` if the path is neither filled nor stroked.\nColors are in the `0xRRGGBB` format (depending on endianness).\nThe macros `svgtiny_RED`, `svgtiny_GREEN`, and `svgtiny_BLUE` can be used to extract the color components.\n\nThe width of the path is specified in `stroke_width`.\n\nText shapes have a `NULL` path pointer and a non-`NULL` text pointer.\nThe text is in UTF-8.\nThe coordinates for the text are specified in `text_x` and `text_y`.\nText colors and stroke widths are the same as for paths.\n\nIf memory runs out during parsing, `svgtiny_parse()` returns `svgtiny_OUT_OF_MEMORY`.\nHowever, the diagram remains valid up to the point where memory was exhausted and can be safely rendered.\n\nIf there is an error in the SVG (for example, if an element is missing an attribute required by the specification),\n`svgtiny_SVG_ERROR` is returned.\nNevertheless, the diagram is still valid up to the point of the error.\nThe error is recorded in `diagram-\u003eerror_message` and the line that caused it in `diagram-\u003eerror_line`.\n\n`svgtiny_LIBDOM_ERROR` indicates that parsing the XML failed,\nresulting in a diagram that will contain no shapes.\n`svgtiny_NOT_SVG` means that the XML does not contain a top-level `\u003csvg\u003e` element.\n\nTo free memory used by a diagram, use `svgtiny_free()`:\n```c\nsvgtiny_free(diagram);\n```\n\nFor an example, see `examples/svgtiny_display_x11.c`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Fsvgirl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjserv%2Fsvgirl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjserv%2Fsvgirl/lists"}