21 private readonly PixelFormatDefinition _pixelFormatInfo;
29 _pixelFormatInfo = PixelFormatDefinition.FormatMap[pixelFormat];
38 _pixelFormatInfo = PixelFormatDefinition.NameMap[name];
77 public string Name => _pixelFormatInfo.Name;
112 public bool IsFloat => _pixelFormatInfo.IsFloat;
188 if (typeof(T) == typeof(
float) &&
IsFloat)
190 return (T) (object)
float.MinValue;
193 if (typeof(T) == typeof(
int) && !
IsFloat)
195 return (T) (object) 0;
198 var expectedType =
IsFloat ?
"float" :
"int";
200 $
"Minimum value type {expectedType} of format {Name} does not match requested type {typeof(T).Name}");
224 if (typeof(T) == typeof(
float) &&
IsFloat)
226 return (T) (object)
float.MaxValue;
229 if (typeof(T) == typeof(
int) && !
IsFloat)
234 var expectedType =
IsFloat ?
"float" :
"int";
236 $
"Maximum value type {expectedType} of format {Name} does not match requested type {typeof(T).Name}");
258 return Array.IndexOf(
Channels, channel);
293 if (ReferenceEquals(
this, obj))
330 return Formatting.Invariant($
"{GetType().Name}{{ {nameof(PixelFormat)} = {PixelFormat} }}");
Exception thrown when an invalid parameter is detected.
T Width
Gets the width of the size.
T Height
Gets the height of the size.
Represents a size with integer width and height values.
Channel
Represents the various data channels in image or spatial data formats. /// This enumeration defines s...
PixelFormat
Each enumerator represents a specific pixel layout and bit-depth, used for interpreting raw image dat...