{"id":16162409,"url":"https://github.com/sunsided/rotated-grid","last_synced_at":"2025-04-07T03:48:00.330Z","repository":{"id":177957109,"uuid":"661143157","full_name":"sunsided/rotated-grid","owner":"sunsided","description":"Rotated grid calculations in Rust for CMYK halftone dithering and more","archived":false,"fork":false,"pushed_at":"2024-02-26T11:22:44.000Z","size":130,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-27T10:09:40.288Z","etag":null,"topics":["dithering","dithering-images","halftone","image-processing","poster","print","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/rotated-grid","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunsided.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-07-01T23:28:42.000Z","updated_at":"2023-07-09T18:19:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a4750ec-5369-4501-a0e0-bff4e5aa4dc2","html_url":"https://github.com/sunsided/rotated-grid","commit_stats":null,"previous_names":["sunsided/rotated-grid"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Frotated-grid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Frotated-grid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Frotated-grid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunsided%2Frotated-grid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunsided","download_url":"https://codeload.github.com/sunsided/rotated-grid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589835,"owners_count":20963022,"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":["dithering","dithering-images","halftone","image-processing","poster","print","rust"],"created_at":"2024-10-10T02:30:02.069Z","updated_at":"2025-04-07T03:48:00.308Z","avatar_url":"https://github.com/sunsided.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rotated grids in Rust\n\n🎨 _For halftone dithering and more._\n\n---\n\nThis crate provides a generator for enumerating grid coordinates at a specified frequency along a rotated grid.\nThis can come in useful e.g. when you want to create halftone dithering grids for CMYK processing:\n\n\u003cdiv align=\"center\" style=\"text-align: center\"\u003e\n    \u003cimg src=\"readme/grid.png\" alt=\"CMYK grid examples\" /\u003e\n\u003c/div\u003e\n\nSee e.g. my [opencv-cartoon-effect](https://github.com/sunsided/opencv-cartoon-effect) repo for an almost-real-world \nusage example.\n\n## Usage example\n\n```rust\nuse rotated_grid::{Angle, GridPositionIterator, GridCoordinate};\n\nconst WIDTH: usize = 16;\nconst HEIGHT: usize = 10;\n\nfn main() {\n    let halftone_grids = [\n        (\"Cyan\", 15.0),\n        (\"Magenta\", 75.0),\n        (\"Yellow\", 0.0),\n        (\"Black\", 45.0),\n    ];\n    \n    for (name, angle) in halftone_grids {\n        println!(\"{name} at {angle}°\", name = name, angle = angle);\n    \n        let grid = GridPositionIterator::new(\n            WIDTH as _,\n            HEIGHT as _,\n            7.0,\n            7.0,\n            0.0,\n            0.0,\n            Angle::\u003cf64\u003e::from_degrees(angle),\n        );\n    \n        let (_, expected_max) = grid.size_hint();\n        let mut count = 0;\n    \n        for GridCoordinate { x, y } in grid {\n            println!(\"{x}, {y}\", x = x, y = y);\n            count += 1;\n        }\n    \n        assert!(count \u003c= expected_max.unwrap())\n    }\n}\n```\n\nYou can run the example application using\n\n```shell\ncargo run --package cmyk\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Frotated-grid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunsided%2Frotated-grid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunsided%2Frotated-grid/lists"}