egui_skia
egui_skia copied to clipboard
broken ColorTest with cpu rendering
While tracking down rendering errors, I found that color rendering is broken with cpu rendering (cpu_fix
).
Here's a code snippet to render ColorTest.
use egui_skia::rasterize;
use skia_safe::{EncodedImageFormat, Paint, Point};
use std::fs::File;
use std::io::Write;
pub fn main() {
let mut demo = egui_demo_lib::ColorTest::default();
let mut surface = rasterize(
(800, 2000),
|ctx| {
egui::CentralPanel::default().show(ctx, |ui| {
demo.ui(ui);
});
},
None,
);
let data = surface
.image_snapshot()
.encode_to_data(EncodedImageFormat::PNG)
.expect("Failed to encode image");
File::create("output.png")
.unwrap()
.write_all(&data)
.unwrap();
println!("wrote output.png");
}
This is cpu-rendered image, generate from a code above, which shows errors.
Here's a side-by-side screenshot, comparing cpu-rendered with webgl one (from https://egui.rs)