/// <summary> /// Creates a new instance of <see cref="KanvasImage"/>. /// </summary> /// <param name="encodingDefinition">The encoding definition for the image info.</param> /// <param name="imageInfo">The image info to represent.</param> public KanvasImage(EncodingDefinition encodingDefinition, ImageInfo imageInfo) { ContractAssertions.IsNotNull(encodingDefinition, nameof(encodingDefinition)); ContractAssertions.IsNotNull(imageInfo, nameof(imageInfo)); if (!encodingDefinition.Supports(imageInfo)) { throw new InvalidOperationException("The encoding definition can not support the image info."); } _encodingDefinition = encodingDefinition; ImageInfo = imageInfo; }
/// <summary> /// Creates a new instance of <see cref="KanvasImage"/>. /// </summary> /// <param name="encodingDefinition">The encoding definition for the image info.</param> /// <param name="imageInfo">The image info to represent.</param> public KanvasImage(EncodingDefinition encodingDefinition, ImageInfo imageInfo) { ContractAssertions.IsNotNull(encodingDefinition, nameof(encodingDefinition)); ContractAssertions.IsNotNull(imageInfo, nameof(imageInfo)); if (!encodingDefinition.Supports(imageInfo, out var error)) { throw new InvalidOperationException(error); } EncodingDefinition = encodingDefinition; ImageInfo = imageInfo; }