{"id":19133169,"url":"https://github.com/tversteeg/blit","last_synced_at":"2025-04-06T09:07:57.904Z","repository":{"id":28159373,"uuid":"116514052","full_name":"tversteeg/blit","owner":"tversteeg","description":":space_invader: Blitting library for 2D sprites","archived":false,"fork":false,"pushed_at":"2025-03-19T12:48:03.000Z","size":59590,"stargazers_count":30,"open_issues_count":9,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T07:12:00.879Z","etag":null,"topics":["2d-graphics","2d-sprites","gamedev","rust","sprites"],"latest_commit_sha":null,"homepage":"https://tversteeg.nl/blit/showcase","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tversteeg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2018-01-06T20:39:51.000Z","updated_at":"2024-07-19T23:48:49.000Z","dependencies_parsed_at":"2023-10-14T18:57:33.303Z","dependency_job_id":"f8620559-640e-4056-887f-52fcee1ef83f","html_url":"https://github.com/tversteeg/blit","commit_stats":{"total_commits":243,"total_committers":7,"mean_commits":"34.714285714285715","dds":"0.42798353909465026","last_synced_commit":"1403e12f924af7158350eac621dfbbbe9116961c"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tversteeg%2Fblit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tversteeg%2Fblit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tversteeg%2Fblit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tversteeg%2Fblit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tversteeg","download_url":"https://codeload.github.com/tversteeg/blit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457801,"owners_count":20941906,"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":["2d-graphics","2d-sprites","gamedev","rust","sprites"],"created_at":"2024-11-09T06:21:16.792Z","updated_at":"2025-04-06T09:07:57.887Z","avatar_url":"https://github.com/tversteeg.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blit\n\n[![Build Status](https://github.com/tversteeg/blit/workflows/CI/badge.svg)](https://github.com/tversteeg/blit/actions?workflow=CI)\n[![Crates.io](https://img.shields.io/crates/v/blit.svg)](https://crates.io/crates/blit)\n[![Documentation](https://docs.rs/blit/badge.svg)](https://docs.rs/blit)\n[![License: GPL-3.0](https://img.shields.io/crates/l/blit.svg)](#license)\n[![Downloads](https://img.shields.io/crates/d/blit.svg)](#downloads)\n\n### [Documentation](https://docs.rs/blit/)\n\n\u003c!-- cargo-rdme start --\u003e\n\nDraw sprites quickly using a masking color or an alpha treshold.\n\n#### [Interactive Demo](https://tversteeg.nl/blit/showcase)\n\nThis crate works with RGBA `u32` buffers.\nThe alpha channel can only be read with a singular treshold, converting it to a binary transparent or opaque color.\nThe reason this limitation is in place is that it allows efficient rendering optimizations.\n\nFor ergonomic use of this crate without needing to type convert everything most functions accepting numbers are generic with the number types being [`num_traits::ToPrimitive`], this might seem confusing but any number can be passed to these functions immediately.\n\nWhen using this crate the most important function to know about is [`Blit::blit`], which is implemented for [`BlitBuffer`].\n\n#### Example\n\n```rust\nuse blit::{Blit, ToBlitBuffer, BlitOptions, geom::Size};\n\nconst CANVAS_SIZE: Size = Size { width: 180, height: 180 };\nconst MASK_COLOR: u32 = 0xFF_00_FF;\n// Create a buffer in which we'll draw our image\nlet mut canvas: Vec\u003cu32\u003e = vec![0xFF_FF_FF_FF; CANVAS_SIZE.pixels()];\n\n// Load the image from disk using the `image` crate\nlet img = image::open(\"examples/smiley_rgb.png\").unwrap().into_rgb8();\n\n// Blit by creating a special blitting buffer first where the MASK_COLOR will be the color that will be made transparent\nlet blit_buffer = img.to_blit_buffer_with_mask_color(MASK_COLOR);\n\n// Draw the image 2 times to the buffer\nblit_buffer.blit(\u0026mut canvas, CANVAS_SIZE, \u0026BlitOptions::new_position(10, 10));\nblit_buffer.blit(\u0026mut canvas, CANVAS_SIZE, \u0026BlitOptions::new_position(20, 20));\n```\n\n\u003c!-- cargo-rdme end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftversteeg%2Fblit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftversteeg%2Fblit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftversteeg%2Fblit/lists"}