aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs')
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs84
1 files changed, 4 insertions, 80 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
index ef275479b..1f8cf6ada 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/DefaultGradientGenerationConfiguration.cs
@@ -9,7 +9,6 @@ using Tango.BL.Enumerations;
using Tango.ColorConversion;
using Tango.Core;
using Tango.Core.ExtensionMethods;
-using Tango.PMR.ColorLab;
namespace Tango.Integration.Operation
{
@@ -57,8 +56,6 @@ namespace Tango.Integration.Operation
ResolutionCM = 500;
}
- #region Standard Method
-
/// <summary>
/// Creates a collection of brush stops representing the required gradient steps.
/// </summary>
@@ -69,11 +66,6 @@ namespace Tango.Integration.Operation
/// <returns></returns>
public List<BrushStop> Generate(Segment segment, Job job, ProcessParametersTable processParameters, Action<PreparingJobProgressEventArgs> progress = null)
{
- if (processParameters.ProcessParametersTablesGroup.Rml.UseColorLibGradients)
- {
- return GenerateUsingColorLib(segment, job, processParameters, progress);
- }
-
aborted = false;
List<BrushStop> stops = new List<BrushStop>();
@@ -100,18 +92,16 @@ namespace Tango.Integration.Operation
stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
}
- if ((stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB) && !stop.IsTransparent && !stop.IsWhite)
+ if (stop.BrushColorSpace == ColorSpaces.RGB || stop.BrushColorSpace == ColorSpaces.LAB)
{
- var output = converter.Convert(stop, false);
+ var output = converter.Convert(segment.Job, stop.Color, false);
output.ApplyOnBrushStop(stop, processParameters);
}
}
var refStop = clonedStops.First().Clone(segment);
- decimal segment_length = (decimal)segment.Length;
-
- for (decimal cm = 0; cm <= segment_length; cm += (ResolutionCM / 100M))
+ for (double cm = 0; cm <= segment.Length; cm += (ResolutionCM / 100d))
{
if (aborted) return stops;
@@ -137,7 +127,7 @@ namespace Tango.Integration.Operation
{
Job = job,
Total = job.Segments.Sum(x => x.Length),
- Progress = previousSegmentsLength + (double)cm,
+ Progress = previousSegmentsLength + cm,
});
}
@@ -240,72 +230,6 @@ namespace Tango.Integration.Operation
return color;
}
- #endregion
-
- #region ColorLib Method
-
- public List<BrushStop> GenerateUsingColorLib(Segment segment, Job job, ProcessParametersTable processParameters, Action<PreparingJobProgressEventArgs> progress = null)
- {
- aborted = false;
-
- List<BrushStop> stops = segment.BrushStops.Select(x => x.Clone()).ToList();
-
- var refStop = segment.BrushStops.First().Clone(segment);
-
- IColorConverter converter = new DefaultColorConverter();
-
- foreach (var stop in stops)
- {
- if (aborted) return stops;
-
- if (stop.LiquidVolumes == null)
- {
- stop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
- }
- }
-
- var conversionOutput = converter.GenerateGradient(stops, segment.Length, job.Rml, job.Machine.Configuration);
-
- List<BrushStop> newStops = new List<BrushStop>();
-
- int stopIndex = 1;
-
- foreach (var stop in conversionOutput.Stops)
- {
- var newStop = refStop.Clone(segment);
-
- newStop.OffsetPercent = stop.Offset * 100d;
- newStop.OffsetMeters = segment.Length * stop.Offset;
- newStop.StopIndex = stopIndex++;
-
- newStop.SetVolume(LiquidTypes.Cyan, GetStopVolume(stop, PMR.ColorLab.LiquidType.Cyan));
- newStop.SetVolume(LiquidTypes.Magenta, GetStopVolume(stop, PMR.ColorLab.LiquidType.Magenta));
- newStop.SetVolume(LiquidTypes.Yellow, GetStopVolume(stop, PMR.ColorLab.LiquidType.Yellow));
- newStop.SetVolume(LiquidTypes.Black, GetStopVolume(stop, PMR.ColorLab.LiquidType.Black));
-
- newStop.SetLiquidVolumes(job.Machine.Configuration, job.Rml, processParameters);
-
- newStops.Add(newStop);
- }
-
- progress?.Invoke(new PreparingJobProgressEventArgs()
- {
- Job = job,
- Total = 100,
- Progress = 100,
- });
-
- return newStops;
- }
-
- private double GetStopVolume(GradientOutputStop stop, PMR.ColorLab.LiquidType liquidType)
- {
- var liquid = stop.OutputLiquids.SingleOrDefault(x => x.LiquidType == liquidType);
- return liquid != null ? liquid.Volume : 0;
- }
-
- #endregion
-
/// <summary>
/// Aborts the current generation.
/// </summary>