Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/codecs/avif/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn reshape_plane(
return Ok(vec![]);
}

// Except for an empty image a true stride is required..
// Except for an empty image a true stride is required.
if stride == 0 {
return Err(error_map(AvifDecoderError::InvalidStride(stride)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/bmp/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ fn check_for_overflow(width: i32, length: i32, channels: usize) -> ImageResult<(
})
}

/// Calculate how many many bytes a buffer holding a decoded image with these properties would
/// Calculate how many bytes a buffer holding a decoded image with these properties would
/// require. Returns `None` if the buffer size would overflow or if one of the sizes are negative.
fn num_bytes(width: i32, length: i32, channels: usize) -> Option<usize> {
if width <= 0 || length <= 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/hdr/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ fn decode_old_rle<R: Read>(r: &mut R, fb: Rgbe8Pixel, buf: &mut [Rgbe8Pixel]) ->
let mut prev_pixel = fb;
while x_off < width {
let pix = read_rgbe(r)?;
// it's harder to forget to increase x_off if I write this this way.
// it's harder to forget to increase x_off if I write this way.
x_off += {
if let Some(rl) = rl_marker(pix) {
if rl_shift >= 32 {
Expand Down
2 changes: 1 addition & 1 deletion src/codecs/pnm/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ impl<'a> UncheckedHeader<'a> {
impl<'a> CheckedDimensions<'a> {
// Check color compatibility with the header. This will only error when we are certain that
// the combination is bogus (e.g. combining Pixmap and Palette) but allows uncertain
// combinations (basically a ArbitraryTuplType::Custom with any color of fitting depth).
// combinations (basically an ArbitraryTuplType::Custom with any color of fitting depth).
fn check_header_color(self, color: ExtendedColorType) -> ImageResult<CheckedHeaderColor<'a>> {
let components = u32::from(color.channel_count());

Expand Down
4 changes: 2 additions & 2 deletions src/codecs/tga/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ mod tests {
assert_eq!(*err, EncoderError::WidthInvalid(dimension));
}
other => panic!(
"Encoding an image that is too wide should return a InvalidWidth \
"Encoding an image that is too wide should return an InvalidWidth \
it returned {other:?} instead"
),
}
Expand Down Expand Up @@ -320,7 +320,7 @@ mod tests {
assert_eq!(*err, EncoderError::HeightInvalid(dimension));
}
other => panic!(
"Encoding an image that is too tall should return a InvalidHeight \
"Encoding an image that is too tall should return an InvalidHeight \
it returned {other:?} instead"
),
}
Expand Down
2 changes: 1 addition & 1 deletion src/imageops/colorops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ pub trait ColorMap {
/// cmap.lookup(p.0[0] as usize)
/// .expect("indexed color out-of-range")
/// });
/// // Create an black and white image of expected output.
/// // Create a black and white image of expected output.
/// let bw = ImageBuffer::from_fn(w, h, |x, y| -> Luma<u8> {
/// if x <= (w / 2) {
/// [0].into()
Expand Down
4 changes: 2 additions & 2 deletions src/images/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ where
SampleLayout::row_major_packed(<P as Pixel>::CHANNEL_COUNT, self.width, self.height)
}

/// Return the raw sample buffer with its stride an dimension information.
/// Return the raw sample buffer with its stride and dimension information.
///
/// The returned buffer is guaranteed to be well formed in all cases. It is laid out by
/// colors, width then height, meaning `channel_stride <= width_stride <= height_stride`. All
Expand Down Expand Up @@ -1096,7 +1096,7 @@ impl<P: Pixel, Container> ImageBuffer<P, Container> {

/// Set primaries and transfer characteristics from a Cicp color space.
///
/// Returns an error if `cicp` uses features that are not support with an RGB color space, e.g.
/// Returns an error if `cicp` uses features that are not supported with an RGB color space, e.g.
/// a matrix or narrow range (studio encoding) channels.
pub fn set_color_space(&mut self, cicp: Cicp) -> ImageResult<()> {
self.color = cicp.try_into_rgb()?;
Expand Down
34 changes: 17 additions & 17 deletions src/images/dynimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ impl DynamicImage {
}
}

/// Return a reference to an 16bit RGB image
/// Return a reference to a 16bit RGB image
#[must_use]
pub fn as_rgb16(&self) -> Option<&Rgb16Image> {
match *self {
Expand All @@ -659,15 +659,15 @@ impl DynamicImage {
}
}

/// Return a mutable reference to an 16bit RGB image
/// Return a mutable reference to a 16bit RGB image
pub fn as_mut_rgb16(&mut self) -> Option<&mut Rgb16Image> {
match *self {
DynamicImage::ImageRgb16(ref mut p) => Some(p),
_ => None,
}
}

/// Return a reference to an 16bit RGBA image
/// Return a reference to a 16bit RGBA image
#[must_use]
pub fn as_rgba16(&self) -> Option<&Rgba16Image> {
match *self {
Expand All @@ -676,15 +676,15 @@ impl DynamicImage {
}
}

/// Return a mutable reference to an 16bit RGBA image
/// Return a mutable reference to a 16bit RGBA image
pub fn as_mut_rgba16(&mut self) -> Option<&mut Rgba16Image> {
match *self {
DynamicImage::ImageRgba16(ref mut p) => Some(p),
_ => None,
}
}

/// Return a reference to an 32bit RGB image
/// Return a reference to a 32bit RGB image
#[must_use]
pub fn as_rgb32f(&self) -> Option<&Rgb32FImage> {
match *self {
Expand All @@ -693,15 +693,15 @@ impl DynamicImage {
}
}

/// Return a mutable reference to an 32bit RGB image
/// Return a mutable reference to a 32bit RGB image
pub fn as_mut_rgb32f(&mut self) -> Option<&mut Rgb32FImage> {
match *self {
DynamicImage::ImageRgb32F(ref mut p) => Some(p),
_ => None,
}
}

/// Return a reference to an 32bit RGBA image
/// Return a reference to a 32bit RGBA image
#[must_use]
pub fn as_rgba32f(&self) -> Option<&Rgba32FImage> {
match *self {
Expand All @@ -710,15 +710,15 @@ impl DynamicImage {
}
}

/// Return a mutable reference to an 32bit RGBA image
/// Return a mutable reference to a 32bit RGBA image
pub fn as_mut_rgba32f(&mut self) -> Option<&mut Rgba32FImage> {
match *self {
DynamicImage::ImageRgba32F(ref mut p) => Some(p),
_ => None,
}
}

/// Return a reference to an 16bit Grayscale image
/// Return a reference to a 16bit Grayscale image
#[must_use]
pub fn as_luma16(&self) -> Option<&Gray16Image> {
match *self {
Expand All @@ -727,7 +727,7 @@ impl DynamicImage {
}
}

/// Return a reference to an 32bit Grayscale image
/// Return a reference to a 32bit Grayscale image
#[must_use]
pub fn as_luma32f(&self) -> Option<&Gray32FImage> {
match *self {
Expand All @@ -736,15 +736,15 @@ impl DynamicImage {
}
}

/// Return a mutable reference to an 16bit Grayscale image
/// Return a mutable reference to a 16bit Grayscale image
pub fn as_mut_luma16(&mut self) -> Option<&mut Gray16Image> {
match *self {
DynamicImage::ImageLuma16(ref mut p) => Some(p),
_ => None,
}
}

/// Return a mutable reference to an 32bit Grayscale image
/// Return a mutable reference to a 32bit Grayscale image
#[must_use]
pub fn as_mut_luma32f(&mut self) -> Option<&mut Gray32FImage> {
match *self {
Expand All @@ -753,7 +753,7 @@ impl DynamicImage {
}
}

/// Return a reference to an 16bit Grayscale image with an alpha channel
/// Return a reference to a 16bit Grayscale image with an alpha channel
#[must_use]
pub fn as_luma_alpha16(&self) -> Option<&GrayAlpha16Image> {
match *self {
Expand All @@ -762,23 +762,23 @@ impl DynamicImage {
}
}

/// Return a reference to an 32bit Grayscale image with an alpha channel
/// Return a reference to a 32bit Grayscale image with an alpha channel
pub fn as_luma_alpha32f(&self) -> Option<&GrayAlpha32FImage> {
match *self {
DynamicImage::ImageLumaA32F(ref p) => Some(p),
_ => None,
}
}

/// Return a mutable reference to an 16bit Grayscale image with an alpha channel
/// Return a mutable reference to a 16bit Grayscale image with an alpha channel
pub fn as_mut_luma_alpha16(&mut self) -> Option<&mut GrayAlpha16Image> {
match *self {
DynamicImage::ImageLumaA16(ref mut p) => Some(p),
_ => None,
}
}

/// Return a mutable reference to an 32bit Grayscale image with an alpha channel
/// Return a mutable reference to a 32bit Grayscale image with an alpha channel
pub fn as_mut_luma_alpha32f(&mut self) -> Option<&mut GrayAlpha32FImage> {
match *self {
DynamicImage::ImageLumaA32F(ref mut p) => Some(p),
Expand Down Expand Up @@ -947,7 +947,7 @@ impl DynamicImage {

/// Set primaries and transfer characteristics from a Cicp color space.
///
/// Returns an error if `cicp` uses features that are not support with an RGB color space, e.g.
/// Returns an error if `cicp` uses features that are not supported with an RGB color space, e.g.
/// a matrix or narrow range (studio encoding) channels.
pub fn set_color_space(&mut self, cicp: Cicp) -> ImageResult<()> {
dynamic_map!(self, ref mut p, p.set_color_space(cicp))
Expand Down
2 changes: 1 addition & 1 deletion src/images/generic_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub struct Pixels<'a, I: ?Sized + 'a> {
image: &'a I,
/// Maintains `x < self.width` with a non-empty image.
x: u32,
/// Maintains `y <= self.height` and `self.height == 0` with an empty image..
/// Maintains `y <= self.height` and `self.height == 0` with an empty image.
y: u32,
width: u32,
height: u32,
Expand Down
4 changes: 2 additions & 2 deletions src/metadata/moxcms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl Moxcms {
/// This is the whole input information which we must be able to pass to the CMS in a support
/// transform, to handle all possible combinations of `ColorType` pixels that can be thrown at us.
/// For instance, in a previous iteration we had a separate gray profile here (but now handle that
/// internally by expansion to RGB through an YCbCr). Future iterations may add additional structs
/// internally by expansion to RGB through a YCbCr). Future iterations may add additional structs
/// to be computed for validating `CicpTransform::new`.
struct ColorProfile {
rgb: moxcms::ColorProfile,
Expand All @@ -396,7 +396,7 @@ impl ColorProfile {
}

impl Cicp {
/// Get an compute representation of an ICC profile for RGB.
/// Get a compute representation of an ICC profile for RGB.
///
/// Note you should *not* be using this profile for export in a file, as discussed below.
///
Expand Down
Loading