Пример #1
0
        public static void AddSmoozedColorList(bool doInit)
        {
            Constants.smoozedColors.Clear();
            foreach (SmoozedColor pic in SmoozedColorTags)
            {
                if (pic.index >= 0)
                {
                    Constants.smoozedColors.Add(pic);
                }
            }
            bool switched = true;

            while (switched)
            {
                switched = false;
                for (int t = 0; t < smoozedColors.Count - 1; t++)
                {
                    if (smoozedColors[t].index > smoozedColors[t + 1].index)
                    {
                        switched = true;
                        SmoozedColor temp = smoozedColors[t];
                        smoozedColors[t]     = smoozedColors[t + 1];
                        smoozedColors[t + 1] = temp;
                    }
                }
            }
            if (doInit)
            {
                for (int t = 0; t < Constants.smoozedColors.Count; t++)
                {
                    Constants.smoozedColors[t].TrackerPositionPercentage = t * 100f / Constants.smoozedColors.Count + 50f / Constants.smoozedColors.Count;
                }
            }
        }
Пример #2
0
        private void setPictureSelected(PictureBox pic)
        {
            SmoozedColor tag         = (SmoozedColor)pic.Tag;
            int          numSelected = Constants.SelectedBoxes;

            if (tag.index < 0)
            {
                tag.index = numSelected;
            }
            pic.BorderStyle = BorderStyle.Fixed3D;
        }
Пример #3
0
        public static void SetColorRange(Image im)
        {
            int width          = im.Width;
            int selectedColors = SelectedBoxes;
            int colorsUsed     = Constants.smoozedColors1024.Count;

            if (colorsUsed == 0)
            {
                colorsUsed = 1;
            }
            if (colorsUsed < selectedColors)
            {
                colorsUsed = selectedColors;
            }
            if (colorsUsed > Constants.smoozedColors1024.Count)
            {
                colorsUsed = Constants.smoozedColors1024.Count;
            }
            float delta = (float)(1.0f * width / colorsUsed);

            if (delta == 0)
            {
                delta = 1;
            }
            float x = 0;

            using Graphics g = Graphics.FromImage(im);
            for (int i = 0; i < colorsUsed; i++)
            {
                g.FillRectangle(new SolidBrush(Constants.smoozedColors1024[i]), new RectangleF(x, 0, delta, im.Height));
                x += delta;
            }
            float currentX = 0;

            for (int i = 0; i < smoozedColors.Count; i++)
            {
                SmoozedColor c  = smoozedColors[i];
                int          x1 = c.LinePosInImage(im.Size);

                if (smoozedColors[i].Tag != 40)// smoozedColors[i].color != Color.Black) {
                {
                    g.DrawLine(Pens.Black, x1, 0, x1, im.Height);
                    g.DrawRectangle(Pens.Black, c.TrackerRectangle(im.Size));
                }
                else
                {
                    g.DrawLine(Pens.White, x1, 0, x1, im.Height);
                    g.DrawRectangle(Pens.White, c.TrackerRectangle(im.Size));
                }
                currentX += c.WidthPercentageLeft + c.WidthPercentageRight;
            }
        }
Пример #4
0
        private void btnNone_Click(Object sender, EventArgs e)
        {
            if (CombinedControl == null || CombinedControl.SmoozeType == SmoozeType.Single)
            {
                return;
            }

            for (int b = 0; b < boxes.Length; b++)
            {
                SmoozedColor tag = (SmoozedColor)boxes[b].Tag;
                tag.index            = -1;
                boxes[b].BorderStyle = BorderStyle.None;
            }
            combinedControl.CollectSmoozedColors(pictureBoxColors.Image, true);
            Refresh();
        }
Пример #5
0
        private void switchPictureSelected(PictureBox pic)
        {
            SmoozedColor tag = (SmoozedColor)pic.Tag;

            if (tag.index < 0)
            {
                int numSelected = Constants.SelectedBoxes;
                tag.index       = numSelected;
                pic.BorderStyle = BorderStyle.Fixed3D;
            }
            else
            {
                tag.index       = -1;
                pic.BorderStyle = BorderStyle.None;
            }
            combinedControl.CollectSmoozedColors(pictureBoxColors.Image, true);
            Refresh();
        }
Пример #6
0
        public static void Initialize()
        {
            smoozedColors.Clear();
            for (int c = 0; c < 48; c++)
            {
                SmoozedColorTags[c]       = new SmoozedColor(c, -1, 100f / 48);
                SmoozedColorTags[c].color = Color.FromArgb(Constants.DefinedColors[c]);
                // sortedColors[c] = -1;
            }
            SmoozedColorTags[40].index = 0;
            SmoozedColorTags[17].index = 1;
            SmoozedColorTags[20].index = 2;
            SmoozedColorTags[22].index = 3;
            smoozedColors.Add(SmoozedColorTags[40]); //black
            smoozedColors.Add(SmoozedColorTags[17]); //red
            smoozedColors.Add(SmoozedColorTags[20]); //green
            smoozedColors.Add(SmoozedColorTags[22]); //blue

            SortSmoozedColors();
            Initialized = true;
        }
