Esempio n. 1
0
        public void ProcessWithColorhelper_IncorrectCombination_ArgumentExceptionThrown()
        {
            var processor = new Processor();
            IColor color1 = new Blue();
            IColor color2 = new Red();

            Assert.Throws(typeof(ArgumentException), () => new ColorHelper().Process(color1, color2, processor));
        }
Esempio n. 2
0
        public void Process_IncorrectCombination_ArgumentExceptionThrown()
        {
            var processor = new Processor();
            IColor color1 = new Blue();
            IColor color2 = new Red();

            Assert.Throws(typeof (ArgumentException), () => color1.AcceptProcessor(color2, processor));
        }
    void Start()
    {
        red = this.gameObject.GetComponent<Red>();
        green = this.gameObject.GetComponent<Green>();
        blue = this.gameObject.GetComponent<Blue>();

        gray = this.gameObject.GetComponent<Grayscale>();
        lastSwitch = Time.time;

        current = "grey";
    }
    public static void Main(string[] args){

        Background background = new Background();

        Color yellow = new Yellow("color yellow");
        Color blue = new Blue("color blue");
        Color red = new Red("color red");

        background.setBackground(yellow);
        background.setBackground(blue);
        background.setBackground(red);
    }
Esempio n. 5
0
 public GameState(Pacman pacman, Red red, Pink pink, Blue blue, Brown brown)
 {
     if (!mapsHaveBeenPreloaded)
     {
         PreloadMazes();
     }
     maps        = GameState.preloadedMaps;
     map         = maps[Level];
     this.Pacman = pacman;
     Ghosts[0]   = this.Red = red;
     Ghosts[1]   = this.Pink = pink;
     Ghosts[2]   = this.Blue = blue;
     Ghosts[3]   = this.Brown = brown;
 }
Esempio n. 6
0
    static void Main(string[] args)
    {
        // client code
        Color c1  = new Red();
        Cube  cu1 = new Cube(c1, 5);

        cu1.print();

        Color  c2 = new Blue();
        Sphere s1 = new Sphere(c2, 5.0);

        s1.print();
        Console.WriteLine(s1.volume());
    }
Esempio n. 7
0
 public GameState()
 {
     if (!mapsHaveBeenPreloaded)
     {
         PreloadMazes();
     }
     maps = GameState.preloadedMaps;
     map  = maps[Level];
     // default position ... find out where
     Pacman    = new Pacman(Pacman.StartX, Pacman.StartY, this);
     Ghosts[0] = Red = new Red(Red.StartX, Red.StartY, this);
     Ghosts[1] = Pink = new Pink(Pink.StartX, Pink.StartY, this);
     Ghosts[2] = Blue = new Blue(Blue.StartX, Blue.StartY, this);
     Ghosts[3] = Brown = new Brown(Brown.StartX, Brown.StartY, this);
 }
