{"id":21985572,"url":"https://github.com/ickshonpe/bevy_ui_exact_image","last_synced_at":"2025-04-30T08:05:18.966Z","repository":{"id":65616355,"uuid":"595754147","full_name":"ickshonpe/bevy_ui_exact_image","owner":"ickshonpe","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-17T19:21:59.000Z","size":39,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-16T18:29:28.666Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ickshonpe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-31T18:37:48.000Z","updated_at":"2024-04-29T20:44:42.000Z","dependencies_parsed_at":"2024-11-16T18:35:55.856Z","dependency_job_id":null,"html_url":"https://github.com/ickshonpe/bevy_ui_exact_image","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"96e02f9b5b442fe003d61d0a043f59f4f72e88e6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_ui_exact_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_ui_exact_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_ui_exact_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ickshonpe%2Fbevy_ui_exact_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ickshonpe","download_url":"https://codeload.github.com/ickshonpe/bevy_ui_exact_image/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227185421,"owners_count":17744371,"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":[],"created_at":"2024-11-29T18:14:04.153Z","updated_at":"2024-11-29T18:14:05.263Z","avatar_url":"https://github.com/ickshonpe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bevy_ui_exact_image\n[![crates.io](https://img.shields.io/crates/v/bevy_ui_exact_image)](https://crates.io/crates/bevy_ui_exact_image)\n[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/ickshonpe/bevy_ui_exact_image)\n[![crates.io](https://img.shields.io/crates/d/bevy_ui_exact_image)](https://crates.io/crates/bevy_ui_exact_image)\n\n* Force the Bevy UI to draw images in whatever sizes you want.\n* Preserve the aspect ratio of images, regardless of the UI layout.\n* Full support for texture atlas images.\n* Image rotation.\n\n![image](/assets/sizes.png)\n![image](/assets/texture_atlas_example.png)\n![image](/assets/rotation.png)\n\n#\n## Usage\n\nAdd the dependency to your bevy project:\n\n```\ncargo add bevy_ui_exact_image\n```\n\nThen to draw a sized image within a Bevy UI node:\n\n```rust\nuse bevy::prelude::*;\nuse bevy_ui_exact_image::prelude::*;\n\nfn spawn_example(mut commands: Commands, assets: Res\u003cAssetServer\u003e) {\n    commands.spawn(Camera2dBundle::default());\n    commands.spawn((ExactImageBundle {\n        image: ExactImage {\n            texture: assets.load(\"orientation.png\"),\n            // exact images have their own color, independent from the background color.\n            color: Color::WHITE,\n            // force the UI to display the texture at 300 x 200 size\n            size: ExactSize::Exactly(Vec2::new(300., 200.)),\n            // align the image to the bottom edge of the node, in the center.\n            alignment: ImageAlignment::BottomCenter,\n            // use Some(rads) to set rotation\n            rotation: None,\n        },\n        style: Style {\n            size: Size::new(Val::Px(400.0), Val::Px(400.0)),\n            ..Default::default()\n        },\n        /// give the containing node a red color\n        background_color: BackgroundColor(Color::RED),\n        ..Default::default()\n    },));\n}\n\nfn main() {\n    App::new()\n        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))\n        .add_plugin(ExactImagePlugin)\n        .add_startup_system(spawn_example)\n        .run();\n}\n```\n\nResult:\n\n![image](/assets/example.png)\n\n#\n## Examples\n\n```\ncargo --run --example minimal\ncargo --run --example rotation\ncargo --run --example size\ncargo --run --example alignment\n```\n\n## Limitations\n\n* No image flipping. Not possible (or at least not trivial) with a third party implementation atm in Bevy 0.9.\n\n## Notes\n\n* Probably quite a few bugs, I haven't done much testing.\n\n* Name stolen from inodentry's related Bevy issue #7439\n\n    [https://github.com/bevyengine/bevy/issues/7349](https://github.com/bevyengine/bevy/issues/7349)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_ui_exact_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fickshonpe%2Fbevy_ui_exact_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fickshonpe%2Fbevy_ui_exact_image/lists"}