Пример #7
0
        public XMLSettings()
        {
            backColor0 = Constants.pens[0].ToArgb();
            backColor1 = Constants.pens[1].ToArgb();
            backColor2 = Constants.pens[2].ToArgb();
            backColor3 = Constants.pens[3].ToArgb();
            backColor4 = Constants.pens[4].ToArgb();
            backColor5 = Constants.pens[5].ToArgb();
            backColor6 = Constants.pens[6].ToArgb();
            backColor7 = Constants.pens[7].ToArgb();
            backColor8 = Constants.pens[8].ToArgb();
            backColor9 = Constants.pens[9].ToArgb();

            FurcationColor = Constants.FurcationColor.ToArgb();
            OneColor       = Constants.OneColor.ToArgb();
            DiagramColor   = Constants.DiagramColor.ToArgb();

            FunctionsLineWidth  = Constants.FunctionsLineWidth;
            FurcationsLineWidth = Constants.FurcationsLineWidth;
            DiagramLineWidth    = Constants.DiagramLineWidth;

            for (int s = 0; s < Constants.SmoozedColorTags.Length; s++)
            {
                SmoozedColor c = Constants.SmoozedColorTags[s];

                if (c != null)
                {
                    TrackerPositionPercentages[c.Tag] = c.TrackerPositionPercentage;
                    sortedColors[c.Tag] = c.index;
                }
                else
                {
                    sortedColors[s] = -1;
                    TrackerPositionPercentages[s] = 0;
                }
            }
            UsedFontSize = Constants.UsedFontSize;
            functionType = Constants.currentFunctionType;
            Type3Color   = Constants.Type3Color;
        }
Пример #8
0
        public static void SortSmoozedColors()
        {
            bool switched = true;

            while (switched)
            {
                switched = false;
                for (int t = 0; t < Constants.smoozedColors.Count - 1; t++)
                {
                    if (Constants.smoozedColors[t].TrackerPositionPercentage > Constants.smoozedColors[t + 1].TrackerPositionPercentage)
                    {
                        switched = true;
                        SmoozedColor temp = Constants.smoozedColors[t];
                        Constants.smoozedColors[t]     = Constants.smoozedColors[t + 1];
                        Constants.smoozedColors[t + 1] = temp;
                    }
                }
            }
            for (int t = 0; t < Constants.smoozedColors.Count; t++)
            {
                Constants.smoozedColors[t].index = t;
                if (t > 0)
                {
                    Constants.smoozedColors[t].left = Constants.smoozedColors[t - 1];
                }
                else
                {
                    Constants.smoozedColors[t].left = null;
                }
                if (t < Constants.smoozedColors.Count - 1)
                {
                    Constants.smoozedColors[t].right = Constants.smoozedColors[t + 1];
                }
                else
                {
                    Constants.smoozedColors[t].right = null;
                }
            }
            Interpolate();
        }
Пример #9
0
 public void MouseUpColorDef(int x, int y)
 {
     colorMouseX2 = x;
     if (fractalPlotter != null && false)
     {
         fractalPlotter.SetColorsFromNewSmoozedColors(smoozeType);
         Rectangle destRect = DestRect;
         using (Graphics g = Graphics.FromImage(MainImage)) {
             g.DrawImage(PointsImage.Bitmap, destRect, sourceRect, GraphicsUnit.Pixel);
         }
         if (PlotForm != null)
         {
             PlotForm.FormImage = MainImage;
         }
         RescanExampleParallelAsync(true);
         if (juliaPlotInset != null)
         {
             juliaPlotInset.Map.CalculatedTypes.Clear();
         }
     }
     trackedSmoozedColor = null;
 }
Пример #10
0
        private void defaultColors(bool rescanSamples)
        {
            SmoozedColor tag         = (SmoozedColor)picColor_40.Tag;
            int          numSelected = Constants.SelectedBoxes;

            if (tag.index < 0)
            {
                tag.index = numSelected;
            }
            picColor_40.BorderStyle = BorderStyle.Fixed3D;
            for (int b = 17; b < 24; b++)
            {
                tag         = (SmoozedColor)boxes[b].Tag;
                numSelected = Constants.SelectedBoxes;
                if (tag.index < 0)
                {
                    tag.index = numSelected;
                }
                boxes[b].BorderStyle = BorderStyle.Fixed3D;
            }

            combinedControl.CollectSmoozedColors(pictureBoxColors.Image, rescanSamples);
        }
Пример #11
0
 public void MouseDownColorDef(int x, int y, Size size)
 {
     trackedSmoozedColor = Constants.Tracker4Cursor(x, size);
 }