/// <inheritdoc /> internal override void ToVector4( Configuration configuration, ReadOnlySpan <RgbaVector> sourcePixels, Span <Vector4> destVectors, PixelConversionModifiers modifiers) { Guard.DestinationShouldNotBeTooShort(sourcePixels, destVectors, nameof(destVectors)); MemoryMarshal.Cast <RgbaVector, Vector4>(sourcePixels).CopyTo(destVectors); Vector4Converters.ApplyForwardConversionModifiers(destVectors, modifiers); }
/// <inheritdoc /> internal override void FromVector4Destructive( Configuration configuration, Span <Vector4> sourceVectors, Span <RgbaVector> destinationColors, PixelConversionModifiers modifiers) { Guard.DestinationShouldNotBeTooShort(sourceVectors, destinationColors, nameof(destinationColors)); Vector4Converters.ApplyBackwardConversionModifiers(sourceVectors, modifiers); MemoryMarshal.Cast <Vector4, RgbaVector>(sourceVectors).CopyTo(destinationColors); }
/// <inheritdoc /> public override void FromVector4Destructive( Configuration configuration, Span <Vector4> sourceVectors, Span <Rgba32> destinationPixels, PixelConversionModifiers modifiers) { Guard.DestinationShouldNotBeTooShort(sourceVectors, destinationPixels, nameof(destinationPixels)); destinationPixels = destinationPixels.Slice(0, sourceVectors.Length); Vector4Converters.ApplyBackwardConversionModifiers(sourceVectors, modifiers); SimdUtils.NormalizedFloatToByteSaturate( MemoryMarshal.Cast <Vector4, float>(sourceVectors), MemoryMarshal.Cast <Rgba32, byte>(destinationPixels)); }
/// <inheritdoc /> public override void ToVector4( Configuration configuration, ReadOnlySpan <Rgba32> sourcePixels, Span <Vector4> destinationVectors, PixelConversionModifiers modifiers) { Guard.DestinationShouldNotBeTooShort(sourcePixels, destinationVectors, nameof(destinationVectors)); destinationVectors = destinationVectors.Slice(0, sourcePixels.Length); SimdUtils.ByteToNormalizedFloat( MemoryMarshal.Cast <Rgba32, byte>(sourcePixels), MemoryMarshal.Cast <Vector4, float>(destinationVectors)); Vector4Converters.ApplyForwardConversionModifiers(destinationVectors, modifiers); }