Esempio n. 1
0
        public static void DrawText(ref Bitmap Bmp, Point P, string Text, Color color, int FontSize = 1, int Align = 1)
        {
            int xOffset = 0;//Stores how far we should be starting drawing from the Point

            if (Align == -1)
            {
                xOffset = -Text.Length * 6 * FontSize;
            }                                                          //Offset the text so the last character ends on the point
            else if (Align == 0)
            {
                xOffset = -Text.Length * 3 * FontSize;
            }                                                                               //Offset the text so the middle of the text is on the point
            foreach (Char C in Text.ToUpper())                                              //Process each characer, as a capital
            {
                if (Linq.Contains(LetterMaps, x => x.Item1 == C))                           //Check if the character exists in the Letter Maps
                {
                    bool[,] LetterMap = Linq.Where(LetterMaps, x => x.Item1 == C)[0].Item2; //Get the boolean grid for the character
                    for (int x = 0, y = 0; x < 5 * FontSize && y < 5 * FontSize;)           //Set pixels in a 5 * Font size area
                    {
                        if (LetterMap[y / FontSize, x / FontSize])                          //If the place in the letter map is true, Set the pixel
                        {
                            SetPixel(ref Bmp, new Point(P.X + x + xOffset, P.Y + y), color);
                        }
                        x++;//Increment
                        if (x == 5 * FontSize)
                        {
                            x = 0; y++;
                        }                    //Shift down a row if we are at the end
                    }
                    xOffset += 6 * FontSize; //Move the offest to leave a gap and so we dont write over the text
                }
                else if (C == ' ')
                {
                    xOffset += 6 * FontSize;
                }                                              //Leave an empty space in the text
            }
        }
Esempio n. 2
0
 public bool IsLinqKeyword(String text)
 {
     return(Linq.Contains(TextToCompare(text), comparer));
 }