/// <summary>
        /// Gets the value the given CellColorTriple maps onto.
        /// </summary>
        /// <param name="first">
        /// The first element of the input triple.
        /// </param>
        /// <param name="second">
        /// The second element of the input triple.
        /// </param>
        /// <param name="third">
        /// The third element of the input triple.
        /// </param>
        /// <value>The value to map the given input triple onto.</value>
        private void Set(bool first, bool second, bool third, bool value)
        {
            var triple = new CellColorTriple(
                first  ? CellColor.Black : CellColor.White,
                second ? CellColor.Black : CellColor.White,
                third  ? CellColor.Black : CellColor.White
                );

            this.colorMap[triple] = value ? CellColor.Black : CellColor.White;
        }
        /// <summary>
        /// Maps the given CellColorTriple onto a single value using the lookup table.
        /// </summary>
        /// <param name="first">
        /// The first element of the input triple.
        /// </param>
        /// <param name="second">
        /// The second element of the input triple.
        /// </param>
        /// <param name="third">
        /// The third element of the input triple.
        /// </param>
        /// <returns>
        /// The mapped value.
        /// </returns>
        private bool MapBool(bool first, bool second, bool third)
        {
            var triple = new CellColorTriple(
                first  ? CellColor.Black : CellColor.White,
                second ? CellColor.Black : CellColor.White,
                third  ? CellColor.Black : CellColor.White
                );

            return(this.colorMap[triple] == CellColor.Black);
        }
Beispiel #3
0
        private Brush GetCellFill(Brush brushA, Brush brushB, Brush brushC)
        {
            var triple = new CellColorTriple(
                ConvertToColor(brushA),
                ConvertToColor(brushB),
                ConvertToColor(brushC)
                );

            return(GetCellColor(triple));
        }
Beispiel #4
0
        private Brush GetCellColor(CellColorTriple triple)
        {
            CellColor color = this.patternTable.Map(triple);

            if (color == CellColor.White)
            {
                return(brushA);
            }
            else
            {
                return(brushB);
            }
        }
 /// <summary>
 /// Maps the given CellColorTriple onto a single value using the lookup table.
 /// </summary>
 /// <param name="triple">
 /// The input triple.
 /// </param>
 /// <returns>
 /// The mapped value.
 /// </returns>
 private bool MapBool(CellColorTriple triple)
 {
     return(this.colorMap[triple] == CellColor.Black);
 }
 /// <summary>
 /// Maps the given CellColorTriple onto a single CellColor using the lookup table.
 /// </summary>
 /// <param name="triple">
 /// The input triple.
 /// </param>
 /// <returns>
 /// The mapped color.
 /// </returns>
 public CellColor Map(CellColorTriple triple)
 {
     return(colorMap[triple]);
 }