Exemple #1
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //outline shit

        private static Image makeOutline(Image image, Color_Editor Outline)
        {
            Bitmap newImage = new Bitmap(image.Width, image.Height);

            List <float> OLConvertedPositions = new List <float>();

            foreach (int position in Outline.Positions[0])
            {
                OLConvertedPositions.Add((float)(position / 100.00));
            }


            Bitmap OutlineGrad = Color_Editor.getGradientBox(image.Width, image.Height, Outline.Colors[0], OLConvertedPositions, Outline.Angles[0]);

            for (int i = 0; i < image.Width; i++)
            {
                for (int j = 0; j < image.Height; j++)
                {
                    Color pixel = ((Bitmap)image).GetPixel(i, j);
                    if (pixel.A == 255)
                    {
                        newImage.SetPixel(i, j, pixel);
                    }
                    else
                    {
                        if (CheckAdjacent(i, j, (Bitmap)image))
                        {
                            newImage.SetPixel(i, j, OutlineGrad.GetPixel(i, j));
                        }
                    }
                }
            }

            return(newImage);
        }
Exemple #2
0
        private void OutlineSingle_Clicked(object sender, EventArgs e)
        {
            ColorDialog picker = new ColorDialog();

            if (picker.ShowDialog() == DialogResult.OK)
            {
                Color PickedColor = picker.Color;

                List <List <Color> > Colors    = new List <List <Color> >();
                List <List <int> >   Positions = new List <List <int> >();
                List <int>           Angles    = new List <int>();

                List <Color> temp = new List <Color>();
                temp.Add(PickedColor); temp.Add(PickedColor);
                Colors.Add(temp);

                List <int> tempin = new List <int>();
                tempin.Add(0); tempin.Add(100);
                Positions.Add(tempin);
                Angles.Add(90);

                Outline = new Color_Editor(Colors, Positions, Angles, 0);

                chkColor.Checked = true;
            }
        }
Exemple #3
0
        public Main_Form()
        {
            Gradients = new Color_Editor(true);
            Outline   = new Color_Editor(false);

            width  = 256;
            height = 32;

            InitializeComponent();
            Information = new WriteInfo(null, null, tckLetter.Value, tckWords.Value, cmbPrefix.Text.ToLower(), (double)tckSqueeze.Value / 100, chkboxPrefix.Checked, 2, false, chkColor.Checked, (double)tckVertical.Value / 100);


            //get scale factor for display
            int DispWidth = picText.Size.Width;

            scale = (double)DispWidth / (double)width;

            BaseImage = new Bitmap(width, height);
            for (int i = 0; i < width; i++)
            {
                for (int j = 0; j < height; j++)
                {
                    ((Bitmap)BaseImage).SetPixel(i, j, Color.FromArgb(0, 255, 255, 255));
                }
            }
        }
Exemple #4
0
        private static Bitmap editColor(Image image, Color_Editor Text, Color_Editor Outline, int index, Image BaseImage)
        {
            List <float> ConvertedPositions = new List <float>();

            foreach (int position in Text.Positions[index])
            {
                ConvertedPositions.Add((float)(position / 100.00));
            }

            List <float> OLConvertedPositions = new List <float>();

            foreach (int position in Outline.Positions[0])
            {
                OLConvertedPositions.Add((float)(position / 100.00));
            }

            Bitmap baseGrad    = Color_Editor.getGradientBox(image.Width, image.Height, Text.Colors[index], ConvertedPositions, Text.Angles[index]);
            Bitmap OutlineGrad = Color_Editor.getGradientBox(image.Width, image.Height, Outline.Colors[0], OLConvertedPositions, Outline.Angles[0]);


            for (int j = 0; j < image.Height; j++)
            {
                for (int i = 0; i < image.Width; i++)
                {
                    Color pixel = ((Bitmap)image).GetPixel(i, j);

                    if (pixel.A == 255)
                    {
                        double x = pixel.R / 255.00;

                        Color ImageColor   = ((Bitmap)BaseImage).GetPixel(i, j);
                        Color baseColor    = baseGrad.GetPixel(i, j);
                        Color OutlineColor = OutlineGrad.GetPixel(i, j);

                        pixel = BlendColors(x, ImageColor, baseColor, OutlineColor);
                        ((Bitmap)image).SetPixel(i, j, pixel);
                    }
                }
            }

            return((Bitmap)image);
        }
