private static float FontSize(FontWarpFactor fontWarpFactor, int height) { float size = 0f; switch (fontWarpFactor) { case FontWarpFactor.None: size = height * 0.7f; break; case FontWarpFactor.Low: size = height * 0.8f; break; case FontWarpFactor.Medium: size = height * 0.85f; break; case FontWarpFactor.High: size = height * 0.9f; break; } return(size); }
private static Pair <float> WarpMutipliers(FontWarpFactor fontWarpFactor) { float m1 = 1f; float m2 = 1f; switch (fontWarpFactor) { case FontWarpFactor.None: break; case FontWarpFactor.Low: m1 = 6f; m2 = 1f; break; case FontWarpFactor.Medium: m1 = 5f; m2 = 1.3f; break; case FontWarpFactor.High: m1 = 4.5f; m2 = 1.4f; break; } return(new Pair <float>(m1, m2)); }
public CaptchaImage() { _rand = new Random(); _fontWarp = FontWarpFactor.Low; _backgroundNoise = BackgroundNoiseLevel.Low; _lineNoise = LineNoiseLevel.None; _width = 180; _height = 50; _randomTextLength = 5; _randomTextChars = "ACDEFGHJKLNPQRTUVXYZ2346789"; _fontFamilyName = ""; // -- a list of known good fonts in on both Windows XP and Windows Server 2003 _fontWhitelist = "arial;arial black;comic sans ms;courier new;estrangelo edessa;franklin gothic medium;" + "georgia;lucida console;lucida sans unicode;mangal;microsoft sans serif;palatino linotype;" + "sylfaen;tahoma;times new roman;trebuchet ms;verdana"; Refresh(); }
public WarpTextDrawing(int width, int height, string fonts, Color textColor, FontWarpFactor fontWarpFactor) { m_width = width; m_height = height; m_fonts = ParseFonts(fonts); m_textColor = textColor; m_fontSize = FontSize(fontWarpFactor, height); if (fontWarpFactor != FontWarpFactor.None) { var m = WarpMutipliers(fontWarpFactor); m_warpMultiplier1 = m.First; m_warpMultiplier2 = m.Second; m_strategy = WarpText; } }
public CaptchaImage() { _rand = new Random(); _fontWarp = FontWarpFactor.Low; _backgroundNoise = BackgroundNoiseLevel.Low; _lineNoise = LineNoiseLevel.None; _width = 180; _height = 50; _randomTextLength = 5; _randomTextChars = "ACDEFGHJKLNPQRTUVXYZ2346789"; _fontFamilyName = ""; // -- a list of known good fonts in on both Windows XP and Windows Server 2003 _fontWhitelist = "arial;arial black;comic sans ms;courier new;estrangelo edessa;franklin gothic medium;" + "georgia;lucida console;lucida sans unicode;mangal;microsoft sans serif;palatino linotype;" + "sylfaen;tahoma;times new roman;trebuchet ms;verdana"; _randomText = GenerateRandomText(); _generatedAt = DateTime.Now; _guid = Guid.NewGuid().ToString(); }
public Variant12() { m_rand = new Random(); m_fontWarp = FontWarpFactor.Low; m_backgroundNoise = BackgroundNoiseLevel.Low; m_lineNoise = LineNoiseLevel.None; m_width = 180; m_height = 50; m_randomTextLength = 5; m_randomTextChars = "ACDEFGHJKLNPQRTUVXYZ2346789"; m_fontFamilyName = ""; // -- a list of known good fonts in on both Windows XP and Windows Server 2003 m_fontWhitelist = "arial;arial black;comic sans ms;courier new;estrangelo edessa;franklin gothic medium;" + "georgia;lucida console;lucida sans unicode;mangal;microsoft sans serif;palatino linotype;" + "sylfaen;tahoma;times new roman;trebuchet ms;verdana"; m_randomText = GenerateRandomText(); m_generatedAt = DateTime.Now; m_guid = Guid.NewGuid().ToString(); }
public CaptchaImage(Color line, Color text, Color background) { _rand = new Random(); _fontWarp = FontWarpFactor.High; _backgroundNoise = BackgroundNoiseLevel.None; _lineNoise = LineNoiseLevel.High; _width = 180; _height = 50; _randomTextLength = 3; _randomTextChars = "012346789"; _fontFamilyName = ""; // -- a list of known good fonts in on both Windows XP and Windows Server 2003 _fontWhitelist = "arial;arial black;comic sans ms;courier new;estrangelo edessa;franklin gothic medium;" + "georgia;lucida console;lucida sans unicode;mangal;microsoft sans serif;palatino linotype;" + "sylfaen;tahoma;times new roman;trebuchet ms;verdana"; _randomText = GenerateRandomText(); _generatedAt = DateTime.Now; _guid = Guid.NewGuid().ToString(); _line = line; _text = text; _background = background; }