1
0
Fork 0
forked from wry/wry

egui: add integration

This commit is contained in:
Julian Orth 2026-02-22 00:26:52 +01:00
parent 85b9b7222d
commit 008e8a671a
49 changed files with 4110 additions and 149 deletions

View file

@ -0,0 +1,37 @@
use {
crate::{
cmm::cmm_eotf::Eotf,
theme::{Color, Oklab, Oklch},
},
egui::{Color32, Rgba},
};
#[expect(dead_code)]
pub trait Color32Ext {
fn to_oklab(self) -> Oklab;
fn to_oklch(self) -> Oklch;
}
impl Color32Ext for Color32 {
fn to_oklab(self) -> Oklab {
let [r, g, b, a] = self.to_array();
Color::from_srgba_premultiplied(r, g, b, a).srgb_to_oklab()
}
fn to_oklch(self) -> Oklch {
self.to_oklab().to_oklch()
}
}
impl Into<Color32> for Oklch {
fn into(self) -> Color32 {
self.to_oklab().into()
}
}
impl Into<Color32> for Oklab {
fn into(self) -> Color32 {
let [r, g, b, a] = self.to_srgb().to_array(Eotf::Linear);
Rgba::from_rgba_premultiplied(r, g, b, a).into()
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

BIN
src/egui_adapter/icons.ttf Normal file

Binary file not shown.

View file

@ -0,0 +1,13 @@
#version 450
layout(location = 0) in vec4 color;
layout(location = 1) in vec2 pos;
layout(binding = 0, set = 0) uniform sampler2D tex;
layout(location = 0) out vec4 res;
void main() {
vec4 src = texture(tex, pos);
res = color * src;
}

View file

@ -0,0 +1,19 @@
#version 450
layout(location = 0) in vec2 if_pos;
layout(location = 1) in vec2 it_pos;
layout(location = 2) in vec4 i_color;
layout(location = 0) out vec4 o_color;
layout(location = 1) out vec2 ot_pos;
void main() {
o_color = i_color;
o_color.rgb = mix(
o_color.rgb / vec3(12.92),
pow((o_color.rgb + vec3(0.055)) / vec3(1.055), vec3(2.4)),
greaterThan(o_color.rgb, vec3(0.04045))
);
ot_pos = it_pos;
gl_Position = vec4(if_pos.x, if_pos.y, 0.0, 1.0);
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,2 @@
7eb8fae39ae513bc4f6973c12227aa4aa43734bdf34c90e1b3b69294ad98db87 src/egui_adapter/shaders/shader.frag
501f4d0c5c5f10a371659b89f12d87abb03e5b57a31dbae5f3c6ca5726e4db01 src/egui_adapter/shaders/shader.vert