private static ObjectHandle CreateHandle(PackagingBytes packagingBytes, RgbaComponents components, RgbaUintBitCount bitCount) { if (packagingBytes == null) { throw new ArgumentNullException(nameof(packagingBytes)); } if (components == null) { throw new ArgumentNullException(nameof(components)); } if (bitCount == null) { throw new ArgumentNullException(nameof(bitCount)); } var unmanagedPackagingBytes = new Import.PackagingBytes { byteCount = (uint)packagingBytes.ByteCount, endianness = packagingBytes.Endianness.GetUnmanagedEndianness() }; var unmanagedComponents = new Import.RgbaComponents { r = components.Red.GetUnmanagedComponent(), g = components.Green.GetUnmanagedComponent(), b = components.Blue.GetUnmanagedComponent(), a = components.Alpha.GetUnmanagedComponent(), }; var unmanagedBitCount = new Import.RgbaUintBitCount { r = bitCount.Red, g = bitCount.Green, b = bitCount.Blue, a = bitCount.Alpha, }; return(Api.RgbaUintFormatCreate(ref unmanagedPackagingBytes, ref unmanagedComponents, ref unmanagedBitCount)); }
/// <summary> /// Constructs new object <see cref="RgbaUintFormat"/> /// </summary> /// <param name="packagingBytes">Packaging bytes</param> /// <param name="components">Map RGB channels</param> /// <param name="bitCount">Bits per channel</param> /// <exception cref="ArgumentNullException">one or some arguments is null</exception> public RgbaUintFormat(PackagingBytes packagingBytes, RgbaComponents components, RgbaUintBitCount bitCount) : base(CreateHandle(packagingBytes, components, bitCount)) { }