Anton Marsden

Results 15 comments of Anton Marsden

You make a fair point. The current implementation is probably adequate for now, and improvements would only really benefit applications doing a lot of [de]compression (file/image processing).

I'm going to experiment with an implementation of this - looks like adler32 is still being used by miniz_oxide, which is a pure Rust [de]compressor, which is used by flate2....

@lovell Great suggestion, I have implemented it. Added some fancy logic for dealing with the alpha channel that you may wish to review. Only outstanding thing is test cases, which...

Handling the multi-band expansion for linear() looked tricky in the context of sharp's colourspace handling.

@lovell Done, all yours.

To elaborate, I could then implement functionality using the following approach: ``` const SRGB_LUMA: [f32; 3] = [0.2126, 0.7152, 0.0722]; pub trait LuminanceOp : RgbPixel { fn luminance(&self) -> u8...

The concrete structs would only support traits that were appropriate, e.g., - RGBA would have impls for Pixel, RgbPixel, and AlphaPixel traits - GrayAlphaPixel would have impls for Pixel, GrayPixel,...

Assuming you simplify to having `ComponentType = AlphaType`, you may end up with something like the following. Note that it solves the `get_alpha()` problem by ensuring that `Pixel` always provides...

Pretty simple to implement your function - see the `LuminanceOp` above, which provides a default impl for the `RgbPixel` trait, and `RgbaPixel` trait extends RgbPixel. Then just need to ensure...

@vicegold Could potentially use the **unflatten** function for this. It will convert pure white to transparent. You could then invert the colours and unflatten again to deal with the black...