private void _32bitRadioButton_Checked(object sender, RoutedEventArgs e) { if (this.IsLoaded) { channelDepth = ImageBitDepth.float32bit; ResetServer(); } }
public void ShouldCorrectlyMaintainParametersProvidedWhenCreated() { // Given const int width = 256; const int height = 512; const ImageBitDepth imageBitDepth = ImageBitDepth.Bpp12; // When var imageModel = new ImageModel(width, height, imageBitDepth); // Then Assert.AreEqual(width, imageModel.Width); Assert.AreEqual(height, imageModel.Height); Assert.AreEqual(imageBitDepth, imageModel.ImageBitDepth); }
private void InitializeMinMaxValues(ImageBitDepth imageBitDepth) { _minValue = 0; switch (imageBitDepth) { case ImageBitDepth.Bpp8: _maxValue = 255; break; case ImageBitDepth.Bpp12: _maxValue = 4095; break; default: throw new ArgumentOutOfRangeException(nameof(imageBitDepth), imageBitDepth, null); } }
public Pixel ConvertToBitDepth(ImageBitDepth bitDepthFrom, ImageBitDepth bitDepthTo) { if (bitDepthFrom == bitDepthTo) { return(_value); } if (bitDepthFrom == ImageBitDepth.Bpp8 && bitDepthTo == ImageBitDepth.Bpp12) { return(_value << 4); } if (bitDepthFrom == ImageBitDepth.Bpp12 && bitDepthTo == ImageBitDepth.Bpp8) { return(_value >> 4); } throw new InvalidOperationException(); }
public void ShouldCorrectlyGenerateHashCode() { // Given const int width = 256; const int height = 512; const ImageBitDepth imageBitDepth = ImageBitDepth.Bpp12; var imageModel = new ImageModel(width, height, imageBitDepth); int expected; unchecked { expected = width; expected = (expected * 397) ^ height; expected = (expected * 397) ^ (int)imageBitDepth; } // When var actual = imageModel.GetHashCode(); // Then Assert.AreEqual(expected, actual); }
public ImageModel(ushort width, ushort height, ImageBitDepth imageBitDepth) { Width = width; Height = height; ImageBitDepth = imageBitDepth; }
private void _8bitRadioButton_Checked(object sender, RoutedEventArgs e) { if (this.IsLoaded) { channelDepth = ImageBitDepth.unsigned8bit; ResetServer(); } }