{"id":13741346,"url":"https://github.com/ziglibs/painterz","last_synced_at":"2025-04-30T23:30:56.638Z","repository":{"id":48666118,"uuid":"280113456","full_name":"ziglibs/painterz","owner":"ziglibs","description":"Low-level implementation of different painting primitives (lines, rectangles, ...) without specialization on a certain draw target","archived":false,"fork":false,"pushed_at":"2024-09-18T11:25:32.000Z","size":24,"stargazers_count":20,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-18T16:10:23.823Z","etag":null,"topics":["2d-graphics","canvas","graphics","painting","zig","zig-package","ziglang"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/ziglibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"MasterQ32"}},"created_at":"2020-07-16T09:35:41.000Z","updated_at":"2024-09-18T11:25:36.000Z","dependencies_parsed_at":"2022-09-14T12:51:37.164Z","dependency_job_id":null,"html_url":"https://github.com/ziglibs/painterz","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fpainterz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fpainterz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fpainterz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziglibs%2Fpainterz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziglibs","download_url":"https://codeload.github.com/ziglibs/painterz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224225071,"owners_count":17276436,"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":["2d-graphics","canvas","graphics","painting","zig","zig-package","ziglang"],"created_at":"2024-08-03T04:00:58.131Z","updated_at":"2024-11-12T06:15:40.214Z","avatar_url":"https://github.com/ziglibs.png","language":"Zig","funding_links":["https://github.com/sponsors/MasterQ32"],"categories":["Libraries"],"sub_categories":[],"readme":"# painterz\n\nThe idea of this library is to provide platform-independent, embedded-feasible implementations of several drawing primitives.\n\nThe library exports a generic `Canvas` type which is specialized on a `setPixel` function that will put pixels of type `Color` onto a `Framebuffer`.\nIt's currently not possible or planned to do blending, but alpha test could be implemented by ignoring certain color values in the `setPixel` function.\n\n## Usage Example\n\n![Usage example rendering](docs/example.png)\n\nSee [`src/example.zig`](src/example.zig) for a full usage example.\n\n```zig\nconst Pixel = packed struct {\n    r: u8, g: u8, b: u8, a: u8\n};\n\nconst Framebuffer = struct {\n    buffer: []Pixel,\n\n    fn setPixel(fb: @This(), x: isize, y: isize, c: Pixel) void {\n        if (x \u003c 0 or y \u003c 0) return;\n        if (x \u003e= 100 or y \u003e= 100) return;\n        fb.buffer[100 * std.math.absCast(y) + std.math.absCast(x)] = c;\n    }\n};\n\nvar canvas = painterz.Canvas(Framebuffer, Pixel, Framebuffer.setPixel).init(Framebuffer{\n    .buffer = …,\n});\n\ncanvas.drawLine(100, 120, 110, 90, Pixel{\n    .r = 0xFF,\n    .g = 0x00,\n    .b = 0xFF,\n    .a = 0xFF,\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fpainterz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziglibs%2Fpainterz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziglibs%2Fpainterz/lists"}