{"id":15481451,"url":"https://github.com/fwcd/swift-graphics","last_synced_at":"2025-04-14T09:42:39.073Z","repository":{"id":55109544,"uuid":"299728697","full_name":"fwcd/swift-graphics","owner":"fwcd","description":"Cross-platform 2D graphics library for Swift","archived":false,"fork":false,"pushed_at":"2024-09-29T20:58:36.000Z","size":76,"stargazers_count":27,"open_issues_count":6,"forks_count":6,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-10T15:23:50.617Z","etag":null,"topics":["cairo","graphics","hacktoberfest","linux","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/fwcd.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-29T20:18:19.000Z","updated_at":"2024-12-31T01:03:22.000Z","dependencies_parsed_at":"2023-02-01T01:16:23.912Z","dependency_job_id":"8247e73c-4a65-491d-bd45-90ca8a93c6d7","html_url":"https://github.com/fwcd/swift-graphics","commit_stats":{"total_commits":75,"total_committers":5,"mean_commits":15.0,"dds":0.3466666666666667,"last_synced_commit":"d761f1856b3e6f9472d4d06db9bce9106f0650ca"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fswift-graphics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fswift-graphics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fswift-graphics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fwcd%2Fswift-graphics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fwcd","download_url":"https://codeload.github.com/fwcd/swift-graphics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248855962,"owners_count":21172673,"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","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":["cairo","graphics","hacktoberfest","linux","swift"],"created_at":"2024-10-02T05:04:29.785Z","updated_at":"2025-04-14T09:42:39.046Z","avatar_url":"https://github.com/fwcd.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift Graphics\n\n[![Build](https://github.com/fwcd/swift-graphics/actions/workflows/build.yml/badge.svg)](https://github.com/fwcd/swift-graphics/actions/workflows/build.yml)\n\n2D drawing library for Swift with multiple backends, currently including\n\n- Cairo (cross-platform)\n- Core Graphics (Apple platforms)\n\n## Example\n\n```swift\nimport PlatformGraphics\nimport Utils\n\n// Create a new image and a graphics context\nlet ctx = try PlatformGraphicsContext(width: 300, height: 300)\n\n// Draw some shapes\nctx.draw(line: LineSegment(fromX: 20, y: 20, toX: 50, y: 30))\nctx.draw(rect: Rectangle(fromX: 80, y: 90, width: 10, height: 40, color: Colors.yellow))\nctx.draw(text: Text(\"Test\", at: Vec2(x: 0, y: 15)))\nctx.draw(ellipse: Ellipse(centerX: 150, y: 80, radius: 40))\nctx.draw(polygon: Polygon(points: [\n    Vec2(x: 210.0, y: 150.0),\n    Vec2(x: 100.0, y: 200.0),\n    Vec2(x: 170.0, y: 250.0)\n], isFilled: false))\n\n// Encode the image to a byte buffer\nlet image = try ctx.makeImage()\nlet data = try image.pngEncoded()\n```\n\nThe full example can be found in [`Snippets/DrawShapes.swift`](Snippets/DrawShapes.swift). To run it, invoke\n\n```sh\nswift run DrawShapes Output/shapes.png\n```\n\nThe resulting PNG will be written to `Output/shapes.png`.\n\n## System Dependencies\n\n* Swift 5.7+\n* For the Cairo backend (required on Linux, optional on macOS):\n    * Debian: `apt-get install libcairo2-dev`\n    * macOS: `brew install cairo`\n\n## Building\n\n```sh\nswift build\n```\n\n## Testing\n\n```sh\nswift test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwcd%2Fswift-graphics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffwcd%2Fswift-graphics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffwcd%2Fswift-graphics/lists"}