Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1057935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:56:53+00:00 2026-05-16T17:56:53+00:00

Scenario: 1) Program going to draw a string (commonly a single character) on a

  • 0

Scenario:

1) Program going to draw a string (commonly a single character) on a bitmap:

protected void DrawCharacter(string character, Font font)
{
    if(string.IsNullOrEmpty(character))
        character = ".";

    FontFamily f = new FontFamily(FontName);            

    bitmap = new Bitmap((int)(font.Size * 2f), (int)font.Height);
    Graphics g = Graphics.FromImage(bitmap);
    g.Clear(Color.White);
    g.DrawString(character, font, Brushes.Black, DrawPoint);            
}

2) Using following algorithm we get all black pixels position:

        public Int16[] GetColoredPixcels(Bitmap bmp, bool useGeneric)
        {
            List<short> pixels = new List<short>();

            int x = 0, y = 0;

            do
            {
                Color c = bmp.GetPixel(x, y);
                if (c.R == 0 && c.G == 0 && c.B == 0)
                    pixels.Add((Int16)(x + (y + 1) * bmp.Width));


                if (x == bmp.Width - 1)
                {
                    x = 0;
                    y++;
                }
                else
                    x++;

            } while (y < bmp.Height);

            return pixels.ToArray();
        }

Problem occurs when input character is a single point (.). I don’t know what’s happening in bitmap object while processing function bmp.GetPixel(x, y), because it can’t find point position! Output array claims bitmap has no black point! But when input string is (:) program can find pixels position properly!

Any suggestion or guid?
thanks in advance…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:56:53+00:00Added an answer on May 16, 2026 at 5:56 pm

    I suspect that anti-aliasing means that the pixel for “.” isn’t completely black. Why not change your condition to just pick “very dark” pixels?

    private const int Threshold = 10;
    ...
    if (c.R < Threshold && c.G < Threshold && c.B < Threshold)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my scenario, I have a program that analyzes data input files and produces
Scenario: 4 users launch separate instances of the same client program (Winforms) that is
I have the following scenario: a Bitmap that is used as background and another
Scenario: An interactive CLI Python program, that is in need for a password. That
Edit Solved and Reposted as sample program The scenario was as follows: The class
Following scenario: In an WPF application the program calls Log.Write to enqueue messages which
Scenario: I've inherited a program, kept under Mercurial, that only works on my system
hi I have a scenario like this I made a chat program where a
I'm not sure how to properly handle following scenario: My program installs with installer
How do I program the scenario where I have an action that spawns two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.