Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aeaeab8
temporarily disable multitargeting
antonfirsov May 5, 2019
1d67089
add skeleton for Color type
antonfirsov May 5, 2019
5080d34
Merge branch 'af/non-generic-image-baseclass' into af/general-color-type
antonfirsov May 5, 2019
b8d47cb
add more Rgba64 constructor overloads
antonfirsov May 5, 2019
a2ca7da
basic Color methods
antonfirsov May 5, 2019
e22c5b5
Pixel-agnostic Binarization processors
antonfirsov May 5, 2019
e5e3768
Implement WernerPalette and WebSafePalette for Color
antonfirsov May 6, 2019
16b24d4
refactor dithering and error diffusion to use Color
antonfirsov May 6, 2019
b7fefae
Merge branch 'af/non-generic-image-baseclass' into af/general-color-type
antonfirsov May 9, 2019
9f0cce3
refactor of Overlays
antonfirsov May 9, 2019
aed78fd
Merge branch 'af/non-generic-image-baseclass' into af/general-color-type
antonfirsov May 9, 2019
f888f5d
cleanup and document Color
antonfirsov May 9, 2019
24de58a
cleanup
antonfirsov May 9, 2019
154483e
Merge remote-tracking branch 'origin/master' into af/general-color-type
antonfirsov May 10, 2019
5ae2773
Made PaletteQuantizer non-generic all the way
antonfirsov May 10, 2019
db76572
QuantizedFrame<T> using ReadOnlyMemory<T>
antonfirsov May 10, 2019
7fc2018
Correct readonly-semantics for QuantizedFrame
antonfirsov May 10, 2019
fef3a11
introduce IQuantizedFrame<T>
antonfirsov May 10, 2019
a3cb4c9
move all extension methods under a subfolder
antonfirsov May 10, 2019
2791284
re-enable all target frameworks
antonfirsov May 11, 2019
d0466c4
More docs for Color, correct naming in ColorBuilder<TPixel>
antonfirsov May 11, 2019
552d885
move implicit Color conversion to pixel types,
antonfirsov May 12, 2019
86d884c
Merge remote-tracking branch 'origin/master' into af/general-color-type
antonfirsov May 12, 2019
5931537
fix new 8bit bmp code
antonfirsov May 12, 2019
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
1 change: 1 addition & 0 deletions ImageSharp.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,6 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bgra/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Quantizer/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
2 changes: 1 addition & 1 deletion src/ImageSharp/Advanced/AotCompilerTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static void AotCompileOctreeQuantizer<TPixel>()
private static void AotCompileWuQuantizer<TPixel>()
where TPixel : struct, IPixel<TPixel>
{
var test = new WuFrameQuantizer<TPixel>(new WuQuantizer(false));
var test = new WuFrameQuantizer<TPixel>(Configuration.Default.MemoryAllocator, new WuQuantizer(false));
test.QuantizeFrame(new ImageFrame<TPixel>(Configuration.Default, 1, 1));
test.AotGetPalette();
}
Expand Down
83 changes: 83 additions & 0 deletions src/ImageSharp/Color/Color.Conversions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.

using System.Numerics;
using System.Runtime.CompilerServices;

using SixLabors.ImageSharp.PixelFormats;

namespace SixLabors.ImageSharp
{
/// <content>
/// Contains constructors and implicit conversion methods.
/// </content>
public readonly partial struct Color
{
/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Rgba64"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Rgba64 pixel) => this.data = pixel;

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Rgba32"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Rgba32 pixel) => this.data = new Rgba64(pixel);

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Argb32"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Argb32 pixel) => this.data = new Rgba64(pixel);

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Bgra32"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Bgra32 pixel) => this.data = new Rgba64(pixel);

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Rgb24"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Rgb24 pixel) => this.data = new Rgba64(pixel);

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="pixel">The <see cref="Bgr24"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Bgr24 pixel) => this.data = new Rgba64(pixel);

/// <summary>
/// Initializes a new instance of the <see cref="Color"/> struct.
/// </summary>
/// <param name="vector">The <see cref="Vector4"/> containing the color information.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public Color(Vector4 vector) => this.data = new Rgba64(vector);

[MethodImpl(InliningOptions.ShortMethod)]
internal Rgba64 ToRgba64() => this.data;

[MethodImpl(InliningOptions.ShortMethod)]
internal Rgba32 ToRgba32() => this.data.ToRgba32();

[MethodImpl(InliningOptions.ShortMethod)]
internal Bgra32 ToBgra32() => this.data.ToBgra32();

[MethodImpl(InliningOptions.ShortMethod)]
internal Argb32 ToArgb32() => this.data.ToArgb32();

[MethodImpl(InliningOptions.ShortMethod)]
internal Rgb24 ToRgb24() => this.data.ToRgb24();

[MethodImpl(InliningOptions.ShortMethod)]
internal Bgr24 ToBgr24() => this.data.ToBgr24();
}
}
Loading