diff options
author | Hubert Figuière <hub@figuiere.net> | 2024-09-10 19:25:09 -0400 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2024-09-10 19:26:45 -0400 |
commit | 1f261e45cb95092ad216f890b4b8a0ab168ea943 (patch) | |
tree | 5ccab2d558b39fc81ca4ca8cf0a63589dd821909 | |
parent | 5c60f74d4158d665a9a08b7f6f88e2d0ef008634 (diff) |
Remove the Image trait
data16() is now part of Bitmap.
Signed-off-by: Hubert Figuière <hub@figuiere.net>
-rw-r--r-- | examples/orrender.rs | 2 | ||||
-rw-r--r-- | src/bin/ordiag.rs | 4 | ||||
-rw-r--r-- | src/bitmap.rs | 11 | ||||
-rw-r--r-- | src/capi/bitmap.rs | 4 | ||||
-rw-r--r-- | src/capi/rawdata.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/rawimage.rs | 4 |
7 files changed, 11 insertions, 18 deletions
diff --git a/examples/orrender.rs b/examples/orrender.rs index efe55a5..604ffa3 100644 --- a/examples/orrender.rs +++ b/examples/orrender.rs @@ -23,7 +23,7 @@ use getopts::Options; use log::LevelFilter; use simple_logger::SimpleLogger; -use libopenraw::{rawfile_from_file, Bitmap, Image, RenderingOptions}; +use libopenraw::{rawfile_from_file, Bitmap, RenderingOptions}; pub fn main() { let args: Vec<String> = std::env::args().collect(); diff --git a/src/bin/ordiag.rs b/src/bin/ordiag.rs index e9f5296..2df18e5 100644 --- a/src/bin/ordiag.rs +++ b/src/bin/ordiag.rs @@ -25,9 +25,7 @@ use simple_logger::SimpleLogger; use libopenraw::metadata::Value; use libopenraw::Bitmap; -use libopenraw::{ - rawfile_from_file, DataType, Error, Ifd, Image, RawFile, RawImage, Result, Thumbnail, -}; +use libopenraw::{rawfile_from_file, DataType, Error, Ifd, RawFile, RawImage, Result, Thumbnail}; #[cfg(feature = "probe")] #[derive(Clone, Copy, PartialEq)] diff --git a/src/bitmap.rs b/src/bitmap.rs index 4380e4f..6984325 100644 --- a/src/bitmap.rs +++ b/src/bitmap.rs @@ -114,13 +114,10 @@ pub trait Bitmap { fn bpc(&self) -> u16; /// Image data in 8 bits fn data8(&self) -> Option<&[u8]>; -} - -/// An `Image` is a more comprehensive `Bitmap` with 16-bits -/// support. -pub trait Image: Bitmap { - /// Image data in 16 bits - fn data16(&self) -> Option<&[u16]>; + /// Image data in 16 bits. `None` by default + fn data16(&self) -> Option<&[u16]> { + None + } } /// Encapsulate data 8 or 16 bits diff --git a/src/capi/bitmap.rs b/src/capi/bitmap.rs index 784c179..849c306 100644 --- a/src/capi/bitmap.rs +++ b/src/capi/bitmap.rs @@ -2,7 +2,7 @@ /* * libopenraw - capi/bitmap.rs * - * Copyright (C) 2023 Hubert Figuière + * Copyright (C) 2023-2024 Hubert Figuière * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -21,7 +21,7 @@ //! This contain all the `or_bitmapdata_*` APIs. -use crate::{or_unwrap, Bitmap, DataType, Image, RawImage}; +use crate::{or_unwrap, Bitmap, DataType, RawImage}; use super::{or_data_type, or_error}; diff --git a/src/capi/rawdata.rs b/src/capi/rawdata.rs index 57b2399..eb733ed 100644 --- a/src/capi/rawdata.rs +++ b/src/capi/rawdata.rs @@ -26,7 +26,7 @@ use crate::{ colour::ColourSpace, or_unwrap, render::{RenderingOptions, RenderingStage}, - AspectRatio, Bitmap, Image, RawImage, + AspectRatio, Bitmap, RawImage, }; /// Pointer to a [`RawImage`] object exported to the C API. @@ -78,7 +78,7 @@ mod sony; mod thumbnail; pub mod tiff; -pub use bitmap::{Bitmap, Image}; +pub use bitmap::Bitmap; pub use colour::ColourSpace; pub use dump::Dump; pub use geometry::{AspectRatio, Point, Rect, Size}; diff --git a/src/rawimage.rs b/src/rawimage.rs index b97a0fb..ce5276a 100644 --- a/src/rawimage.rs +++ b/src/rawimage.rs @@ -30,7 +30,7 @@ use crate::render::{self, gamma_correct_f, gamma_correct_srgb, RenderingOptions, use crate::tiff::exif; use crate::utils; use crate::{tiff, ColourSpace}; -use crate::{AspectRatio, Bitmap, DataType, Error, Image, Rect, Result}; +use crate::{AspectRatio, Bitmap, DataType, Error, Rect, Result}; #[derive(Default, Debug)] enum AsShot { @@ -608,9 +608,7 @@ impl Bitmap for RawImage { _ => None, } } -} -impl Image for RawImage { fn data16(&self) -> Option<&[u16]> { match self.data { Data::Data16(ref d) => Some(d), |