mirror of
https://github.com/griffi-gh/hUI.git
synced 2025-04-01 21:46:29 -05:00
remove deprecated functions
This commit is contained in:
parent
68f4f2859c
commit
6297f004e3
|
@ -80,71 +80,6 @@ impl UiInstance {
|
|||
self.painter.fonts_mut()
|
||||
}
|
||||
|
||||
/// Parse and add a font from a raw byte slice to the UI\
|
||||
/// TrueType (`.ttf`/`.ttc`) and OpenType (`.otf`) fonts are supported\
|
||||
///
|
||||
/// Returns a font handle ([`FontHandle`]).
|
||||
///
|
||||
/// ## Panics:
|
||||
/// If the font data is invalid or corrupt
|
||||
#[deprecated(since = "0.1.0-alpha.7", note = "use instance.fonts_mut().add(...) instead")]
|
||||
pub fn add_font(&mut self, font: &[u8]) -> FontHandle {
|
||||
self.painter.fonts_mut().add(font)
|
||||
}
|
||||
|
||||
/// Add an image to the texture atlas\
|
||||
/// Accepted texture formats are `Rgba` and `Grayscale`
|
||||
///
|
||||
/// Returns an image handle ([`ImageHandle`])\
|
||||
/// This handle can be used to reference the texture in draw commands\
|
||||
/// It's a light reference and can be cloned/copied freely, but will not be cleaned up even when dropped
|
||||
#[deprecated(since = "0.1.0-alpha.7", note = "use instance.textures_mut().add_with_data(...) instead")]
|
||||
pub fn add_image(&mut self, format: SourceTextureFormat, data: &[u8], width: usize) -> TextureHandle {
|
||||
// self.atlas().add(width, data, format)
|
||||
self.painter.textures_mut().add_with_data(format, data, width)
|
||||
}
|
||||
|
||||
//TODO better error handling
|
||||
|
||||
// /// Add an image from a file to the texture atlas\
|
||||
// /// (experimental, may be removed in the future)
|
||||
// ///
|
||||
// /// Requires the `image` feature
|
||||
// ///
|
||||
// /// # Panics:
|
||||
// /// - If the file exists but contains invalid image data\
|
||||
// /// (this will change to a soft error in the future)
|
||||
// ///
|
||||
// /// Deprecated.
|
||||
// #[deprecated]
|
||||
// pub fn add_image_file_path(&mut self, path: impl AsRef<std::path::Path>) -> Result<TextureHandle, std::io::Error> {
|
||||
// use std::io::{Read, Seek};
|
||||
|
||||
// // Open the file (and wrap it in a bufreader)
|
||||
// let mut file = std::io::BufReader::new(std::fs::File::open(path)?);
|
||||
|
||||
// //Guess the image format from the magic bytes
|
||||
// //Read like 64 bytes, which should be enough for magic byte detection
|
||||
// //well this would fail if the image is somehow smaller than 64 bytes, but who the fvck cares...
|
||||
// let mut magic = [0; 64];
|
||||
// file.read_exact(&mut magic)?;
|
||||
// let format = image::guess_format(&magic).expect("Invalid image data (FORMAT)");
|
||||
// file.seek(std::io::SeekFrom::Start(0))?;
|
||||
|
||||
// //Parse the image and read the raw uncompressed rgba data
|
||||
// let image = image::load(file, format).expect("Invalid image data");
|
||||
// let image_rgba = image.as_rgba8().unwrap();
|
||||
|
||||
// //Add the image to the atlas
|
||||
// let handle = self.add_image(
|
||||
// SourceTextureFormat::RGBA8,
|
||||
// image_rgba,
|
||||
// image.width() as usize
|
||||
// );
|
||||
|
||||
// Ok(handle)
|
||||
// }
|
||||
|
||||
/// Push a font to the font stack\
|
||||
/// The font will be used for all text rendering until it is popped
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue