Exemple #1
0
 public IColorExpression Subtract(
     IColorValue term1,
     params IColorValue[] terms)
 => new ColorExpression(
     ListUtil.ReadonlyFrom(
         this,
         this.NegateTerms(term1, terms)));
 private void PrintColorValue_(
     StringWriter os,
     IColorValue value,
     bool wrapExpressions = false)
 {
     if (value is IColorExpression expression)
     {
         if (wrapExpressions)
         {
             os.Write("(");
         }
         this.PrintColorExpression_(os, expression);
         if (wrapExpressions)
         {
             os.Write(")");
         }
     }
     else if (value is IColorTerm term)
     {
         this.PrintColorTerm_(os, term);
     }
     else if (value is IColorFactor factor)
     {
         this.PrintColorFactor_(os, factor);
     }
     else
     {
         Asserts.Fail("Unsupported value type!");
     }
 }
Exemple #3
0
 public IColorTerm Divide(
     IColorValue factor1,
     params IColorValue[] factors)
 => new ColorTerm(this.NumeratorFactors,
                  ListUtil.ReadonlyConcat(
                      this.DenominatorFactors,
                      ListUtil.ReadonlyFrom(factor1, factors)));
        public string Print(IColorValue colorValue)
        {
            var sb = new StringBuilder();

            using var os = new StringWriter(sb);
            this.PrintColorValue_(os, colorValue);

            return(sb.ToString());
        }
Exemple #5
0
        public ShaderLabColorReference(IColorElement colorElement, IColorPropertyValue colorPropertyValue, IColorValue colorValue, DocumentRange colorConstantRange)
        {
            myColorPropertyValue = colorPropertyValue;
            myColorValue         = colorValue;
            ColorElement         = colorElement;
            Owner = (ITreeNode)colorValue ?? colorPropertyValue;
            ColorConstantRange = colorConstantRange;

            BindOptions = new ColorBindOptions
            {
                BindsToName  = false,
                BindsToValue = true
            };
        }
Exemple #6
0
 private void widget_PointEventChanged(object sender, PointColorEvent e)
 {
     this.UpDateData(delegate
     {
         IColorValue colorValue = this._propertyItem.Instance as IColorValue;
         if (e.Type == 0)
         {
             this._propertyItem.SetValue("ColorAngle", (float)e.Value, null);
         }
         else
         {
             this._propertyItem.SetValue("BackColorAlpha", (int)e.Value, null);
         }
     });
 }
 private void widget_PointEventChanged(object sender, PointColorEvent e)
 {
     this.UpDateData((System.Action)(() =>
     {
         IColorValue instance = this._propertyItem.Instance as IColorValue;
         if (e.Type == 0)
         {
             this._propertyItem.SetValue("ColorAngle", (object)(float)e.Value, (object[])null);
         }
         else
         {
             this._propertyItem.SetValue("BackColorAlpha", (object)(int)e.Value, (object[])null);
         }
     }));
 }
 private void SetControl()
 {
     this.widget.SetValue((System.Action)(() =>
     {
         IColorValue instance             = this._propertyItem.Instance as IColorValue;
         System.Drawing.Color singleColor = instance.SingleColor;
         int comboBoxIndex = instance.ComboBoxIndex;
         System.Drawing.Color firstColor = instance.FirstColor;
         System.Drawing.Color endColor   = instance.EndColor;
         ScaleValue colorVector          = instance.ColorVector;
         float num = (float)this._propertyItem.Instance.GetType().GetProperty("ColorAngle").GetValue(this._propertyItem.Instance, (object[])null);
         this.widget.SetControl(this.ConvertColor(singleColor), comboBoxIndex, this.ConvertColor(firstColor), this.ConvertColor(endColor), (int)num);
         this.SetBgColor();
     }));
 }
Exemple #9
0
 private void SetControl()
 {
     this.widget.SetValue(delegate
     {
         IColorValue colorValue           = this._propertyItem.Instance as IColorValue;
         System.Drawing.Color singleColor = colorValue.SingleColor;
         int comboBoxIndex = colorValue.ComboBoxIndex;
         System.Drawing.Color firstColor = colorValue.FirstColor;
         System.Drawing.Color endColor   = colorValue.EndColor;
         ScaleValue colorVector          = colorValue.ColorVector;
         PropertyInfo property           = this._propertyItem.Instance.GetType().GetProperty("ColorAngle");
         float num = (float)property.GetValue(this._propertyItem.Instance, null);
         this.widget.SetControl(this.ConvertColor(singleColor), comboBoxIndex, this.ConvertColor(firstColor), this.ConvertColor(endColor), (int)num);
         this.SetBgColor();
     });
 }
Exemple #10
0
 public IColorTerm Multiply(
     IColorValue factor1,
     params IColorValue[] factors)
 => new ColorTerm(ListUtil.ReadonlyConcat(
                      this.NumeratorFactors,
                      ListUtil.ReadonlyFrom(factor1, factors)));
Exemple #11
0
 public IColorExpression Add(
     IColorValue term1,
     params IColorValue[] terms)
 => new ColorExpression(ListUtil.ReadonlyConcat(this.Terms, terms));
Exemple #12
0
 protected IColorValue[] NegateTerms(
     IColorValue term1,
     params IColorValue[] terms)
 => this.NegateTerms(ListUtil.From(term1, terms).ToArray());
Exemple #13
0
 public IColorTerm Divide(
     IColorValue factor1,
     params IColorValue[] factors)
 => new ColorTerm(ListUtil.ReadonlyFrom(this),
                  ListUtil.ReadonlyFrom(factor1, factors));
Exemple #14
0
 public IColorTerm Multiply(
     IColorValue factor1,
     params IColorValue[] factors)
 => new ColorTerm(ListUtil.ReadonlyFrom(this, factor1, factors));
Exemple #15
0
 public IColorExpression Add(
     IColorValue term1,
     params IColorValue[] terms)
 => new ColorExpression(ListUtil.ReadonlyFrom(this, term1, terms));
Exemple #16
0
 public ColorOutput(TIdentifier identifier, IColorValue value)
 {
     this.Identifier = identifier;
     this.ColorValue = value;
 }