MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / transform_and_apply

Method transform_and_apply

libraries/rawkit/src/lib.rs:269–287  ·  view source on GitHub ↗
(self, mut transform: impl PixelTransform)

Source from the content-addressed store, hash-verified

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)]

Callers 1

process_16bitMethod · 0.80

Calls 2

orientation_iterMethod · 0.80
applyMethod · 0.45

Tested by

no test coverage detected