Skip to main content

A Python wrapper for the Windows Direct2D and DirectWrite APIs

Project description

pyD2D - A Python wrapper for the Windows Direct2D API

pyD2D is a Python wrapper for the Windows Direct2D and DirectWrite APIs.

Not all of the Direct2D and DirectWrite APIs are wrapped, but the most commonly used ones are. If you need a specific API that is not wrapped, feel free to open an issue or submit a pull request.

Installation

pip install pyd2d

Usage

import pyd2d

# Initialize COM
pyd2d.InitializeCOM()

# Create a Direct2D factory
factory = pyd2d.GetD2DFactory()

# Create a render target
render_target = factory.CreateHwndRenderTarget(
    my_hwnd, width=800, height=600,
)

# Draw a rectangle
render_target.BeginDraw()
render_target.Clear(1.0, 1.0, 1.0, 1.0)
render_target.FillRectangle(100, 100, 200, 200, render_target.CreateSolidColorBrush(0.0, 0.0, 0.0, 1.0))
render_target.EndDraw()

License

pyD2D is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyd2d-0.1.2.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyd2d-0.1.2-cp313-cp313-win32.whl (105.2 kB view details)

Uploaded CPython 3.13Windows x86

File details

Details for the file pyd2d-0.1.2.tar.gz.

File metadata

  • Download URL: pyd2d-0.1.2.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyd2d-0.1.2.tar.gz
Algorithm Hash digest
SHA256 37ce664a55237d18e181d538d0c7064f0b0743cbf64131a870a24bac9f06b7e9
MD5 8c621c6ce818359b415e6a876a9f6b5b
BLAKE2b-256 c43b2f9b0a95a22c7f28b21ec034f289b2095d196d58d20fe0da214509cd6a43

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.2.tar.gz:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyd2d-0.1.2-cp313-cp313-win32.whl.

File metadata

  • Download URL: pyd2d-0.1.2-cp313-cp313-win32.whl
  • Upload date:
  • Size: 105.2 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pyd2d-0.1.2-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d6cb995f07c1c2bc5bdc0827a78870dec768bf4b2325fa217e49610601c931ea
MD5 4529259ca9b9e35e53fb69d5faf0a307
BLAKE2b-256 b9e195d7b60897c7cfb3776c70633b653619b41ce7fc8f029e24ffffd5a1da41

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyd2d-0.1.2-cp313-cp313-win32.whl:

Publisher: publish.yml on merlinz01/pyd2d

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page