{"id":15282684,"url":"https://github.com/vleue/bevy_ninepatch","last_synced_at":"2025-12-30T05:21:13.373Z","repository":{"id":43924448,"uuid":"445974564","full_name":"vleue/bevy_ninepatch","owner":"vleue","description":"Bevy plugin to displays 9-Patch UI elements","archived":true,"fork":false,"pushed_at":"2023-07-30T01:04:29.000Z","size":2627,"stargazers_count":40,"open_issues_count":4,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-16T21:45:58.025Z","etag":null,"topics":["9patch","bevy","bevy-plugin","hacktoberfest","nine-patch","rust","ui"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vleue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-09T02:22:55.000Z","updated_at":"2024-06-24T18:47:03.000Z","dependencies_parsed_at":"2022-08-29T14:10:40.014Z","dependency_job_id":null,"html_url":"https://github.com/vleue/bevy_ninepatch","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vleue/bevy_ninepatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_ninepatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_ninepatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_ninepatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_ninepatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vleue","download_url":"https://codeload.github.com/vleue/bevy_ninepatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vleue%2Fbevy_ninepatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278703581,"owners_count":26031204,"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-06T02:00:05.630Z","response_time":65,"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":["9patch","bevy","bevy-plugin","hacktoberfest","nine-patch","rust","ui"],"created_at":"2024-09-30T14:36:17.658Z","updated_at":"2025-10-07T00:31:10.821Z","avatar_url":"https://github.com/vleue.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bevy 9-Patch plugin\n\n![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)\n[![Doc](https://docs.rs/bevy_ninepatch/badge.svg)](https://docs.rs/bevy_ninepatch)\n[![Crate](https://img.shields.io/crates/v/bevy_ninepatch.svg)](https://crates.io/crates/bevy_ninepatch)\n[![Bevy Tracking](https://img.shields.io/badge/Bevy%20tracking-main-lightblue)](https://github.com/bevyengine/bevy/blob/main/docs/plugins_guidelines.md#main-branch-tracking)\n[![CI](https://github.com/vleue/bevy_ninepatch/actions/workflows/ci.yaml/badge.svg)](https://github.com/vleue/bevy_ninepatch/actions/workflows/ci.yaml)\n\nImplementation of 9-patch images in Bevy. Let you have a UI that scale only the right parts of your images.\n\n![9 patch example](./result.png)\n\nSee [the examples](https://github.com/vleue/bevy_ninepatch/tree/main/examples) for what can be done.\n\n## Simple usage\n\nAfter adding the `NinePatchPlugin` plugin, spawning an `Entity` with the `NinePatchBundle` component bundle will add a 9-patch UI element.\n\nA simple builder based on Godot's [NinePatchRect](https://docs.godotengine.org/en/3.2/classes/class_ninepatchrect.html) is available.\n\n```rust\nuse bevy::prelude::*;\nuse bevy_ninepatch::*;\n\nfn setup(\n    mut commands: Commands,\n    asset_server: Res\u003cAssetServer\u003e,\n    mut nine_patches: ResMut\u003cAssets\u003cNinePatchBuilder\u003c()\u003e\u003e\u003e,\n) {\n    // Texture for the base image\n    let panel_texture_handle = asset_server.load(\"assets/glassPanel_corners.png\");\n\n    // Create a basic 9-Patch UI element with margins of 20 pixels\n    let nine_patch_handle = nine_patches.add(NinePatchBuilder::by_margins(20, 20, 20, 20));\n\n    // This entity will be placed in the center of the 9-Patch UI element\n    let content_entity = commands.spawn(TextBundle { ..Default::default() }).id();\n\n    commands.spawn(\n        NinePatchBundle {\n            style: Style {\n                margin: UiRect::all(Val::Auto),\n                justify_content: JustifyContent::Center,\n                align_items: AlignItems::Center,\n                size: Size::new(Val::Px(500.), Val::Px(300.)),\n                ..Default::default()\n            },\n            nine_patch_data: NinePatchData::with_single_content(\n                panel_texture_handle,\n                nine_patch_handle,\n                content_entity,\n            ),\n            ..Default::default()\n        },\n    );\n}\n```\n\nSee [plugin.rs example](https://github.com/vleue/bevy_ninepatch/blob/main/examples/plugin.rs) for a complete example.\n\n## Changing element size\n\nThe component `Style` can be changed to update the size of the 9-Patch UI element, by changing the `size` attribute.\n\nSee [change_size.rs example](https://github.com/vleue/bevy_ninepatch/blob/main/examples/change_size.rs) for a complete example.\n\n## Specify content to use\n\nYou can specify the content to be used inside the 9-Patch UI element. When creating a 9-Patch by specifying the margins, a content zone will be available by default for the center of the 9-Patch UI element. This can be set with the `NinePatchContent` component.\n\nSee [multi_content.rs example](https://github.com/vleue/bevy_ninepatch/blob/main/examples/content.rs) for a complete example.\n\n## More flexible definition\n\nIt is possible to set any number of patches for an image, the only constraints is that all patches in a line must have the same height. Using this methods, different parts of the image can grow at different rates, and several content zones can be created.\n\nSee [full.rs example](https://github.com/vleue/bevy_ninepatch/blob/main/examples/full.rs) for a complete example.\n\n## Bevy Compatibility\n\n|Bevy|bevy_ninepatch|\n|---|---|\n|main|main|\n|0.10|0.10|\n|0.9|0.9|\n|0.8|0.8|\n|0.7|0.7|\n|0.6|0.6|\n|0.5|0.5|\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvleue%2Fbevy_ninepatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvleue%2Fbevy_ninepatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvleue%2Fbevy_ninepatch/lists"}