Esempio n. 8
0
        /// <summary>
        /// Prints all built-in styles for quick browsing.
        /// </summary>
        public static void PrintDemo()
        {
            NewPara();

            Write("Standard:   ")
            .Red.Write("Red").Default.Write("         ")
            .Green.Write("Green").Default.Write("    ")
            .Blue.Write("Blue").Default.Write("        ")
            .Cyan.Write("Cyan").Default.Write("          ")
            .Yellow.Write("Yellow").Default.Write("        ")
            .Gold.Write("Gold").Default.Write("      ")
            .Muted.Write("Muted").Default.Write("    ")
            .Bright.WriteLine("Bright");

            Write("Messaging:  ")
            .Error.Write("Error").Default.Write("       ")
            .OK.Write("OK").Default.Write("       ")
            .Warning.Write("Warning").Default.Write("     ")
            .Tag.Write("Tag").Default.Write("           ")
            .Note.Write("Note").Default.Write("          ")
            .Tip.Write("Tip").Default.Write("       ")
            .Label.Write("Label").Default.Write("    ")
            .Terminal.WriteLine("Terminal");

            Write("Extended:   ")
            .Graphite.Write("Graphite").Default.Write("    ")
            .Azure.Write("Azure").Default.Write("    ")
            .Eggplant.Write("Eggplant").Default.Write("    ")
            .Strawberry.Write("Strawberry").Default.Write("    ")
            .Watermelon.Write("Watermelon").Default.Write("    ")
            .Squash.Write("Squash").Default.Write("    ")
            .Lime.Write("Lime").Default.Write("     ")
            .Tomato.WriteLine("Tomato");

            NewPara();

            Console.WriteLine("Standard:\tMessaging:\tExtended:");
            Red.Write("Red\t\t").Error.Write("Error\t\t").Graphite.WriteLine("Graphite");
            Green.Write("Green\t\t").OK.Write("OK\t\t").Azure.WriteLine("Azure");
            Blue.Write("Blue\t\t").Warning.Write("Warning\t\t").Eggplant.WriteLine("Eggplant");
            Cyan.Write("Cyan\t\t").Tag.Write("Tag\t\t").Strawberry.WriteLine("Strawberry");
            Yellow.Write("Yellow\t\t").Tip.Write("Tip\t\t").Squash.WriteLine("Squash");
            Gold.Write("Gold\t\t").Note.Write("Note\t\t").Watermelon.WriteLine("Watermelon");
            Muted.Write("Muted\t\t").Label.Write("Label\t\t").Lime.WriteLine("Lime");
            Bright.Write("Bright\t\t").Terminal.Write("Terminal\t").Tomato.WriteLine("Tomato");

            NewPara();
        }
Esempio n. 9
0
        /// <summary>Converts the current instance to an equivalent <see cref="string" /> value.</summary>
        /// <param name="format">The format to use or <c>null</c> to use the default format.</param>
        /// <param name="formatProvider">The provider to use when formatting the current instance or <c>null</c> to use the default provider.</param>
        /// <returns>An equivalent <see cref="string" /> value for the current instance.</returns>
        public string ToString(string?format, IFormatProvider?formatProvider)
        {
            var separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator;

            return(new StringBuilder(7 + (separator.Length * 2))
                   .Append('<')
                   .Append(Red.ToString(format, formatProvider))
                   .Append(separator)
                   .Append(' ')
                   .Append(Green.ToString(format, formatProvider))
                   .Append(separator)
                   .Append(' ')
                   .Append(Blue.ToString(format, formatProvider))
                   .Append('>')
                   .ToString());
        }
Esempio n. 10
0
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Red", true, out subEle);
            subEle.Value = Red.ToString();

            ele.TryPathTo("Green", true, out subEle);
            subEle.Value = Green.ToString();

            ele.TryPathTo("Blue", true, out subEle);
            subEle.Value = Blue.ToString();

            ele.TryPathTo("Alpha_Unused", true, out subEle);
            subEle.Value = Alpha_Unused.ToString();
        }
Esempio n. 11
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Id != null ? Id.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Type.GetHashCode();
         hashCode = (hashCode * 397) ^ (Info != null ? Info.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Priority.GetHashCode();
         hashCode = (hashCode * 397) ^ Blue.GetHashCode();
         hashCode = (hashCode * 397) ^ (Location != null ? Location.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Destination != null ? Destination.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Units != null ? Units.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (NextStateAction != null ? NextStateAction.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 12
0
    // Use this for initialization
    void Start()
    {
        obj_Red  = new HashSet <GameObject>(GameObject.FindGameObjectsWithTag("Red"));
        obj_Blue = new HashSet <GameObject>(GameObject.FindGameObjectsWithTag("Blue"));

        foreach (GameObject Red in obj_Red)
        {
            Red.SetActive(false);
            Debug.Log("Red Object(s) are hidden");
        }

        foreach (GameObject Blue in obj_Blue)
        {
            Blue.SetActive(true);
        }

        obj_is_red = false;
    }
Esempio n. 13
0
    void Update()
    {
        if (StartGame.Clicked && !End)
        {
            if (RedCube.transform.position.y < -25f)
            {
                Blue++;
                BlueScore.text = Blue.ToString();
            }

            if (BlueCube.transform.position.y < -25f)
            {
                Red++;
                RedScore.text = Red.ToString();
            }
            StartCoroutine(Win());
        }
    }
Esempio n. 14
0
        private void GameLoop_SaveLoaded(object sender, SaveLoadedEventArgs e)
        {
            this.Player = new Player(Game1.player, this.Helper);

            // Set up everything else
            BlueConfig blueConfig = new BlueConfig(this.Player.HasSeenEvent(Blue.EVENT_ID));

            this.BlueFarmAnimals = new Blue(blueConfig);

            VoidConfig voidConfig = new VoidConfig(this.Config.VoidFarmAnimalsInShop, this.Player.HasCompletedQuest(Void.QUEST_ID));

            this.VoidFarmAnimals = new Void(voidConfig);

            Dictionary <Stock.Name, string[]> available = this.Config.MapFarmAnimalsToAvailableAnimalShopStock();
            StockConfig stockConfig = new StockConfig(available, this.BlueFarmAnimals, this.VoidFarmAnimals);
            Stock       stock       = new Stock(stockConfig);

            this.AnimalShop = new AnimalShop(stock);
        }
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Time", true, out subEle);
            subEle.Value = Time.ToString("G15");

            ele.TryPathTo("Color/Red", true, out subEle);
            subEle.Value = Red.ToString("G15");

            ele.TryPathTo("Color/Green", true, out subEle);
            subEle.Value = Green.ToString("G15");

            ele.TryPathTo("Color/Blue", true, out subEle);
            subEle.Value = Blue.ToString("G15");

            ele.TryPathTo("Color/Alpha", true, out subEle);
            subEle.Value = Alpha.ToString("G15");
        }
Esempio n. 16
0
    public void ChangeGameState()
    {
        // which objects will be active
        bool blue_active = !obj_is_red;
        bool red_active  = obj_is_red;

        // update game state
        obj_is_red = !obj_is_red;
        foreach (GameObject Red in obj_Red)
        {
            //Debug.Log(light);
            Red.SetActive(red_active);
        }

        foreach (GameObject Blue in obj_Blue)
        {
            //Debug.Log(dark);
            Blue.SetActive(blue_active);
        }
    }
Esempio n. 17
0
        public override IColor GetColor(ColorType colorType)
        {
            IColor color = null;

            switch (colorType)
            {
            case ColorType.Blue:
                color = new Blue();
                break;

            case ColorType.Green:
                color = new Green();
                break;

            case ColorType.Red:
                color = new Red();
                break;
            }
            return(color);
        }
Esempio n. 18
0
        public int CompareTo(IncidentItem other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            var assignmentComparison = IsUnitAssignedToTask.CompareTo(other.IsUnitAssignedToTask);

            if (assignmentComparison != 0)
            {
                return(-assignmentComparison);
            }

            var blueComparison = Blue.CompareTo(other.Blue);

            if (blueComparison != 0)
            {
                return(-blueComparison);
            }

            var priorityComparison = Priority.CompareTo(other.Priority);

            if (priorityComparison != 0)
            {
                return(-priorityComparison);
            }

            var typeComparison = Nullable.Compare(Type, other.Type);

            if (typeComparison != 0)
            {
                return(typeComparison);
            }

            return(string.Compare(Info, other.Info, StringComparison.OrdinalIgnoreCase));
        }
Esempio n. 19
0
    void OnMouseUp()
    {
        if (blueControl == true)
        {
            Blue.SetActive(true);
            score         += 8;
            scoreText.text = "Score: " + score;
            counter++;
            Destroy(this.gameObject);
        }
        if (redControl == true)
        {
            Red.SetActive(true);
            score         += 8;
            scoreText.text = "Score: " + score;
            counter++;
            Destroy(this.gameObject);
        }
        if (greenControl == true)
        {
            Green.SetActive(true);
            score         += 8;
            scoreText.text = "Score: " + score;
            counter++;
            Destroy(this.gameObject);
        }

        score                     = score - 3;
        scoreText.text            = "Score: " + score;
        this.transform.localScale = new Vector3(20, 20, 20);
        this.transform.position   = startPos;

        if (counter == 3)
        {
            bottles.GetComponent <Animator>().Play("Move2");
        }
        if (counter == 6)
        {
            finish.SetActive(true);
        }
    }
Esempio n. 20
0
        /// <summary>
        /// Gets a bitmap with the RGB histograms
        /// </summary>
        /// <returns>Three histograms for R, G and B values in the Histogram</returns>
        public Image <Rgba32> Visualize()
        {
            int oneColorHeight = 100;
            int margin         = 10;

            float[]  maxValues = new float[] { Red.Max(), Green.Max(), Blue.Max() };
            byte[][] values    = new byte[][] { Red, Green, Blue };


            Image <Rgba32> histogramBitmap = new Image <Rgba32>(276, oneColorHeight * 3 + margin * 4);
            ///Graphics g = Graphics.FromImage(histogramBitmap);
            var rect = new RectangleF(0, 0, histogramBitmap.Width, histogramBitmap.Height);

            histogramBitmap.Mutate(ctx => ctx.Fill(Rgba32.White, rect));
            int yOffset = margin + oneColorHeight;

            for (int i = 0; i < 256; i++)
            {
                for (int color = 0; color < 3; color++)
                {
                    PointF[] points =
                    {
                        new PointF(margin + i, yOffset * (color + 1)),
                        new PointF(margin + i, yOffset * (color + 1) - (values[color][i] / maxValues[color]) * oneColorHeight)
                    };
                    histogramBitmap.Mutate(ctx => ctx.DrawLines(p[color], points));
                }
            }

            for (int i = 0; i < 3; i++)
            {
                var point = new PointF(margin + 11, yOffset * i + margin + margin + 1);
                histogramBitmap.Mutate(ctx => ctx.DrawText(penNames[i] + ", max value: " + maxValues[i], smallCaptionFont, Rgba32.Silver, point));
                point = new PointF(margin + 10, yOffset * i + margin + margin);
                histogramBitmap.Mutate(ctx => ctx.DrawText(penNames[i] + ", max value: " + maxValues[i], smallCaptionFont, Rgba32.Black, point));
                rect = new RectangleF(margin, yOffset * i + margin, 256, oneColorHeight);
                histogramBitmap.Mutate(ctx => ctx.Draw(p[i], rect));
            }

            return(histogramBitmap);
        }
Esempio n. 21
0
        private bool CheckSample(byte r, byte g, byte b)
        {
            if (Red == null)
            {
                return(false);
            }

            if (!Red.IsAcceptableValue(r))
            {
                return(false);
            }
            if (!Green.IsAcceptableValue(g))
            {
                return(false);
            }
            if (!Blue.IsAcceptableValue(b))
            {
                return(false);
            }

            if (Hue.State != ConditionState.NotUsed || Saturation.State != ConditionState.NotUsed ||
                Luminosity.State != ConditionState.NotUsed)
            {
                var hsl = HslConversion.FromRgb(r, g, b);

                if (!Hue.IsAcceptableValue((int)Math.Round(hsl.Item1)))
                {
                    return(false);
                }
                if (!Saturation.IsAcceptableValue((int)Math.Round(hsl.Item2)))
                {
                    return(false);
                }
                if (!Luminosity.IsAcceptableValue((int)Math.Round(hsl.Item3)))
                {
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 22
0
        public IColor Create(ColorType color)
        {
            IColor instance;

            switch (color)
            {
            case ColorType.Blue:
                instance = new Blue();
                break;

            case ColorType.Red:
                instance = new Red();
                break;

            default:
                instance = null;
                break;
            }

            return(instance);
        }
Esempio n. 23
0
        private void PrintResult(TimeSpan time, bool isSorted, string sortName, int elemCount)
        {
            Cyan.Write(sortName);
            Console.Write(" on ");
            DarkCyan.Write(elemCount.ToString("N0"));

            Console.Write(" elements finished in ");
            Blue.Write(time.ToString());

            Console.Write(". Array is sorted: ");
            if (isSorted)
            {
                Green.WriteLine("✓");
            }
            else
            {
                Red.WriteLine("×");
            }

            Timer.Reset();
        }
Esempio n. 24
0
        public Nav(IModuleManager moduleManager, IContainerExtension container, IRegionManager regionManager)
        {
            InitializeComponent();
            _container = container;

            _region = regionManager.Regions["ContentRegion"];

            _red   = _container.Resolve <Red>();
            _green = _container.Resolve <Green>();
            _blue  = _container.Resolve <Blue>();

            _region.Add(_blue);
            _region.Deactivate(_blue);
            _region.Add(_red);
            _region.Deactivate(_red);
            _region.Add(_green);
            _region.Deactivate(_green);

            _moduleManager = moduleManager;
            _moduleManager.LoadModule("ContentViewModule");
        }
Esempio n. 25
0
 void OnTriggerEnter(Collider other)
 {
     if (!other.gameObject.CompareTag("restart"))
     {
         Debug.Log("Se ha tomado la carta color " + other.gameObject.name);
         obtained.Add(other.gameObject.name);
     }
     other.gameObject.SetActive(false);
     if (other.gameObject.CompareTag("restart"))
     {
         buttons.SetActive(true);
         Yellow.SetActive(true);
         Red.SetActive(true);
         Green.SetActive(true);
         Black.SetActive(true);
         Blue.SetActive(true);
         obtained.Clear();
         text = "";
         //set random card again
     }
 }
Esempio n. 26
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Red != 0F)
            {
                hash ^= Red.GetHashCode();
            }
            if (Green != 0F)
            {
                hash ^= Green.GetHashCode();
            }
            if (Blue != 0F)
            {
                hash ^= Blue.GetHashCode();
            }
            if (alpha_ != null)
            {
                hash ^= Alpha.GetHashCode();
            }
            return(hash);
        }
Esempio n. 27
0
 // Use this for initialization
 void Start()
 {
     carimport = GlobalCar.Cartype;
     if (carimport == 1)
     {
         Red.SetActive(true);
         Blue.SetActive(false);
         Green.SetActive(false);
     }
     if (carimport == 2)
     {
         Blue.SetActive(true);
         Red.SetActive(false);
         Green.SetActive(false);
     }
     if (carimport == 3)
     {
         Green.SetActive(true);
         Red.SetActive(false);
         Blue.SetActive(false);
     }
 }
    // Use this for initialization
    void Start()
    {
        Red.SetActive(false);
        Blue.SetActive(false);
        Danger.SetActive(false);
        Warning.SetActive(false);
        ArrowL.SetActive(false);
        ArrowR.SetActive(false);
        Speeder.SetActive(false);

        red     = false;
        blue    = false;
        danger  = false;
        warning = false;
        arrowR  = false;
        arrowL  = false;
        speeder = false;

        slipR       = false;
        slipL       = false;
        nextTunnel  = false;
        tunnel      = false;
        way         = false;
        RoL         = false;
        RoR         = false;
        rotate      = 0;
        speed       = 2f;
        roteteSpeed = 10f;
        totateSpeed = 10f;
        check       = 0;
        checkTunnel = 0;
        checkRoY    = 0;
        timeCre     = 0;
        sp          = 10;
        maxSp       = 200;
        anim        = GetComponent <Animator>();
        source1     = GetComponent <AudioSource>();
        rb          = GetComponent <Rigidbody>();
    }
Esempio n. 29
0
    IEnumerator BlueState()
    {
        while (blueStates == Blue.Wander)
        {
            BluePatrol();
            if (Hide.enemies != null)
            {
                blueStates = Blue.FleeNHide;
            }

            yield return(0);
        }
        while (blueStates == Blue.FleeNHide)
        {
            BlueFleeNHide();
            if (Hide.enemies == null)
            {
                blueStates = Blue.Wander;
            }
            yield return(0);
        }
    }
Esempio n. 30
0
 void Update()
 {
     if (Input.GetButtonDown("Red"))
     {
         cameraPos.position = Vector3.Lerp(cameraPos.position, redPos.position, 10);
         Yellow.GetComponent <YellowController>().yellowInPlay = false;
         Green.GetComponent <GreenController>().greenInPlay    = false;
         Blue.GetComponent <BlueController>().blueInPlay       = false;
         Red.GetComponent <RedController>().redInPlay          = true;
     }
     if (Input.GetButtonDown("Yellow"))
     {
         cameraPos.position = Vector3.Lerp(cameraPos.position, yellowPos.position, 10);
         Yellow.GetComponent <YellowController>().yellowInPlay = true;
         Green.GetComponent <GreenController>().greenInPlay    = false;
         Blue.GetComponent <BlueController>().blueInPlay       = false;
         Red.GetComponent <RedController>().redInPlay          = false;
     }
     if (Input.GetButtonDown("Green"))
     {
         cameraPos.position = Vector3.Lerp(cameraPos.position, greenPos.position, 10);
         Yellow.GetComponent <YellowController>().yellowInPlay = false;
         Green.GetComponent <GreenController>().greenInPlay    = true;
         Blue.GetComponent <BlueController>().blueInPlay       = false;
         Red.GetComponent <RedController>().redInPlay          = false;
     }
     if (Input.GetButtonDown("Blue"))
     {
         cameraPos.position = Vector3.Lerp(cameraPos.position, bluePos.position, 10);
         Yellow.GetComponent <YellowController>().yellowInPlay = false;
         Green.GetComponent <GreenController>().greenInPlay    = false;
         Blue.GetComponent <BlueController>().blueInPlay       = true;
         Red.GetComponent <RedController>().redInPlay          = false;
     }
     if (Input.GetKeyDown(KeyCode.R))
     {
         SceneManager.LoadScene("SampleScene");
     }
 }
Esempio n. 31
0
    public void DecreaseScore(CapsuleObject.Belong_State team)
    {
        switch (team)
        {
        case CapsuleObject.Belong_State.Red:
            Red.SubScore();
            break;

        case CapsuleObject.Belong_State.Green:
            Green.SubScore();
            break;


        case CapsuleObject.Belong_State.Blue:
            Blue.SubScore();
            break;

        case CapsuleObject.Belong_State.Yellow:
            Yellow.SubScore();
            break;
        }
    }
Esempio n. 32
0
    public void UpdateScore(CapsuleObject.Belong_State team)
    {
        switch (team)
        {
        case CapsuleObject.Belong_State.Red:
            Red.AddScore();
            break;

        case CapsuleObject.Belong_State.Green:
            Green.AddScore();
            break;


        case CapsuleObject.Belong_State.Blue:
            Blue.AddScore();
            break;

        case CapsuleObject.Belong_State.Yellow:
            Yellow.AddScore();
            break;
        }
    }
Esempio n. 33
0
        private void Save_Click(object sender, EventArgs e)
        {
            using (FileStream fs = new FileStream("SavePanel.json", FileMode.Create))
                using (StreamWriter file = new StreamWriter(fs))

                {
                    JsonSerializer json = new JsonSerializer();

                    //Blue one = new Blue();

                    foreach (Control c in this.mypanel1.Controls)
                    {
                        Blue one = new Blue();

                        one.x = c.Left;
                        one.y = c.Top;
                        p.Add(one);
                    }
                    json.Serialize(file, p);
                }
            mypanel1.Save_undo_Count();
            mypanel1.Focus_panel();
            p.Clear();
            //using (FileStream fs = new FileStream("bluepoint_user.bin", FileMode.Create))
            //using (BinaryWriter w = new BinaryWriter(fs))
            //{
            //    foreach (Control c in this.mypanel1.Controls)
            //    {

            //        //location
            //        w.Write(c.Left); //X
            //        w.Write(c.Top); //Y

            //    }
            //    fs.Flush();
            //    mypanel1.Focus_panel();
            //}
        }
Esempio n. 34
0
        /// <summary>
        ///     Gets a bitmap with the RGB histograms
        /// </summary>
        /// <returns>Three histograms for R, G and B values in the Histogram</returns>
        public Bitmap Visualize()
        {
            var oneColorHeight = 100;
            var margin         = 10;

            float[]  maxValues = { Red.Max(), Green.Max(), Blue.Max() };
            byte[][] values    = { Red, Green, Blue };


            var histogramBitmap = new Bitmap(276, oneColorHeight * 3 + margin * 4);
            var g = Graphics.FromImage(histogramBitmap);

            g.FillRectangle(Brushes.White, 0, 0, histogramBitmap.Width, histogramBitmap.Height);
            var yOffset = margin + oneColorHeight;

            for (var i = 0; i < 256; i++)
            {
                for (var color = 0; color < 3; color++)
                {
                    g.DrawLine(p[color], margin + i, yOffset * (color + 1), margin + i,
                               yOffset * (color + 1) - (values[color][i] / maxValues[color]) * oneColorHeight);
                }
            }

            for (var i = 0; i < 3; i++)
            {
                g.DrawString(p[i].Color.ToKnownColor() + ", max value: " + maxValues[i], SystemFonts.SmallCaptionFont,
                             Brushes.Silver, margin + 11, yOffset * i + margin + margin + 1);
                g.DrawString(p[i].Color.ToKnownColor() + ", max value: " + maxValues[i], SystemFonts.SmallCaptionFont,
                             Brushes.Black, margin + 10, yOffset * i + margin + margin);
                g.DrawRectangle(p[i], margin, yOffset * i + margin, 256, oneColorHeight);
            }
            g.Dispose();

            return(histogramBitmap);
        }
Esempio n. 35
0
 public void Process(Blue colorOne, Green colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndGreen;
 }
Esempio n. 36
0
 public void Process(Green colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.GreenAndBlue;
 }
Esempio n. 37
0
 public void Process(Blue colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndBlue;
 }
Esempio n. 38
0
 public void Process(Blue colorOne, Red colorTwo)
 {
     LastProcess = TypeOfProcess.BlueAndRed;
 }
Esempio n. 39
0
 public void Process(Red colorOne, Blue colorTwo)
 {
     LastProcess = TypeOfProcess.RedAndBlue;
 }
Esempio n. 40
0
 public void Process(Blue color)
 {
     LastProcess = TypeOfProcess.Blue;
 }
Esempio n. 41
0
 public void Process(Blue blue1, Blue blue2)
 {
     Console.WriteLine("2 blues");
 }
Esempio n. 42
0
File: AST.cs Progetto: chenzuo/blue
 public void Generate(Blue.CodeGen.EmitCodeGen gen)
 {   
     if (!Mods.IsAbstract)
     {
         if (m_declSet != null)
             gen.Generate(m_declSet);            
             
         if (m_declGet != null)
             gen.Generate(m_declGet);
     }            
 }        
Esempio n. 43
0
     AddHandler(
     string stOption,                    // Unique flag for Option
     string stShortcut,                  // Optional shortcut (can be null);
     Blue.Public.OptionHandler ha,       // Option Handler
     string stDescription,               // short 1-line description
     string stFullHelp                   // long description
     )        
 {
     Debug.Assert(!m_fIsLocked, "Can't add new optionhandler after we've locked:"+ stDescription);
     
     
     OptionInfo info = new OptionInfo(stOption, stShortcut, ha, stDescription, stFullHelp);
             
     
     if (m_tblOptions[stOption] == null)
     {               
         if (stShortcut != null)
         {
             Debug.Assert(m_tblOptions[stShortcut] == null);
             m_tblOptions[stShortcut] = info;
         }
         m_tblOptions[stOption] = info;            
         
     } 
     else 
     {
         // Since end users can't define option handlers, we should know about
         // any collisions during the debug phase.
         Debug.Assert(false, "Handler already defined");
     }
 }
Esempio n. 44
0
 // Error Range
 // Convert the different error sub-system codes to a single integer range    
 internal static int ERGeneral(Blue.Driver.ErrorCodes e)
 {
     return ((int) e) + 1000;
 }
Esempio n. 45
0
 internal ErrorException(Blue.CodeGen.EmitCodeGen.ErrorCodes e, FileRange location, string stMessage) 
     : this(ERCodeGen(e), location, stMessage) { }
Esempio n. 46
0
 // Have typesafe ctors for each error-subsystem
 internal ErrorException(Blue.Driver.ErrorCodes e, FileRange location, string stMessage) 
     : this(ERGeneral(e), location, stMessage) { }
Esempio n. 47
0
 // Constructor
 public OptionInfo(
     string stOption, 
     string stShortcut,
     Blue.Public.OptionHandler ha,
     string stDescription,
     string stFullHelp
 )            
 {
     Debug.Assert(stOption != null, "Must specify option");
     Debug.Assert(ha != null, "Must have valid handler");
     Debug.Assert(stDescription != null, "Must have valid description");
                 
     m_stOption = stOption;
     m_stShortcut = stShortcut; // can be null
     m_ha = ha;
     m_stDescription = stDescription;
     m_stFullHelp = (stFullHelp == null) ? stDescription : stFullHelp;
 }
Esempio n. 48
0
 public void Process(Blue blue)
 {
     Console.WriteLine("1 blue");
 }
Esempio n. 49
0
    EmitCodeGen(
        Blue.Public.IOptions opt)              // Options
    {
        // Set default target type. An option handler may change it on us.
        m_TargetType        = TargetType.Console;
        

        //
        // Register OptionHandlers.
        //
        opt.AddHandler("target", "t", new OptionHandler(this.Option_Target),
            "Target module format (windows, console, library)", 
            "Select what type of executable to produce\n"+
            "/target:library - produce a dll\n"+
            "/target:windows - produce a windows executable.\n"+
            "/target:console - (default) produce a console executable\n");
                                
        #if false
            Option_DebugInfo(""); // force debugging info in all cases
        #endif
        opt.AddHandler("debug", null, new OptionHandler(this.Option_DebugInfo), 
                "Generate .PDB symbols file for debugging", 
                "Generate a .pdb file for debugging purposes. Default is off.\n"+
                "ex:\n"+
                "/debug");
                                
        opt.AddHandler("main", "m", new OptionHandler(this.Option_SetMain), 
            "Specify class containing Main method", 
            "Explicitly specify which class has the Main method.\n"+
            "ex:\n"+
            "/main:MyClass");
            
        opt.AddHandler("out", null, new OptionHandler(this.Option_Out), 
            "Specify the output name to generate", 
            "ex:\n"+
            "/out:Dogfood.exe"
            );
    }
Esempio n. 50
0
 internal static int ERCodeGen(Blue.CodeGen.EmitCodeGen.ErrorCodes e)
 {
     return ((int) e) + 5000;
 }
Esempio n. 51
0
File: AST.cs Progetto: chenzuo/blue
 public override void GenerateType(Blue.CodeGen.EmitCodeGen gen)
 {
     gen.GenerateClass(this);
 }
Esempio n. 52
0
File: AST.cs Progetto: chenzuo/blue
 public override void GenerateType(Blue.CodeGen.EmitCodeGen gen)
 {
     this.m_nodeProxy.GenerateType(gen);
 }
Esempio n. 53
0
File: AST.cs Progetto: chenzuo/blue
 // Generate the body for this type
 public abstract void GenerateType(Blue.CodeGen.EmitCodeGen gen);