1
- use egui:: ColorImage ;
2
-
3
1
#[ cfg( feature = "svg" ) ]
4
2
use egui:: SizeHint ;
5
3
@@ -13,7 +11,7 @@ use egui::SizeHint;
13
11
/// # Errors
14
12
/// On invalid image or unsupported image format.
15
13
#[ cfg( feature = "image" ) ]
16
- pub fn load_image_bytes ( image_bytes : & [ u8 ] ) -> Result < ColorImage , egui:: load:: LoadError > {
14
+ pub fn load_image_bytes ( image_bytes : & [ u8 ] ) -> Result < egui :: ColorImage , egui:: load:: LoadError > {
17
15
profiling:: function_scope!( ) ;
18
16
let image = image:: load_from_memory ( image_bytes) . map_err ( |err| match err {
19
17
image:: ImageError :: Unsupported ( err) => match err. kind ( ) {
@@ -33,7 +31,10 @@ pub fn load_image_bytes(image_bytes: &[u8]) -> Result<ColorImage, egui::load::Lo
33
31
// TODO(emilk): if this is a PNG, looks for DPI info to calculate the source size,
34
32
// e.g. for screenshots taken on a high-DPI/retina display.
35
33
36
- Ok ( ColorImage :: from_rgba_unmultiplied ( size, pixels. as_slice ( ) ) )
34
+ Ok ( egui:: ColorImage :: from_rgba_unmultiplied (
35
+ size,
36
+ pixels. as_slice ( ) ,
37
+ ) )
37
38
}
38
39
39
40
/// Load an SVG and rasterize it into an egui image.
@@ -46,7 +47,7 @@ pub fn load_image_bytes(image_bytes: &[u8]) -> Result<ColorImage, egui::load::Lo
46
47
pub fn load_svg_bytes (
47
48
svg_bytes : & [ u8 ] ,
48
49
options : & resvg:: usvg:: Options < ' _ > ,
49
- ) -> Result < ColorImage , String > {
50
+ ) -> Result < egui :: ColorImage , String > {
50
51
load_svg_bytes_with_size ( svg_bytes, Default :: default ( ) , options)
51
52
}
52
53
@@ -61,7 +62,7 @@ pub fn load_svg_bytes_with_size(
61
62
svg_bytes : & [ u8 ] ,
62
63
size_hint : SizeHint ,
63
64
options : & resvg:: usvg:: Options < ' _ > ,
64
- ) -> Result < ColorImage , String > {
65
+ ) -> Result < egui :: ColorImage , String > {
65
66
use egui:: Vec2 ;
66
67
use resvg:: {
67
68
tiny_skia:: Pixmap ,
@@ -109,7 +110,7 @@ pub fn load_svg_bytes_with_size(
109
110
& mut pixmap. as_mut ( ) ,
110
111
) ;
111
112
112
- let image = ColorImage :: from_rgba_premultiplied ( [ w as _ , h as _ ] , pixmap. data ( ) )
113
+ let image = egui :: ColorImage :: from_rgba_premultiplied ( [ w as _ , h as _ ] , pixmap. data ( ) )
113
114
. with_source_size ( source_size) ;
114
115
115
116
Ok ( image)
0 commit comments