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 3335836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:03:51+00:00 2026-05-18T00:03:51+00:00

Currently when I want to add a grey color on a Bitmap I use

  • 0

Currently when I want to add a grey color on a Bitmap I use the following

Bitmap.SetPixel(x,y, new Color.FromArgb(100,100,100);

My question more is. It uses some steps that are not required in my opinion:

  1. We have a greyscale color: 100
  2. I have to convert it into a real RGB color (100,100,100)
  3. Then it calculates what color comes out of it, and it’s a greyscale again (100)

Requestion

Is there something like this

Bitmap.SetPixel(x,y, new GreyColor(100));
  • 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-18T00:03:52+00:00Added an answer on May 18, 2026 at 12:03 am

    No, there is no such thing as a GreyColor in .NET. A GreyColor is just a particular case of a color, the same way that lime green is a particular case of a color. There is no need for complicating the model.

    There are some pre-defined colors that you can use if you can find the color you’re looking for. These simply return a Color object that has an ARGB value matching the pre-defined color, so they’re really not doing anything different than your code is doing above. They’re simply there for the convenience of the programmer who can’t or doesn’t want to remember the not-so-intuitive RGB color model.

    You seem to be concerned about the potential expense or redundancy of creating a Color object, but there are a couple of reasons why this shouldn’t be a concern. You can think of the FromArgb method as an overloaded constructor for the Color object: this is the way that you create a color other than the pre-defined ones. It simply creates the color object that is defined as the RGB values that you specify. In fact, there’s really no other way to represent a color (aside from alternative color models such as HSV, but even then you’d have to specify three separate values: a hue of 0, a saturation of 0, and a value of 39). We humans can describe colors in much more abstract ways, but a computer doesn’t really understand or care about these things. The documentation for the Color structure itself explains that it just represents the RGB values, along with the alpha (transparency) value. It’s a very small object that contains about 4 byte values. And that’s precisely how the method that you pass the color to (Bitmap.SetPixel) is going to draw the color, based on those red, green, and blue values.

    It’s also worth pointing out that Color is a structure, which is a value type, rather than a reference type. That means, among other things, that it lives inline, wherever your variable is defined. It doesn’t point to another object, it lives locally on the stack rather than on the heap, and the stack is cheap. This makes it at least somewhat less expensive than a reference type such as a class.

    Finally, I’d be remiss if I didn’t point out that this type of micro-optimization is rarely going to make any difference in the performance of your code.

    In short, no there’s no such thing, but that’s nothing to worry about.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a new view on a rightcalloutaccessoryview button press. I currently
The site is currently written in PHP. I want to add a new component
I want to add a parameter to a URL but currently it isnt showing
I want to add explicit lock on row which is currently being updated and
I want to add support for Arabic (or other languages which are currently unsupported)
I currently have a listview and I want to add an appropriate icon to
I want to add traffic information to my custom map. Currently I'm using a
I currently have a statement which reads if(Arrays.asList(results).contains(Word)); and I want to add at
I have a Lucene index which is currently case sensitive. I want to add
This is weird, I am currently using iTextSharp and I want to add a

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.