Exemple #5
0
        public static Image writeLetters(WriteInfo Info, Color_Editor Gradients, Color_Editor Outline, Image BaseImage)
        {
            //trim text and get the characters
            String text = Info.text;

            text.Trim();
            char[] characters = text.ToCharArray();

            String[] chars;

            //if there is a prefix, make the array of strings to write accomdate it

            String prefix = Info.Prefix;
            ///Debug.WriteLine(prefix);
            bool withPre = prefix.Equals("none") || prefix.Equals("None");

            int index;


            if (!withPre)
            {
                chars    = new String[characters.Length + 2];
                chars[0] = prefix;
                chars[1] = " ";
                index    = 2;
            }
            else
            {
                chars = new String[characters.Length];
                index = 0;
            }

            int cindex = -1;

            //write the char array to the string array
            for (int i = 0; i < characters.Length; i++)
            {
                chars[i + index] = characters[i].ToString();
                if (!String.IsNullOrWhiteSpace(chars[i + index]))
                {
                    cindex++;
                }
            }

            //thing for special characters here
            chars = Main_Form.specialCharacters(chars);

            //call the spacing function
            int[] xposes = spacing(chars, Info);

            Image thisImage = new Bitmap(totalLength + 3, 32);

            for (int i = 0; i < xposes.Length; i++)
            {
                xposes[i] = 1 + xposes[i];
            }

            //actually writing the letters
            for (int i = xposes.Length - 1; i > -1; i--)
            {
                String letter = chars[i];
                String chara  = letter.ToString().ToLower();

                if (!String.IsNullOrWhiteSpace(letter))
                {
                    //get the letter image files

                    String name       = "mariofont_" + chara + ".png";
                    String fileToRead = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\btis\" + name;

                    if (File.Exists(fileToRead))
                    {
                        Bitmap LetterImage = new Bitmap(fileToRead);

                        //if the color is on, edit the letter image
                        if (Info.HasColor && Gradients.Setting == 0)
                        {
                            int colorindex = cindex % Gradients.Colors.Count;
                            Debug.WriteLine(colorindex);
                            LetterImage = editColor(LetterImage, Gradients, Outline, colorindex, BaseImage);
                            LetterImage = (Bitmap)why(LetterImage);
                            //LetterImage = (Bitmap)makeOutline(LetterImage, Outline.Colors[0][0]);
                            cindex--;
                        }

                        Graphics mainImage = Graphics.FromImage(thisImage);
                        //Debug.WriteLine(withPre);
                        //drawing the actual image
                        if (chara.Length > 1 && !withPre)
                        {
                            double preScale = 1;
                            //Debug.WriteLine("prescale maybw");
                            if (Info.PrefixSmall)
                            {
                                preScale = .9;
                                //Debug.WriteLine("prescale changed");
                            }
                            mainImage.DrawImage(LetterImage, new Rectangle(xposes[i], 0, (int)(LetterImage.Width * preScale), (int)(LetterImage.Height * preScale)));
                        }
                        else
                        {
                            mainImage.DrawImage(LetterImage, new Rectangle(xposes[i], 0, LetterImage.Width, 32));
                        }

                        LetterImage.Dispose();
                    }
                }
            }

            //color the image if by image
            if (Info.HasColor && Gradients.Setting == 2)
            {
                thisImage = editColor(thisImage, Gradients, Outline, index, BaseImage);
            }

            //thisImage = makeOutline(thisImage, Outline.Colors[0][0]);
            if (Info.HasColor)
            {
                thisImage = makeOutline(thisImage, Outline);
            }
            else
            {
                Outline   = new Color_Editor(false);
                thisImage = makeOutline(thisImage, Outline);
            }

            //scale the image



            Image    newImage = new Bitmap(Info.image.Width, Info.image.Height);
            Graphics newgraph = Graphics.FromImage(newImage);

            int NewWidth  = (int)(thisImage.Width * Info.SqueezeFactor);
            int NewHeight = (int)(thisImage.Height * Info.VertiFactor);

            Rectangle DrawRectangle = new Rectangle(0, (Info.image.Height - NewHeight) / 2, NewWidth, NewHeight);


            //deal with alignment
            if (!Info.auto)
            {
                if (Info.align == 1)
                {
                    int HoriShift = Info.image.Width - (int)(thisImage.Width * Info.SqueezeFactor);
                    DrawRectangle.Offset(HoriShift, 0);
                }
                else if (Info.align == 2)
                {
                    int HoriShift = Info.image.Width - (int)(thisImage.Width * Info.SqueezeFactor);
                    DrawRectangle.Offset(HoriShift / 2, 0);
                }
            }
            else
            {
                newImage      = new Bitmap(NewWidth, NewHeight);
                newgraph      = Graphics.FromImage(newImage);
                DrawRectangle = new Rectangle(0, 0, NewWidth, NewHeight);
            }

            newgraph.DrawImage(thisImage, DrawRectangle);

            return(newImage);
        }