I want to display an SVG image in a GTK DrawingArea without losing quality when scaling. Currently, I am using the following code:
fn build_ui(application: >k::Application) {
let window = gtk::ApplicationWindow::new(application);
window.set_default_size(WIDTH, HEIGHT);
let drawing_area = DrawingArea::new();
window.add(&drawing_area);
let file_data = include_str!("../file.svg").as_bytes();
let loader = PixbufLoader::new();
loader.write(file_data);
loader.close();
let pixbuf = loader.pixbuf().unwrap();
let pixbuf = pixbuf.scale_simple(100, 100, InterpType::Hyper).unwrap();
drawing_area.connect_draw(move |_, cr| {
cr.set_source_pixbuf(&pixbuf, 0.0, 0.0);
cr.paint();
Inhibit(false)
});
window.show_all();
}
The original image size is 50x50 pixels, and I am scaling it to 100x100 pixels, which results in pixelation. This is because Pixbuf works with raster images. How can I work with vector output without losing quality at any scaling?