/// <summary> /// Returns conversion data for color conversion with specified channel depth conversion data. /// </summary> /// <param name="colorType">Destination color type.</param> /// <param name="depthConversionData">Channel type conversion data.</param> /// <returns>Conversion info.</returns> public static ConversionData <ColorInfo> AsConvertDepth(Type colorType, ConversionData <Type> depthConversionData) { CreateImageFunc creationFunc = depthConversionData.CreateFunc ?? ((srcImg, destColor) => Image.Create(destColor, srcImg.Width, srcImg.Height)); var srcColor = ColorInfo.GetInfo(colorType, depthConversionData.Source); var dstColor = ColorInfo.GetInfo(colorType, depthConversionData.Destination); return(new ConversionData <ColorInfo> ( srcColor, dstColor, depthConversionData.ConvertFunc, depthConversionData.ForceSequential, creationFunc, depthConversionData.Cost )); }
/// <summary> /// Creates new conversion data object (an edge in a graph). /// </summary> /// <param name="source">Source vertex.</param> /// <param name="destination">Destination vertex.</param> /// <param name="convertFunc">Data conversion function.</param> /// <param name="forceSequential">Force conversion to execute sequentially.</param> /// <param name="createFunc">Destination image creation function.</param> /// <param name="cost">Conversion cost.</param> public ConversionData(T source, T destination, ConvertDataFunc convertFunc, bool forceSequential = false, CreateImageFunc createFunc = null, ConversionCost cost = ConversionCost.DataConvert) : base(source, destination) { this.CreateFunc = createFunc; this.ConvertFunc = convertFunc; this.ForceSequential = forceSequential; this.cost = cost; }