set fmt and stride to private in ImageRgb

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-28 12:35:46 +08:00
parent e3b66af8af
commit fc50a3e49d
6 changed files with 27 additions and 11 deletions

View File

@@ -53,22 +53,32 @@ pub enum ImageFormat {
pub struct ImageRgb {
pub raw: Vec<u8>,
pub fmt: ImageFormat,
pub w: usize,
pub h: usize,
pub stride: usize,
fmt: ImageFormat,
stride: usize,
}
impl ImageRgb {
pub fn new(fmt: ImageFormat, stride: usize) -> Self {
Self {
raw: Vec::new(),
fmt,
w: 0,
h: 0,
fmt,
stride,
}
}
#[inline]
pub fn fmt(&self) -> ImageFormat {
self.fmt
}
#[inline]
pub fn stride(&self) -> usize {
self.stride
}
}
#[inline]