Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ internal virtual void PackFromRgba64(ReadOnlySpan<Rgba64> source, Span<TPixel> d
ref Rgba64 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var rgba = new Rgba64(0, 0, 0, 65535);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Rgba64>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
rgba = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba64(rgba);
temp = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba64(temp);
}
}

Expand Down Expand Up @@ -95,13 +96,14 @@ internal virtual void PackFromRgb48(ReadOnlySpan<Rgb48> source, Span<TPixel> des
ref Rgb48 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var rgb = default(Rgb48);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Rgb48>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
rgb = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgb48(rgb);
temp = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgb48(temp);
}
}

Expand Down Expand Up @@ -166,13 +168,14 @@ internal virtual void PackFromRgba32(ReadOnlySpan<Rgba32> source, Span<TPixel> d
ref Rgba32 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var rgba = new Rgba32(0, 0, 0, 255);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Rgba32>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
rgba = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(rgba);
temp = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(temp);
}
}

Expand Down Expand Up @@ -237,13 +240,14 @@ internal virtual void PackFromBgra32(ReadOnlySpan<Bgra32> source, Span<TPixel> d
ref Bgra32 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var bgra = new Bgra32(0, 0, 0, 255);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Bgra32>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
bgra = Unsafe.Add(ref sourceRef, i);
dp.PackFromBgra32(bgra);
temp = Unsafe.Add(ref sourceRef, i);
dp.PackFromBgra32(temp);
}
}

Expand Down Expand Up @@ -308,13 +312,14 @@ internal virtual void PackFromRgb24(ReadOnlySpan<Rgb24> source, Span<TPixel> des
ref Rgb24 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var rgba = new Rgba32(0, 0, 0, 255);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Rgba32>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
rgba.Rgb = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(rgba);
temp.Rgb = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(temp);
}
}

Expand Down Expand Up @@ -379,13 +384,14 @@ internal virtual void PackFromBgr24(ReadOnlySpan<Bgr24> source, Span<TPixel> des
ref Bgr24 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var rgba = new Rgba32(0, 0, 0, 255);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Rgba32>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
rgba.Bgr = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(rgba);
temp.Bgr = Unsafe.Add(ref sourceRef, i);
dp.PackFromRgba32(temp);
}
}

Expand Down Expand Up @@ -450,13 +456,14 @@ internal virtual void PackFromArgb32(ReadOnlySpan<Argb32> source, Span<TPixel> d
ref Argb32 sourceRef = ref MemoryMarshal.GetReference(source);
ref TPixel destRef = ref MemoryMarshal.GetReference(destPixels);

var argb = new Argb32(0, 0, 0, 255);
// For conversion methods writing only to RGB channels, we need to keep the alpha channel opaque!
var temp = NamedColors<Argb32>.Black;

for (int i = 0; i < count; i++)
{
ref TPixel dp = ref Unsafe.Add(ref destRef, i);
argb = Unsafe.Add(ref sourceRef, i);
dp.PackFromArgb32(argb);
temp = Unsafe.Add(ref sourceRef, i);
dp.PackFromArgb32(temp);
}
}

Expand Down Expand Up @@ -509,4 +516,5 @@ internal void ToArgb32Bytes(ReadOnlySpan<TPixel> sourceColors, Span<byte> destBy
}

}

}
Loading