Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of <see cref="PartitionedAutoInputProtectionImage"/> for the specified <paramref name="size"/>
        /// and <paramref name="textProvider"/>.
        /// </summary>
        /// <remarks>
        /// Derived types can override this method to return a type that either composites or derives from
        /// <see cref="PartitionedAutoInputProtectionImage"/>.
        /// </remarks>
        /// <seealso cref="GenerateRandomAutoInputProtectionImage(Size,AutoInputProtectionTextProvider)"/>
        /// <param name="size">The dimensions of the image.</param>
        /// <param name="textProvider">The <see cref="AutoInputProtectionTextProvider"/> implementation that generates the text to be rendered.</param>
        /// <returns>An instance of <see cref="PartitionedAutoInputProtectionImage"/> for the specified <paramref name="size"/>
        /// and <paramref name="textProvider"/>.</returns>
        protected virtual PartitionedVerificationCodeImage GenerateImage(Size size, VerificationCodeTextProvider textProvider, CaptchaCharacterSet characterSet, int?maximumCharacters, int?minimumCharacters)
        {
            PartitionedVerificationCodeImage image = new PartitionedVerificationCodeImage(size, textProvider, characterSet, maximumCharacters, minimumCharacters);

            if (margin != -1)
            {
                image.Margin = margin;
            }

            if (minRotation != -1)
            {
                image.MinimumCharacterRotation = minRotation;
            }

            if (maxRotation != -1)
            {
                image.MaximumCharacterRotation = maxRotation;
            }

            return(image);
        }
        /// <summary>
        /// Creates an instance of <see cref="PartitionedAutoInputProtectionImage"/> for the specified <paramref name="size"/>
        /// and <paramref name="textProvider"/>.
        /// </summary>
        /// <remarks>
        /// Derived types can override this method to return a type that either composites or derives from 
        /// <see cref="PartitionedAutoInputProtectionImage"/>.
        /// </remarks>
        /// <seealso cref="GenerateRandomAutoInputProtectionImage(Size,AutoInputProtectionTextProvider)"/>
        /// <param name="size">The dimensions of the image.</param>
        /// <param name="textProvider">The <see cref="AutoInputProtectionTextProvider"/> implementation that generates the text to be rendered.</param>
        /// <returns>An instance of <see cref="PartitionedAutoInputProtectionImage"/> for the specified <paramref name="size"/>
        /// and <paramref name="textProvider"/>.</returns>
        protected virtual PartitionedVerificationCodeImage GenerateImage(Size size, VerificationCodeTextProvider textProvider, CaptchaCharacterSet characterSet, int? maximumCharacters, int? minimumCharacters)
        {
            PartitionedVerificationCodeImage image = new PartitionedVerificationCodeImage(size, textProvider, characterSet, maximumCharacters, minimumCharacters);

            if (margin != -1)
                image.Margin = margin;

            if (minRotation != -1)
                image.MinimumCharacterRotation = minRotation;

            if (maxRotation != -1)
                image.MaximumCharacterRotation = maxRotation;

            return image;
        }