1
Fork 0

Implement basic rich presence

This commit is contained in:
prescientmoon 2024-09-24 22:49:09 +02:00
parent 5186c7e8b8
commit 68c46fb7cd
Signed by: prescientmoon
SSH key fingerprint: SHA256:WFp/cO76nbarETAoQcQXuV+0h7XJsEsOCI0UsyPIy6U
26 changed files with 1061 additions and 267 deletions
src/arcaea

View file

@ -26,6 +26,7 @@ pub struct ImageVec {
impl ImageVec {
// {{{ (Image => vector) encoding
#[allow(clippy::identity_op)]
pub fn from_image(image: &impl GenericImageView<Pixel = Rgba<u8>>) -> Self {
let mut colors = [0.0; IMAGE_VEC_DIM];
let chunk_width = image.width() / SPLIT_FACTOR;
@ -55,7 +56,6 @@ impl ImageVec {
let r = (r as f64 / count).sqrt();
let g = (g as f64 / count).sqrt();
let b = (b as f64 / count).sqrt();
#[allow(clippy::identity_op)]
colors[i as usize * 3 + 0] = r as f32;
colors[i as usize * 3 + 1] = g as f32;
colors[i as usize * 3 + 2] = b as f32;