Skip to content
Open
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
8 changes: 8 additions & 0 deletions Project-Aurora/ColorBox/ColorBox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@
<AssemblyOriginatorKeyFile>ColorBox.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
Expand All @@ -67,6 +71,9 @@
<Compile Include="Implementation\SaturationBrightnessSelector.cs" />
<Compile Include="Implementation\SpinEventArgs.cs" />
<Compile Include="Implementation\Spinner.cs" />
<Compile Include="Utils\ColorSpectrum.cs" />
<Compile Include="Utils\ColorUtils.cs" />
<Compile Include="Utils\EffectBrush.cs" />
<Compile Include="Utils\TextBoxBehavior.cs" />
<Compile Include="Implementation\UpDownBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand All @@ -81,6 +88,7 @@
</ItemGroup>
<ItemGroup>
<None Include="ColorBox.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="LICENSE.txt" />
Expand Down
354 changes: 162 additions & 192 deletions Project-Aurora/ColorBox/Implementation/ColorBox.cs

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Project-Aurora/ColorBox/Implementation/GradientStopSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,17 @@ protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
if (this.ColorBox != null)
{
this.ColorBox._BrushSetInternally = true;
this.ColorBox._UpdateBrush = false;
this.ColorBox._UpdateBrush = false;

this.ColorBox.SelectedGradient = this.SelectedGradient;
this.ColorBox.Color = this.SelectedGradient.Color;

this.ColorBox._UpdateBrush = true;
//this.ColorBox._BrushSetInternally = false;

//e.Handled = true;
}
}

protected override void OnValueChanged(double oldValue, double newValue)
{
base.OnValueChanged(oldValue, newValue);
Expand Down
132 changes: 108 additions & 24 deletions Project-Aurora/ColorBox/Themes/Generic.xaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using ColorBox;

namespace Aurora.EffectsEngine
namespace ColorBox
{
/// <summary>
/// A class that represents a spectrum of colors. After creating an instance, you can then retrieve a blended color within a range of [0.0f, 1.0f].
Expand Down Expand Up @@ -201,8 +202,8 @@ public Color GetColorAt(float position, float max_position = 1.0f, double opacit
}
}

return Utils.ColorUtils.MultiplyColorByScalar(
Utils.ColorUtils.BlendColors(
return ColorUtils.MultiplyColorByScalar(
ColorUtils.BlendColors(
colors[closest_lower], colors[closest_higher], ((double)(position - closest_lower) / (double)(closest_higher - closest_lower))
),
opacity
Expand All @@ -221,7 +222,7 @@ public Color GetColorAt(float position, float max_position = 1.0f, double opacit
public LinearGradientBrush ToLinearGradient(float width, float height = 0.0f, float x = 0.0f, float y = 0.0f, double opacity = 1.0D)
{
var newColors = colors.Keys
.Select(val => new KeyValuePair<float, Color>(val, Utils.ColorUtils.MultiplyColorByScalar(colors[val], opacity)))
.Select(val => new KeyValuePair<float, Color>(val, ColorUtils.MultiplyColorByScalar(colors[val], opacity)))
.OrderBy(val => val.Key)
.ToList();

Expand All @@ -242,7 +243,7 @@ public LinearGradientBrush ToLinearGradient(float width, float height = 0.0f, fl
.OrderBy(val => val.Key)
.ToList();

var endColor = Utils.ColorUtils.BlendColors(
var endColor = ColorUtils.BlendColors(
newColors.First().Value, newColors.Last().Value,
((double) (newColors.First().Key) / (double) (newColors.First().Key + 1.0f - newColors.Last().Key)));

Expand Down Expand Up @@ -288,7 +289,7 @@ public ColorSpectrum MultiplyByScalar(double scalar)
Dictionary<float, Color> newcolors = new Dictionary<float, Color>();

foreach (KeyValuePair<float, Color> kvp in colors)
newcolors[kvp.Key] = Utils.ColorUtils.MultiplyColorByScalar(kvp.Value, scalar);
newcolors[kvp.Key] = ColorUtils.MultiplyColorByScalar(kvp.Value, scalar);

colors = newcolors;

Expand Down
Loading