{"id":16655621,"url":"https://github.com/mtrudel/ex_paint","last_synced_at":"2025-10-30T08:16:43.317Z","repository":{"id":62429241,"uuid":"207567500","full_name":"mtrudel/ex_paint","owner":"mtrudel","description":"A simple 2D rasterizer for Elixir","archived":false,"fork":false,"pushed_at":"2020-07-22T15:31:52.000Z","size":1416,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T00:12:39.253Z","etag":null,"topics":["2d-graphics","bitmap","egd","elixir","fonts","png","rasterizer"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/mtrudel.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}},"created_at":"2019-09-10T13:30:13.000Z","updated_at":"2025-02-18T18:27:34.000Z","dependencies_parsed_at":"2022-11-01T20:01:19.549Z","dependency_job_id":null,"html_url":"https://github.com/mtrudel/ex_paint","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fex_paint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fex_paint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fex_paint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mtrudel%2Fex_paint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mtrudel","download_url":"https://codeload.github.com/mtrudel/ex_paint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248330219,"owners_count":21085664,"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","bitmap","egd","elixir","fonts","png","rasterizer"],"created_at":"2024-10-12T09:53:35.063Z","updated_at":"2025-10-30T08:16:38.276Z","avatar_url":"https://github.com/mtrudel.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExPaint\n\n[![Build Status](https://travis-ci.org/mtrudel/ex_paint.svg?branch=master)](https://travis-ci.org/mtrudel/ex_paint)\n[![Hex.pm](https://img.shields.io/hexpm/v/ex_paint.svg?style=flat-square)](https://hex.pm/packages/ex_paint)\n\nExPaint is a simple 2D rasterizer, based (for now, at least) on the [egd](https://github.com/erlang/egd) library.\nAvailable primitives include lines, rectangles, arcs, polygons, and simple bitmap font support. Dumping of the\nresulting bitmap is supported in a few forms, including a 4-bit greyscale format as used by devices such as [SSD1322\nbased OLED displays](https://github.com/mtrudel/ssd1322).\n\nThe library leans heavily on egd for now, but the eventual intent is to implement an optimized retained mode backing\nstore using something like a piece table of binaries to provide performant compositing / dumping.\n\n## Usage\n\n```elixir\nalias ExPaint.{Font, Color}\n\n{:ok, image} = ExPaint.create(128, 64)\nfont = Font.load(\"Helvetica20\")\n\nExPaint.clear(image)\n\nExPaint.text(image, {10, 30}, font, \"Hello World\", Color.black())\nExPaint.filled_rect(image, {10, 10}, {20,20}, %Color{r: 230, g: 12, b: 34})\nExPaint.filled_ellipse(image, {50, 10}, {20,20}, %Color{r: 12, g: 12, b: 230})\nExPaint.filled_triangle(image, {90, 30}, {100, 10}, {110, 30}, %Color{r: 230, g: 230, b: 34})\n\n# Write to a png\n{:ok, png_data} = ExPaint.render(image, ExPaint.PNGRasterizer)\nFile.write(\"foo.png\", png_data)\n\n# If you're in iTerm, display inline\nExPaint.render(image, ExPaint.InlineRasterizer)\n\n# If you're pairing with https://github.com/mtrudel/ssd1322\n{:ok, four_bit_data} = ExPaint.render(image, ExPaint.FourBitGreyscaleRasterizer)\nSSD1322.draw(session, four_bit_data)\n```\n\nwill render the following image:\n\n![foo](https://user-images.githubusercontent.com/79646/87735987-0378c880-c7a5-11ea-9bbf-168637db7381.png)\n\n\n## Installation\n\nThis package can be installed by adding `ex_paint` and `egd` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_paint, \"~\u003e 0.2.0\"},\n    {:egd, github: \"erlang/egd\"}\n  ]\nend\n```\n\nDocs can be found at [https://hexdocs.pm/ex_paint](https://hexdocs.pm/ex_paint).\n\n## Credits\n\nFor ease of installation, this package includes the contents of [this collection of\nfonts](https://github.com/SteveAlexander/wingsfonts) in the `/priv/fonts/` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtrudel%2Fex_paint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmtrudel%2Fex_paint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmtrudel%2Fex_paint/lists"}