< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Common.Components.ImageByteArray
Assembly: ReFlex.Core.Common
File(s): D:\a\reflex\reflex\library\src\Core\Common\Components\ImageByteArray.cs
Line coverage
100%
Covered lines: 23
Uncovered lines: 0
Coverable lines: 23
Total lines: 70
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%44100%
get_ImageData()100%11100%
get_BytesPerChannel()100%11100%
get_NumChannels()100%11100%
get_Width()100%11100%
get_Height()100%11100%
get_Format()100%11100%

File(s)

D:\a\reflex\reflex\library\src\Core\Common\Components\ImageByteArray.cs

#LineLine coverage
 1using System;
 2using ReFlex.Core.Common.Util;
 3
 4namespace ReFlex.Core.Common.Components
 5{
 6    public class ImageByteArray
 7    {
 8        /// <summary>
 9        /// Initializes all class members
 10        /// </summary>
 11        /// <param name="imageData">byte data containing the image. Must not be null and has to be of sufficient size (w
 12        /// <param name="width">the width of the image in pixel</param>
 13        /// <param name="height">the height od the image in pixel</param>
 14        /// <param name="bytesPerChannel">the number of bytes used per color channel</param>
 15        /// <param name="numChannels">the number of channels used</param>
 16        /// <param name="format"><see cref="DepthImageFormat"/> for encoding / decoding</param>
 17        /// <exception cref="NullReferenceException">if imageData is null</exception>
 18        /// <exception cref="ArgumentException">if size of imageData is incorrect</exception>
 819        public ImageByteArray(byte[] imageData,
 820            int width, int height,
 821            uint bytesPerChannel, uint numChannels,
 822            DepthImageFormat format = DepthImageFormat.Rgb24bpp)
 823        {
 824            if (imageData == null)
 125                throw new NullReferenceException($"Provided value for {nameof(imageData)} must not be null.");
 26
 727            if (imageData.Length != width * height * bytesPerChannel * numChannels)
 528                throw new ArgumentException(
 529                    $"Wrong size of {nameof(imageData)}: provided size of {imageData.Length} does not meet the required 
 30
 231            ImageData = imageData;
 232            BytesPerChannel = bytesPerChannel;
 233            NumChannels = numChannels;
 234            Width = width;
 235            Height = height;
 236            Format = format;
 237        }
 38
 39        /// <summary>
 40        ///     Array containing the image data as bytes. Array is assigned in constructor and has the size <see cref="W
 41        ///     <see cref="Height" /> x <see cref="BytesPerChannel" />.
 42        /// </summary>
 343        public byte[] ImageData { get; }
 44
 45        /// <summary>
 46        /// Number of bytes used for each color channell
 47        /// </summary>
 248        public uint BytesPerChannel { get; }
 49
 50        /// <summary>
 51        /// Number of color channels
 52        /// </summary>
 253        public uint NumChannels { get; }
 54
 55        /// <summary>
 56        /// Width of the image in Pixel
 57        /// </summary>
 258        public int Width { get; }
 59
 60        /// <summary>
 61        /// Height of the image in Pixel
 62        /// </summary>
 263        public int Height { get; }
 64
 65        /// <summary>
 66        /// <see cref="DepthImageFormat"/> for encoding / decoding
 67        /// </summary>
 268        public DepthImageFormat Format { get; }
 69    }
 70}