{"id":15048984,"url":"https://github.com/jerr-it/canvas","last_synced_at":"2025-08-14T19:20:44.041Z","repository":{"id":115923898,"uuid":"267344011","full_name":"jerr-it/canvas","owner":"jerr-it","description":"Render images and videos directly using C","archived":false,"fork":false,"pushed_at":"2021-10-11T21:05:51.000Z","size":1525,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T15:04:59.270Z","etag":null,"topics":["c","c-language","hacktoberfest","netpbm","rendering"],"latest_commit_sha":null,"homepage":"","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/jerr-it.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-05-27T14:38:04.000Z","updated_at":"2024-11-20T06:25:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"85a1bb9b-5fa1-4078-8288-465637d4c7f4","html_url":"https://github.com/jerr-it/canvas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jerr-it/canvas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcanvas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcanvas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcanvas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcanvas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jerr-it","download_url":"https://codeload.github.com/jerr-it/canvas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jerr-it%2Fcanvas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267054917,"owners_count":24028399,"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-07-25T02:00:09.625Z","response_time":70,"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":["c","c-language","hacktoberfest","netpbm","rendering"],"created_at":"2024-09-24T21:17:26.662Z","updated_at":"2025-08-14T19:20:44.025Z","avatar_url":"https://github.com/jerr-it.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCanvas\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Language-C/C++-blue?style=for-the-badge\u0026logo=c%2B%2Bl\" /\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\nLibrary for rendering images and videos directly using C and the NetPBM image format\n\u003c/p\u003e\n\n\u003ch2 align=\"center\"\u003eHow to use\u003c/h2\u003e\n\nCompile repo:\n```\nmake \n./render\n\nor \ng++ -o render main.cpp Artwork/Color.h Artwork/Artwork.h Artwork/Artwork.c\n./render\n```\n\n\u003ch2 align=\"center\"\u003eExamples\u003c/h2\u003e\n\u003ch6 align=\"center\"\u003eCheck main.cpp!\u003c/h6\u003e\n\nInclude header:\n```c\n#include \"Artwork/Artwork.h\"\n```\n\nCreate artwork and set values:\n```c\nArtwork art = newArt(400, 400);\n```\nDont forget to free afterwards to avoid memory leaks!\n```c\nfreeArt(art);\n```\n\nSet color scheme with stroke, fill and stroke width:\n```c\nart.strokeColor = Color { 255, 0, 0 };\nart.strokeWidth = 5;\n\nart.fillColor = Color { 200, 200, 200 };\n```\n\nSet individual pixel\n```c\nsetPixel(art, \u003cx\u003e, \u003cy\u003e, Color {255, 255, 255});\n```\n\nDraw line (color determined by stroke color):\n```c\ndrawLine(art, \u003cx0\u003e, \u003cy0\u003e, \u003cx1\u003e, \u003cy1\u003e);\n```\n\nDraw rect:\n```c\ndrawRect(art, \u003ctop-left x\u003e, \u003ctop-left y\u003e, \u003cwidth\u003e, \u003cheight\u003e);\n```\n\nDraw circle:\n```c\ndrawCircle(art, \u003cx\u003e, \u003cy\u003e, \u003cradius\u003e);\n```\n\nDraw ellipse:\n```c\ndrawEllipse(art, \u003cx\u003e, \u003cy\u003e, \u003cx-radius\u003e, \u003cy-radius\u003e);\n```\n\nClear artwork / fill it entirely_\n```c\nclear(art, Color { 0, 0, 0 });\n```\n\nSave as a single image:\n```c\nchar filename[] = \"nicePic.ppm\";\nsaveArt(art, filename);\n```\n\nPipe it out (necessary for video creation):\n```c\npipeArtTo(art, stdout);\n```\n\nPipe it to VLC:\n```\n./ExecutableNameHere | ppmtoy4m -F60:1 | vlc -\n```\n\nOr render the complete video:\n```\n./ExecutableNameHere | ffmpeg -i pipe:0 -c:v libx264rgb VideoName.avi\n```\n\n\u003ch2 align=\"center\"\u003eSFML Tandem\u003c/h2\u003e\n\nThe SFML_Artwork class is essentially a C++ wrapper for the standard rendering. It enables you to create Artworks from sf::Image objects, the entire window for example.\n\n```c\n#include \"SFML_Artwork/SFML_Artwork.h\"\n```\nCreate your window and rendering:\n```c\nRenderWindow window(VideoMode(800, 800), \"Rendering\");\nRendering* rendering = createRendering(800, 800);\n\nTexture texture;\nImage image;\nVector2u windowsize;\n```\nSave your window as an image:\n```c\nwindowsize = window.getSize();\ntexture.create(windowsize.x, windowsize.y);\ntexture.update(window);\nimage = texture.copyToImage();\nArtwork art = SFML_Artwork::fromImage(image);\nsaveArt(art);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fcanvas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjerr-it%2Fcanvas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjerr-it%2Fcanvas/lists"}