{"_id":"@bun-win32/d2d1","_rev":"4-4ff01c5801355e14ac5f2efb6a06e544","name":"@bun-win32/d2d1","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/d2d1","version":"1.0.0","keywords":["bun","ffi","win32","windows","d2d1","direct2d","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/d2d1@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"8365be903bfe97ee67141a214a5751d86dc4a0f4","tarball":"https://registry.npmjs.org/@bun-win32/d2d1/-/d2d1-1.0.0.tgz","fileCount":6,"integrity":"sha512-iVJTXyxGz4IME+fj/LP25LdfDPGDc8Vt8GC9/rI76dKsy1aAZF1u94vvj67Tk1FVI+5jyYMjEZdseQNVLDMOVg==","signatures":[{"sig":"MEUCIQCe8u/pHk6jcu/gYzZ1ZMsvefpZ15M/hVaQvHaqKGZ2twIgfTRH7glPDKPWvFn6380uzcMCx3imL093hPHJY9EyUQY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16469},"main":"./index.ts","type":"module","module":"index.ts","shasum":"8365be903bfe97ee67141a214a5751d86dc4a0f4","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:d2d1-factory-probe":"bun ./example/d2d1-factory-probe.ts","example:d2d1-matrix-engine":"bun ./example/d2d1-matrix-engine.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-iVJTXyxGz4IME+fj/LP25LdfDPGDc8Vt8GC9/rI76dKsy1aAZF1u94vvj67Tk1FVI+5jyYMjEZdseQNVLDMOVg==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/d2d1"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 D2D1 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/d2d1_1.0.0_1779073005759_0.750161655203065","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/d2d1","version":"1.0.1","keywords":["bun","ffi","win32","windows","d2d1","direct2d","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/d2d1@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"63ed2de08e3c91f9e6f40ce66ec1a54b3db1e3c9","tarball":"https://registry.npmjs.org/@bun-win32/d2d1/-/d2d1-1.0.1.tgz","fileCount":6,"integrity":"sha512-ZcV29MRaQ/QuDn+BEl1Q530AI4GGGjtdnDYiKYwIEcvDnlJqqyX8hFuqDFk3JYV0SqhLoGzjkP1wI89vnNBy2g==","signatures":[{"sig":"MEUCIG5ThTNnRH/zoKhVQ/bILeo4Ylynz9BQrDqeWQRhrZ0sAiEArdmDvNNfqeIkTqz2uU7ZSw1lnUS8VTUnsfeA/v1hLt0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16474},"main":"./index.ts","type":"module","module":"index.ts","shasum":"63ed2de08e3c91f9e6f40ce66ec1a54b3db1e3c9","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:d2d1-factory-probe":"bun ./example/d2d1-factory-probe.ts","example:d2d1-matrix-engine":"bun ./example/d2d1-matrix-engine.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-ZcV29MRaQ/QuDn+BEl1Q530AI4GGGjtdnDYiKYwIEcvDnlJqqyX8hFuqDFk3JYV0SqhLoGzjkP1wI89vnNBy2g==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/d2d1"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 D2D1 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/d2d1_1.0.1_1781130807912_0.05070975783515985","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/d2d1","version":"2.0.0","keywords":["bun","ffi","win32","windows","d2d1","direct2d","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/d2d1@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"418658be47fe0320513e3e2e5e5c47b1e27d63d4","tarball":"https://registry.npmjs.org/@bun-win32/d2d1/-/d2d1-2.0.0.tgz","fileCount":6,"integrity":"sha512-kZMkNm1l3NYorf9hfZpNJdm2pcPiSXo5b1MZMo3vpVsh3u+XReI3YcXiyg3MSu9PpYlDFABr8VpzpN0jjHjdAA==","signatures":[{"sig":"MEUCIQDYrwVmk6Jz/rvSlRMSLhxke5QWq0C06sGsmvZ9hKcKbwIgTKTHmk0tvKCKff/0tuPJk8JdSB5wmXarfjEdrgvirGg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17847},"main":"./index.ts","type":"module","module":"index.ts","shasum":"418658be47fe0320513e3e2e5e5c47b1e27d63d4","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:d2d1-factory-probe":"bun ./example/d2d1-factory-probe.ts","example:d2d1-matrix-engine":"bun ./example/d2d1-matrix-engine.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-kZMkNm1l3NYorf9hfZpNJdm2pcPiSXo5b1MZMo3vpVsh3u+XReI3YcXiyg3MSu9PpYlDFABr8VpzpN0jjHjdAA==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/d2d1"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 D2D1 bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/d2d1_2.0.0_1782435286466_0.6336962754613236","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 D2D1 bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/d2d1","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/d2d1"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","d2d1","direct2d","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:d2d1-matrix-engine":"bun ./example/d2d1-matrix-engine.ts","example:d2d1-factory-probe":"bun ./example/d2d1-factory-probe.ts"},"_id":"@bun-win32/d2d1@2.0.1","_integrity":"sha512-/zicV5g16n/YLK++VOEBmmgc+zYtgIpIdNIKp38haKaMtwjIcecgNG/7N7snCgmtVCxFVWtG2GYQZ6LgpU9Nxw==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"cb451816d38d6e33ebe900900f49491e14a51edb","dist":{"integrity":"sha512-/zicV5g16n/YLK++VOEBmmgc+zYtgIpIdNIKp38haKaMtwjIcecgNG/7N7snCgmtVCxFVWtG2GYQZ6LgpU9Nxw==","shasum":"cb451816d38d6e33ebe900900f49491e14a51edb","tarball":"https://registry.npmjs.org/@bun-win32/d2d1/-/d2d1-2.0.1.tgz","fileCount":6,"unpackedSize":17847,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDq4VfTbc/tJXSCvjmJgybdXwMQs2SO5BfuIxWzIRyGywIhALm05qxS3jRxfVv2wIZd6ei/G994HpY/qUz4cQzR34rj"}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/d2d1_2.0.1_1782437744753_0.9450342273229102"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-18T02:56:45.575Z","modified":"2026-06-26T01:35:44.982Z","1.0.0":"2026-05-18T02:56:45.888Z","1.0.1":"2026-06-10T22:33:28.117Z","2.0.0":"2026-06-26T00:54:46.624Z","2.0.1":"2026-06-26T01:35:44.877Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","d2d1","direct2d","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/d2d1"},"description":"Zero-dependency, zero-overhead Win32 D2D1 bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/d2d1\n\nZero-dependency, zero-overhead Win32 D2D1 bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/d2d1` exposes the `d2d1.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `D2D1`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\n`d2d1.dll` exports only thirteen flat C functions: the factory/device entry points (`D2D1CreateFactory`, `D2D1CreateDevice`, `D2D1CreateDeviceContext`) and Direct2D's native transform/color math (`D2D1MakeRotateMatrix`, `D2D1MakeSkewMatrix`, `D2D1InvertMatrix`, `D2D1IsMatrixInvertible`, `D2D1ComputeMaximumScaleFactor`, `D2D1ConvertColorSpace`, `D2D1SinCos`, `D2D1Tan`, `D2D1Vec3Length`, `D2D1GetGradientMeshInteriorPointsFromCoonsPatch`). The rest of Direct2D — render targets, brushes, geometry, drawing — is reached through the COM vtable of the `ID2D1Factory` returned by `D2D1CreateFactory`.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `d2d1.dll` (Direct2D — GPU-accelerated 2D: factory/device creation plus the native matrix, color-space, and gradient-mesh math).\n- In-source docs in `structs/D2D1.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`D2D1.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/D2D1.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later\n\n## Installation\n\n```sh\nbun add @bun-win32/d2d1\n```\n\n## Quick Start\n\n```ts\nimport D2D1, { D2D1_FACTORY_TYPE } from '@bun-win32/d2d1';\n\n// IID_ID2D1Factory = 06152247-6f50-465a-9245-118bfd3b6007\nconst iid = Buffer.from([\n  0x47, 0x22, 0x15, 0x06, 0x50, 0x6f, 0x5a, 0x46,\n  0x92, 0x45, 0x11, 0x8b, 0xfd, 0x3b, 0x60, 0x07,\n]);\nconst ppFactory = Buffer.alloc(8);\n\nconst hr = D2D1.D2D1CreateFactory(D2D1_FACTORY_TYPE.D2D1_FACTORY_TYPE_SINGLE_THREADED, iid.ptr, null, ppFactory.ptr);\nif (hr !== 0) throw new Error(`D2D1CreateFactory failed: 0x${(hr >>> 0).toString(16)}`);\n\nconst factory = ppFactory.readBigUInt64LE(0);\nconsole.log(`ID2D1Factory @ 0x${factory.toString(16)}`);\n// ... walk ID2D1Factory::CreateWicBitmapRenderTarget / GetDesktopDpi / Release via the COM vtable.\n\n// Direct2D's native transform engine — no COM required:\nconst matrix = Buffer.alloc(24); // D2D1_MATRIX_3X2_F = 6 floats\nD2D1.D2D1MakeRotateMatrix(45, 0n, matrix.ptr); // rotate 45° about the origin\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\n# Real-time animated 3D wireframe driven entirely by Direct2D's native matrix/color math\nbun run example:d2d1-matrix-engine\n\n# Factory creation + DPI probe + exhaustive transform / color-space / Coons-patch report\nbun run example:d2d1-factory-probe\n```\n\n## Notes\n\n- Either rely on lazy binding or call `D2D1.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}