(self, mut transform: impl PixelTransform)
| 267 | } |
| 268 | |
| 269 | pub fn transform_and_apply(self, mut transform: impl PixelTransform) -> Image<u16> { |
| 270 | let mut image = vec![0; self.width * self.height * 3]; |
| 271 | let (width, height, iter) = self.orientation_iter(); |
| 272 | for Pixel { values, row, column } in iter.map(|mut pixel| { |
| 273 | pixel.values = transform.apply(pixel); |
| 274 | pixel |
| 275 | }) { |
| 276 | let pixel_index = row * width + column; |
| 277 | image[3 * pixel_index..3 * (pixel_index + 1)].copy_from_slice(&values); |
| 278 | } |
| 279 | |
| 280 | Image { |
| 281 | channels: 3, |
| 282 | data: image, |
| 283 | width, |
| 284 | height, |
| 285 | orientation: OrientationValue::Horizontal, |
| 286 | } |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | #[derive(Error, Debug)] |
no test coverage detected