This is another more powerful and flexible function for inverting white text.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT IG_IC_invert_white_text_ex ( HIGEAR hIGear, INT MinX, MinY, INT MinT, INT MinLetterSize, INT MaxLetterSize, INT MaxBorder ); |
Arguments:
hIGear | HIGEAR handle of image. |
MinX | Minimum width of the region to be considered. |
MinY | Minimum height of the region to be considered. |
MinT | Minimum "thickness" of spaces falling between sections of text for inversion. |
MinLetterSize | Minimum size of the white letter. |
MaxLetterSize | Maximum size of the white letter. |
MaxBorder | Maximum size of the border around the letter cell. |
Return Value:
Returns the number of ImageGear errors that occurred during this function call.
Supported Raster Image Formats:
Indexed RGB – 1 bpp.
Sample:
ImageClean
Remarks:
This function automatically detects areas of white text on black backgrounds in 1-bit images and inverts them so that they become black text on white backgrounds. This function scans your entire image and makes adjustments to all areas of white text (on black) that fall within the scope of your settings.
- The arguments MinXand MinYtell ImageGear the minimum width and height (respectively) for areas that you would like to invert. For example, if you set MinX= 60 andMinY= 20, ImageGear will only invert sections of white text on black background that have a minimum width of 60 pixels and a minimum height of 20 pixels.
- The third argument of this function, MinT, sets the minimum "thickness" of spaces that fall between sections of text that will be inverted. This minimum value indicates those sections of text to be treated as one section based on how close they are to one another. As an example, let's say you have three adjacent sections of white text on black backgrounds that contain the words, "There," "is," and "hope." If "There" and "hope" meet your minimum size requirements they will be inverted. If "is" is below your minimum size requirements and you have not set MinT, "is" will note be inverted, resulting in "There" and "hope" looking normal, while "is" remains white text on black background. To prevent this (if desired), you would need to set MinT to a value small enough to include the spaces before and after the word "is." This way, all the words would be treated as one section and inverted together.
- The arguments MinLetterSize and MaxLetterSize determine the minimum and maximum sizes of the white letters to be inverted. In this case letter size means the maximum value of width and height of the letter cell that is the minimum rectangle that completely covers the letter.
- The argument MaxBorder sets size of the maximum border around the letter that will be inverted along with the letter cell. For example, if width and height of the letter cell are 20 and 30 respectively and MaxBorder = 10, then the width and the height of the rectangle that will be inverted are 40 (10+20+10) and 50 (10+30+10) respectively. Please be careful when setting this parameter. If it is very large, it is possible that incorrect image areas will be inverted.
Refer to the Component Manager API section.
See also IG_IC_invert_white_text() function.