I’m trying to implement a color picker in a plugin but I can’t find how to output the selected color.
Error is :
Cannot implicitly convert System.Window.Media.Color to VVVV.Utils.VColor.RGBAColor
I found few lines in plugin references about color conversion and I thought it was straight forward :
“There is an implicit cast to the C# Color type and an explictit cast from C# color to RGBAColor.”
Here is the few line which ended with an error on the last line :
var uiElement = (ColorPicker)UIElementOut[i](i);
System.Windows.Media.Color col = new System.Windows.Media.Color();
col = (System.Windows.Media.Color)uiElement.SelectedColor;
ValueOut[i](i) = col;
But one more question ;) if no color are selected in the colorpicker apparently the default outputted color is black. Is there a way to output NIL from output pin by default ?
when I try : ValueOuti = null; Visual Studio tells me that RGBAColor is non nullable.
you should already understand that this is not a precise question since .net obviously comes with two different color types. anyway both of those have a .FromARGB() function which you can use with the individual components of the RGBAColor. see?
Sorry but I don’t “see” really clearly probably because I’m beginning with c# :p
Actually those two lines are giving me the same error :
System.Drawing.Color col = System.Drawing.Color.FromArgb(FBgCol.A, FBgCol.R, FBgCol.G, FBgCol.B);
System.Windows.Media.Color col = System.Windows.Media.Color.FromArgb(FBgCol.A, FBgCol.R, FBgCol.G, FBgCol.B);
‘ISpread’ does not contain a definition for ‘A’ and no extension method ‘A’ accepting a first argument of type ‘ISpread’ could be found (are you missing a using directive or an assembly reference?)
While my RGBAColor comes from this input :
[Input("Background Color", DefaultColor = new double[](Input("Background Color", DefaultColor = new double[) { 0.1, 0.2, 0.3, 1.0 })]
public ISpread<RGBAColor> FBgCol;