public void ColourConverter_ConvertSupportedColour_Succeeds() { Color colour = Color.Blue; IConverter <string, Color> converter = new ColourConverter(); string expectedCode = ColourMap.GetCodeFor(colour); string converted = converter.Convert(colour); Assert.AreEqual(expectedCode, converted); }
public void ConvertsColourToRgbaFloat() { var colour = new Colour(1.0f, 0.5f, 0.25f, 0.125f); var rgbaFloat = ColourConverter.ConvertToRgbaFloat(colour); Assert.Equal(1.0f, rgbaFloat.R); Assert.Equal(0.5f, rgbaFloat.G); Assert.Equal(0.25f, rgbaFloat.B); Assert.Equal(0.125f, rgbaFloat.A); }
public void ConvertsColourToVector4() { var colour = new Colour(1.0f, 0.5f, 0.25f, 0.125f); var vec4 = ColourConverter.ConvertToVec4(colour); Assert.Equal(1.0f, vec4.X); Assert.Equal(0.5f, vec4.Y); Assert.Equal(0.25f, vec4.Z); Assert.Equal(0.125f, vec4.W); }
public void ColourConverter_ConvertSupportedCode_Succeeds() { IConverter <string, Color> converter = new ColourConverter(); foreach (string code in ColourMap.GetAllCodes()) { Color colour = converter.Convert(code); Assert.AreEqual(ColourMap.GetColourFor(code), colour); } }
public void ClearColour(ulong target, Colour colour) { _commandQueue.Add( RenderCommandType.ClearColourTarget, 0UL, target, 0UL, 0UL, 0UL, 0UL, 0UL, ColourConverter.ConvertToRgbaFloat(colour)); }
public void ClearColour(IRenderTarget target, Colour colour) { if (target == null) { throw new Yak2DException("Cannot clear render target Colour. Target null", new ArgumentNullException()); } _commandQueue.Add( RenderCommandType.ClearColourTarget, 0UL, target.Id, 0UL, 0UL, 0UL, 0UL, 0UL, ColourConverter.ConvertToRgbaFloat(colour)); }
private void UpdateBufferAndClearColour() { ClearColour = ColourConverter.ConvertToRgbaFloat(_current.BackgroundClearColour); var factors = new ColourEffectFactors { SingleColourAmount = _current.SingleColour, GrayScaleAmount = _current.GrayScale, ColouriseAmount = _current.Colourise, NegativeAmount = _current.Negative, Colour = ColourConverter.ConvertToVec4(_current.ColourForSingleColourAndColourise), Opacity = _current.Opacity, Pad0 = 0.0f, Pad1 = 0.0f, Pad2 = 0.0f, Pad3 = Vector4.Zero }; _systemComponents.Device.UpdateBuffer(_factorsBuffer, 0, ref factors); }
public void ColourConverter_ConvertUnsupportedColour_ThrowsUnsupportedColourException() { IConverter <string, Color> converter = new ColourConverter(); converter.Convert(Color.Beige); }
public void ColourConverter_ConvertUnsopportedCode_ThrowsInvalidColourCodeException(string code) { IConverter <string, Color> converter = new ColourConverter(); converter.Convert(code); }