{"id":28962557,"url":"https://github.com/connorpower/geoms","last_synced_at":"2025-10-30T02:19:36.502Z","repository":{"id":64497772,"uuid":"576180016","full_name":"connorpower/geoms","owner":"connorpower","description":"Optimized geometry primitives for Microsoft platforms with the same memory layout as DirectX and Direct2D and types.","archived":false,"fork":false,"pushed_at":"2022-12-10T09:09:51.000Z","size":674,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T10:11:38.000Z","etag":null,"topics":["direct2d","geometry","win32"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/connorpower.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":"2022-12-09T07:36:31.000Z","updated_at":"2022-12-11T22:07:34.000Z","dependencies_parsed_at":"2022-12-27T20:21:29.856Z","dependency_job_id":null,"html_url":"https://github.com/connorpower/geoms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/connorpower/geoms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorpower%2Fgeoms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorpower%2Fgeoms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorpower%2Fgeoms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorpower%2Fgeoms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/connorpower","download_url":"https://codeload.github.com/connorpower/geoms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/connorpower%2Fgeoms/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281731792,"owners_count":26551847,"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","status":"online","status_checked_at":"2025-10-30T02:00:06.501Z","response_time":61,"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":["direct2d","geometry","win32"],"created_at":"2025-06-24T03:07:51.766Z","updated_at":"2025-10-30T02:19:36.468Z","avatar_url":"https://github.com/connorpower.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# geoms\r\n\r\n[![Documentation][docs-badge]][docs-url]\r\n[![MIT licensed][mit-badge]][mit-url]\r\n[![Build Status][actions-badge]][actions-url]\r\n\r\nGeometry for Microsoft platforms - a set of geometry primitives with memory\r\nlayouts optimized for native APIs ([Win32][], [Direct2D][], and [Direct3D][]).\r\n\r\nThe goal of this crate is to provide an idiomatic but zero-cost interface to\r\ncommon geometric types used in Microsoft graphics APIs. Integration with the\r\nexcellent [`::num_traits`][] crate allows for geometric types to be represented\r\nby\r\n arbitrary numeric types, and allows conversion between different numeric\r\nrepresentations of entire higher-level types.\r\n\r\n[→ Documentation][docs-main-url]\r\n\r\n## Optional Features\r\n\r\n- If _feature_ `\"d2d\"` is enabled, then some primitives can be directly\r\nconverted into [Direct2D][] structures.\r\n- If _feature_ `\"win32\"` is enabled, then some primitives can be directly\r\nconverted into [Win32][] structures.\r\n\r\n## Usage\r\n\r\nTo use `geoms`, add the following to your `Cargo.toml`:\r\n\r\n```toml\r\n[dependencies]\r\ngeoms = \"0.0.1\"\r\n```\r\n\r\nTo enable optional conversions to native Microsoft types, activate the\r\nappropriate features. E.g. for [Direct2D][] support:\r\n\r\n```toml\r\n[dependencies]\r\ngeoms = { version = \"0.0.1\", features = [\"d2d\"] }\r\n```\r\n\r\n### Example\r\n\r\n```rust\r\nuse ::geoms::d2::{Rect2D, Point2D, Size2D};\r\nuse ::windows::Win32::Graphics::Direct2D::Common::D2D_RECT_F;\r\n\r\n// Construct our Rust rectangle, 100x20 pixels at point 10,10\r\nlet rect = Rect2D::with_size_and_origin(\r\n    Size2D { width: 100.0, height: 20.0 },\r\n    Point2D { x: 10.0, y: 10.0 },\r\n);\r\n\r\n// Convert our Rust rectangle into a Direct2D rectangle. This merely\r\n// transmutes under the hood as the memory layouts are the same.\r\nlet d2d_rect: D2D_RECT_F = rect.into();\r\n\r\n// Confirm our Direct2D rectangle has the expected properties.\r\nassert_eq!(rect.left, 10.0);\r\nassert_eq!(rect.right, 110.0);\r\n\r\n// Cast our entire rect to a u32 representation of the same primitive:\r\nlet u_rect = rect.cast::\u003cu32\u003e();\r\nassert_eq!(u_rect.left, 10);\r\nassert_eq!(u_rect.right, 110);\r\n\r\n```\r\n\r\n## Current Status\r\n\r\nOnly a small number of primitives have been implemented as required for personal\r\nprojects. The API is unstable and expected to change.\r\n\r\n## License\r\n\r\nThis project is licensed under the [MIT license][mit-url]\r\n\r\n### Contribution\r\n\r\nUnless you explicitly state otherwise, any contribution intentionally submitted\r\nfor inclusion in this repository by you, shall be licensed as MIT, without any\r\nadditional terms or conditions.\r\n\r\n\r\n[docs-main-url]: http://connorpower.com/geoms/\r\n[docs-url]: https://docs.rs/geoms\r\n[docs-badge]: https://docs.rs/geoms/badge.svg\r\n[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg\r\n[mit-url]: https://github.com/connorpower/geoms/blob/main/LICENSE\r\n[actions-url]: https://github.com/connorpower/geoms/actions?query=workflow%3ACI\r\n[actions-badge]: https://github.com/connorpower/geoms/workflows/CI/badge.svg\r\n[Direct2D]: https://learn.microsoft.com/en-us/windows/win32/direct2d/direct2d-overview\r\n[Direct3D]: https://learn.microsoft.com/en-us/windows/win32/getting-started-with-direct3d\r\n[Win32]: https://learn.microsoft.com/en-us/windows/win32/\r\n[`::num_traits`]: https://crates.io/crates/num-traits\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnorpower%2Fgeoms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconnorpower%2Fgeoms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconnorpower%2Fgeoms/lists"}