{"id":24076693,"url":"https://github.com/apirogov/sdl2-cairo","last_synced_at":"2025-07-15T11:37:59.364Z","repository":{"id":138158268,"uuid":"43201424","full_name":"apirogov/sdl2-cairo","owner":"apirogov","description":"Haskell library providing functions to use Cairo to draw on SDL textures and containing a Processing-style convenience drawing API.","archived":false,"fork":false,"pushed_at":"2017-08-13T15:30:50.000Z","size":36,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T13:11:04.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","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/apirogov.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":"2015-09-26T10:28:23.000Z","updated_at":"2022-12-27T23:22:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"644c0ec0-d26a-4f86-9471-6f7e437daeea","html_url":"https://github.com/apirogov/sdl2-cairo","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/apirogov%2Fsdl2-cairo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apirogov%2Fsdl2-cairo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apirogov%2Fsdl2-cairo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apirogov%2Fsdl2-cairo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apirogov","download_url":"https://codeload.github.com/apirogov/sdl2-cairo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658622,"owners_count":21622898,"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":[],"created_at":"2025-01-09T20:00:17.731Z","updated_at":"2025-04-30T07:21:39.973Z","avatar_url":"https://github.com/apirogov.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sdl2-cairo [![Hackage version](https://img.shields.io/hackage/v/sdl2-cairo.svg?style=flat)](https://hackage.haskell.org/package/sdl2-cairo) [![Build Status](https://travis-ci.org/apirogov/sdl2-cairo.svg)](https://travis-ci.org/apirogov/sdl2-cairo)\n\nHaskell library providing functions to use Cairo to draw on SDL textures.\n\n**NOTE:**\nThe Processing-style drawing API has been moved to a separate package\n[cairo-canvas](https://github.com/apirogov/cairo-canvas).\n\n##### Install\n\nThis library depends on the new\n[SDL2 bindings](https://github.com/haskell-game/sdl2), available on Hackage as\n[sdl2 version 2.1.0 or greater](http://hackage.haskell.org/package/sdl2)\nand [cairo bindings](https://hackage.haskell.org/package/cairo).\n\nJust clone and install this repository:\n```bash\ngit clone git@github.com:apirogov/sdl2-cairo.git\ncd sdl2-cairo\nstack install\n```\n\nIt should work with recent GHC versions (\u003e= 7.8.4) without problems under Linux und OS X.\n\n##### Documentation\n\nYou can use Cairo with the Render monad on an SDL texture like this:\n\n```haskell\nimport SDL.Cairo\nimport Graphics.Rendering.Cairo\n...\n  texture \u003c- createCairoTexture renderer (V2 800 600)\n  withCairoTexture texture $ do\n    setSourceRGBA 1 0 0\n    lineTo 800 600\n    stroke\n\n  copy renderer texture Nothing Nothing\n  present renderer\n```\n\nIf you are familiar with [Processing](https://processing.org/reference),\nyou can also use this together with the\n[cairo-canvas](https://github.com/apirogov/cairo-canvas) package.\n\n```haskell\nimport SDL.Cairo\nimport Graphics.Rendering.Cairo.Canvas\n...\n  texture \u003c- createCairoTexture renderer (V2 800 600)\n  withCairoTexture' texture $ runCanvas $ do\n    background $ gray 100\n    stroke $ red 255\n    fill $ blue 255 !@ 128\n    rect $ D 0 0 100 100\n    rect $ toD (V2 50 50) (V2 150 150)\n\n  copy renderer texture Nothing Nothing\n  present renderer\n```\n\nFinally, you can of course use this as glue to use [diagrams](http://projects.haskell.org/diagrams/)\nwith SDL with the [Cairo backend](https://hackage.haskell.org/package/diagrams-cairo):\n```haskell\nimport SDL.Cairo\nimport Diagrams.Backend.Cairo\n...\n  let (_,render) = renderDia Cairo (CairoOptions \"\" (mkSizeSpec $ V2 (Just 800) (Just 600))\n                                                 RenderOnly False)\n                                   (myDiagram :: QDiagram Cairo V2 Double Any)\n  withCairoTexture texture render\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapirogov%2Fsdl2-cairo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapirogov%2Fsdl2-cairo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapirogov%2Fsdl2-cairo/lists"}