@@ -39,7 +39,7 @@ pub use sys::{
39
39
ImGuiTreeNodeFlags , ImGuiWindowFlags , ImTextureID , ImVec2 , ImVec4 ,
40
40
} ;
41
41
use texture:: TextureCache ;
42
- pub use texture:: { AnyTexture , FromImTexture , ImTexture , IntoImTexture } ;
42
+ pub use texture:: { AnyTexture , FromImTexture , ImTexture } ;
43
43
pub use trees:: { CollapsingHeader , TreeNode } ;
44
44
pub use window:: Window ;
45
45
pub use window_draw_list:: { ChannelsSplit , ImColor , WindowDrawList } ;
@@ -178,29 +178,29 @@ impl ImGui {
178
178
}
179
179
}
180
180
/// Register font texture returned by closure to [`ImGui`] instance.
181
- pub fn register_font_texture < ' a , F , T , U , E > ( & mut self , f : F ) -> Result < AnyTexture , E >
181
+ pub fn register_font_texture < ' a , F , T , E > ( & mut self , f : F ) -> Result < AnyTexture , E >
182
182
where
183
183
F : FnOnce ( FontTextureHandle < ' a > ) -> Result < T , E > ,
184
- U : ' static + IntoImTexture < T > + ImTexture ,
184
+ T : ' static + ImTexture ,
185
185
{
186
186
let io = self . io ( ) ;
187
187
let mut pixels: * mut c_uchar = ptr:: null_mut ( ) ;
188
188
let mut width: c_int = 0 ;
189
189
let mut height: c_int = 0 ;
190
190
let mut bytes_per_pixel: c_int = 0 ;
191
- let texture: U = unsafe {
191
+ let texture = unsafe {
192
192
sys:: ImFontAtlas_GetTexDataAsRGBA32 (
193
193
io. fonts ,
194
194
& mut pixels,
195
195
& mut width,
196
196
& mut height,
197
197
& mut bytes_per_pixel,
198
198
) ;
199
- IntoImTexture :: into_texture ( f ( FontTextureHandle {
199
+ f ( FontTextureHandle {
200
200
width : width as u32 ,
201
201
height : height as u32 ,
202
202
pixels : slice:: from_raw_parts ( pixels, ( width * height * bytes_per_pixel) as usize ) ,
203
- } ) ?)
203
+ } ) ?
204
204
} ;
205
205
self . textures . register_texture ( im_str ! ( "#FONT" ) , texture) ;
206
206
Ok ( self . textures . get_texture ( im_str ! ( "#FONT" ) ) . unwrap ( ) )
@@ -1425,13 +1425,13 @@ impl<'ui> Ui<'ui> {
1425
1425
/// extern crate imgui_glium_renderer;
1426
1426
///
1427
1427
/// use imgui::*;
1428
- /// use glium::Texture2d ;
1428
+ /// use imgui_glium_renderer::Texture ;
1429
1429
/// use glium::backend::Facade;
1430
1430
///
1431
1431
/// fn make_a_texture<F: Facade>(ui: &Ui, facade: &F, data: Vec<Vec<(u8, u8, u8, u8)>>) {
1432
- /// let texture_handle = ui.replace_texture::<_, imgui_glium_renderer::Texture> (
1432
+ /// let texture_handle = ui.replace_texture(
1433
1433
/// im_str!("#Texture Name ID"),
1434
- /// Texture2d::new (facade, data).unwrap(),
1434
+ /// Texture::from_data (facade, data).unwrap(),
1435
1435
/// );
1436
1436
/// ui.image(&texture_handle, [100.0, 100.0]).build();
1437
1437
/// }
@@ -1687,29 +1687,29 @@ impl<'ui> Ui<'ui> {
1687
1687
/// extern crate imgui_glium_renderer;
1688
1688
///
1689
1689
/// use imgui::*;
1690
- /// use glium::Texture2d ;
1690
+ /// use imgui_glium_renderer::Texture ;
1691
1691
/// use glium::backend::Facade;
1692
+ /// use glium::Texture2d;
1692
1693
///
1693
1694
/// fn make_a_texture<F: Facade>(ui: &Ui, facade: &F) {
1694
- /// let texture_handle = ui.make_texture::<_, _, imgui_glium_renderer::Texture> (im_str!("#Texture Name ID"), || {
1695
- /// Texture2d::empty(facade, 100, 100).unwrap()
1695
+ /// let texture_handle = ui.make_texture(im_str!("#Texture Name ID"), || {
1696
+ /// Texture::from_texture_2d( Texture2d::empty(facade, 100, 100).unwrap() )
1696
1697
/// });
1697
1698
/// // ... Do something with `texture_handle`
1698
1699
/// }
1699
1700
///
1700
1701
/// # fn main() {}
1701
1702
/// ```
1702
- pub fn make_texture < F , T , U > ( & self , name : & ImStr , f : F ) -> AnyTexture
1703
+ pub fn make_texture < F , T > ( & self , name : & ImStr , f : F ) -> AnyTexture
1703
1704
where
1704
1705
F : FnOnce ( ) -> T ,
1705
- U : ' static + IntoImTexture < T > + ImTexture ,
1706
+ T : ' static + ImTexture ,
1706
1707
{
1707
1708
let imgui = self . imgui ( ) ;
1708
1709
if let Some ( texture) = imgui. textures . get_texture ( name) {
1709
1710
texture
1710
1711
} else {
1711
- let texture: U = IntoImTexture :: into_texture ( f ( ) ) ;
1712
- imgui. textures . register_texture ( name, texture) ;
1712
+ imgui. textures . register_texture ( name, f ( ) ) ;
1713
1713
imgui. textures . get_texture ( name) . unwrap ( )
1714
1714
}
1715
1715
}
@@ -1730,26 +1730,25 @@ impl<'ui> Ui<'ui> {
1730
1730
/// extern crate imgui_glium_renderer;
1731
1731
///
1732
1732
/// use imgui::*;
1733
- /// use glium::Texture2d ;
1733
+ /// use imgui_glium_renderer::Texture ;
1734
1734
/// use glium::backend::Facade;
1735
1735
///
1736
1736
/// fn make_a_texture<F: Facade>(ui: &Ui, facade: &F, data: Vec<Vec<(u8, u8, u8, u8)>>) {
1737
- /// let texture_handle = ui.replace_texture::<_, imgui_glium_renderer::Texture> (
1737
+ /// let texture_handle = ui.replace_texture(
1738
1738
/// im_str!("#Texture Name ID"),
1739
- /// Texture2d::new (facade, data).unwrap(),
1739
+ /// Texture::from_data (facade, data).unwrap(),
1740
1740
/// );
1741
1741
/// // ... Do something with `texture_handle`
1742
1742
/// }
1743
1743
///
1744
1744
/// # fn main() {}
1745
1745
/// ```
1746
- pub fn replace_texture < T , U > ( & self , name : & ImStr , t : T ) -> AnyTexture
1746
+ pub fn replace_texture < T > ( & self , name : & ImStr , t : T ) -> AnyTexture
1747
1747
where
1748
- U : ' static + IntoImTexture < T > + ImTexture ,
1748
+ T : ' static + ImTexture ,
1749
1749
{
1750
1750
let imgui = self . imgui ( ) ;
1751
- let texture: U = IntoImTexture :: into_texture ( t) ;
1752
- imgui. textures . register_texture ( name, texture) ;
1751
+ imgui. textures . register_texture ( name, t) ;
1753
1752
imgui. textures . get_texture ( name) . unwrap ( )
1754
1753
}
1755
1754
}
0 commit comments