Imagesharp: Add additional IPackedPixel<TColor, TPacked> implementations.

Created on 21 Nov 2016  路  3Comments  路  Source: SixLabors/ImageSharp

We need to add implementations for the following MonoGame classes and tests to match.

  • [x] Alpha8
  • [x] Bgr565
  • [x] Bgra444
  • [x] Bgra565
  • [x] Byte4
  • [x] HalfSingle
  • [x] HalfVector2
  • [x] HalfVector4
  • [x] NormalizedByte2
  • [x] NormalizedByte4
  • [x] NormalizedShort2
  • [x] NormalizedShort4
  • [x] Rg32
  • [x] Rgba1010102
  • [x] Rgba64
  • [x] Short2
  • [x] Short4
enhancement

Most helpful comment

馃槃 It's actually in good shape what with the scaling and offset adjustments. It's red simply because HalfSingle only preserves the red channel. I deliberately left out Alpha8 since it would preserve nothing in a jpeg.

calliphora before

calliphora after

All 3 comments

We can now do some pretty crazy things.

var image = new Image(inputStream)
    .To<Bgr565, ushort>()
    .To<Bgra4444, ushort>()
    .To<Bgra5551, ushort>()
    .To<Byte4, uint>()
    .To<HalfSingle, ushort>()
    .To<HalfVector2, uint>()
    .To<HalfVector4, ulong>()
    .To<Rg32, uint>()
    .To<Rgba1010102, uint>()
    .To<NormalizedByte2, ushort>()
    .To<NormalizedByte4, uint>()
    .To<NormalizedShort2, uint>()
    .To<NormalizedShort4, ulong>()
    .To<Short2, uint>()
    .To<Short4, ulong>()
    .Save(outputStream);

WHAAAAAAAAAAAAT???!!!!!

i wanna see a pic before/after :) poor image has surely gone through hell

馃槃 It's actually in good shape what with the scaling and offset adjustments. It's red simply because HalfSingle only preserves the red channel. I deliberately left out Alpha8 since it would preserve nothing in a jpeg.

calliphora before

calliphora after

Was this page helpful?
0 / 5 - 0 ratings