{"id":25931283,"url":"https://github.com/merlinz01/pyd2d","last_synced_at":"2026-05-11T15:35:17.665Z","repository":{"id":279834587,"uuid":"939736915","full_name":"merlinz01/pyd2d","owner":"merlinz01","description":"A Python wrapper for the Windows Direct2D API","archived":false,"fork":false,"pushed_at":"2025-11-03T22:52:34.000Z","size":150,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-03T23:22:59.015Z","etag":null,"topics":["cython-wrapper","direct2d","directwrite","python","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","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/merlinz01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-27T02:52:53.000Z","updated_at":"2025-11-03T22:52:37.000Z","dependencies_parsed_at":"2025-02-28T01:08:50.910Z","dependency_job_id":"683ec457-c6eb-4fde-b9da-c087d113974a","html_url":"https://github.com/merlinz01/pyd2d","commit_stats":null,"previous_names":["merlinz01/pyd2d"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/merlinz01/pyd2d","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fpyd2d","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fpyd2d/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fpyd2d/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fpyd2d/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merlinz01","download_url":"https://codeload.github.com/merlinz01/pyd2d/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merlinz01%2Fpyd2d/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32901844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"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":["cython-wrapper","direct2d","directwrite","python","windows"],"created_at":"2025-03-03T23:58:47.044Z","updated_at":"2026-05-11T15:35:17.660Z","avatar_url":"https://github.com/merlinz01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyD2D: Python + Direct2D\n\nPyD2D is a Python wrapper for the Windows Direct2D and DirectWrite APIs.\n\n## Features\n\n- Direct2D APIs such as RenderTarget, Brush, and Geometry\n- DirectWrite APIs such as TextFormat and TextLayout\n- Supports Python versions from 3.9 to 3.14\n- Supports both 32-bit and 64-bit Python\n- Supports free-threaded Python\n- Zero dependencies, single extension module\n- Full type stubs included\n- Includes many useful integer constants\n- Fully functional demo app, see [demo.py](/demo.py)\n- Permissively licensed\n- Used in production\n\n\u003e Note: Not all of the Direct2D and DirectWrite APIs are wrapped, but the most\n\u003e commonly used ones are. If you need a specific API that is not wrapped, feel\n\u003e free to open an issue or submit a pull request.\n\n## Installation\n\nSimply install the `pyd2d` package from PyPI:\n\n```bash\nuv add pyd2d\n```\n\nor\n\n```bash\npip install pyd2d\n```\n\n## Usage\n\nSee the [demo app](/demo.py) for a working example app using pyD2D and ctypes.\n\nUsage follows the C++/COM API usage directly.\nIn general, pointer-to-struct arguments are passed as keyword arguments for each struct field.\n\nSee the [Direct2D](https://learn.microsoft.com/en-us/windows/win32/direct2d/direct2d-portal)\nand [DirectWrite](https://learn.microsoft.com/en-us/windows/win32/DirectWrite/direct-write-portal)\ndocumentation for more information.\n\nExample:\n\n```python\nimport pyd2d\n\n# Initialize COM\npyd2d.InitializeCOM()\n\n# Create a Direct2D factory\nfactory = pyd2d.GetD2DFactory()\n\n# Create a render target\nrender_target = factory.CreateHwndRenderTarget(\n    my_window_handle, width=800, height=600,\n)\n\n# Draw a rectangle\nrender_target.BeginDraw()\nrender_target.Clear(1.0, 1.0, 1.0, 1.0)\nrender_target.FillRectangle(\n    100, 100, 200, 200,\n    render_target.CreateSolidColorBrush(0.0, 0.0, 0.0, 1.0),\n)\nrender_target.EndDraw()\n\n# Release resources\nrender_target.Release()\nfactory.Release()\npyd2d.UninitializeCOM()\n```\n\n## License\n\nPyD2D is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerlinz01%2Fpyd2d","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerlinz01%2Fpyd2d","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerlinz01%2Fpyd2d/lists"}