Exemple #1
0
    public override CfdgCompiler VisitColor_adjustment([NotNull] CfdgParser.Color_adjustmentContext context)
    {
        var baseColor = currentReplacement.Count > 0 ? currentReplacement.Peek().color : currentGrammar.backgroundColor;

        if (context.HUE() != null)
        {
            baseColor.h = Convert.ToSingle(context.num().GetText());
        }
        else if (context.SATURATION() != null)
        {
            baseColor.s = Convert.ToSingle(context.num().GetText());
        }
        else if (context.BRIGHTNESS() != null)
        {
            baseColor.v = Convert.ToSingle(context.num().GetText());
        }
        else if (context.ALPHA() != null)
        {
            baseColor.a = Convert.ToSingle(context.num().GetText());
        }

        if (currentReplacement.Count > 0)
        {
            currentReplacement.Peek().color = baseColor;
        }
        else
        {
            currentGrammar.backgroundColor = baseColor;
        }

        var result = VisitChildren(context);

        return(result);
    }
Exemple #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="CfdgParser.color_adjustment"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitColor_adjustment([NotNull] CfdgParser.Color_adjustmentContext context)
 {
 }
Exemple #3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="CfdgParser.color_adjustment"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitColor_adjustment([NotNull] CfdgParser.Color_adjustmentContext context)
 {
     return(VisitChildren(context));
 }