Hey, I am working with tables and I am using the mentioned method to check for the TextColor. I use the FromArgb method of the Color-object to convert the value into a Color object.

int textColor;  
int backColor;  
image.GetTextBackgroundColor(tableCell.Left, tableCell.Top, tableCell.Right, tableCell.Bottom, 0, out textColor, out backColor);  
Color tc = Color.FromArgb(textColor);  
Color bc = Color.FromArgb(backColor);

When I check the RGB values of tc, I get the values 70,70,115 for (slightly) red text color. The values indicate a blue color. For blue text it is the other way around.
In case I made a mistake in the way I output the color... here is my output.

Console.WriteLine(String.Format("Cell{0} contains text color: ({1},{2},{3}) background: ({4},{5},{6})", i, tc.R, tc.G, tc.B, bc.R, bc.G, bc.B));

There is no problem in fixing this but I was wondering if you calculate the int for the color differently than the standard AARRGGBB.

asked 27 May '16, 11:21

Florian's gravatar image

Florian
153


This situation, not #AARRGGBB, but #RRGGBB model is used. Here is the Help quote: "The int value is calculated from the RGB triplet using the formula: (red value) + (256 x green value) + (65536 x blue value), where red value is the first triplet component, green value is the second triplet component, blue value is the third triplet component."

link

answered 30 May '16, 15:10

Anna%20Savinova's gravatar image

Anna Savinova ♦♦
362

As far as I am concerned, the formula indicates a #BBGGRR model. However, thank you for clarifying how the value is calculated.

(01 Jun '16, 11:03) Florian
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4
×2
×1
×1

Asked: 27 May '16, 11:21

Seen: 337 times

Last updated: 01 Jun '16, 11:03

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal