The redact operation is conducted by an ImageGear redactor object (HIG_REC_REDACTOR) against an array of matches (AT_REC_MATCH_RESULT) to produce redacted duplicates of the searched page (HIGEAR), document (HMIGEAR), or Unicode string.
To redact a page, document or string:
Create the Redactor Object
Manage the lifetime of the redactor object using IG_REC_redactor_create and IG_REC_redactor_delete.
Create a redactor object using the function IG_REC_redactor_create. When it is no longer needed, use the function IG_REC_redactor_delete to release its resources.
ImageGear HIG_REC_REDACTOR instances are not thread-safe. Callers are responsible for synchronizing access to instances shared across multiple threads before invoking operations that could modify or delete that instance.
Configure the Redaction
After creating a redactor object, configure the style information used to redact search matches and to receive notifications as the matches are redacted. Configurable settings include:
-
Fill color. The fill color is used to draw a solid rectangle within the match bounding boxes. Use the function IG_REC_redactor_fillcolor_set to choose an appropriate fill color.
To give the appearance that text has been erased instead of redacted, choose a fill color that matches the page background color, e.g., white on white.
-
Text color. The text color is used to draw replacement text inside match bounding boxes. Specify the color used to draw replacement text into each match result. Use the function IG_REC_redactor_textcolor_set to choose an appropriate text color.
Choose a color that contrasts well with the fill color, e.g., black on white.
-
Replacement text. Each letter of a match is replaced with this character. No portion of the replacement text is drawn outside match bounding boxes. Use the function IG_REC_redactor_replacement_text_set to choose a suitable replacement character.
To visually identify how many characters are redacted, choose a distinguishable replacement character, e.g., asterisk ("*", U+002A).
-
Font attributes. The font attributes establish the visual appearance of replacement text. Use the function IG_REC_redactor_font_set to specify suitable font attributes to use when redacting matches.
If the font size is too large for a match’s bounding box, replacement text will be clipped.
-
Notifications. Install callbacks to receive notification when all page matches are redacted and progress is noted during the redact operation:
-
Redacted callback. The redacted callback is called after all matches for a page have been successfully redacted. This notification can be expected to occur once per page. Invoke the function IG_REC_redactor_redacted_cb_set to install a user-defined redacted callback.
Applications that need access to redacted callback data after the callback returns must duplicate relevant data and assume ownership of the copy.
-
Progress callback. The progress callback is invoked periodically during the redact operation to report the estimated percentage of the redact operation completed. This callback also presents an opportunity for the caller to stop the redactor prior to completion. Use the function IG_REC_redactor_progress_cb_set to install a user-defined progress callback.
Any changes made to the HMIGEAR sources before redact is stopped are retained.
Redact Recovered Matches
After the redactor has been configured, redact the matches recovered from the search of the page, document or Unicode string using the function IG_REC_redactor_redact.
- When redacting a single-page image, the image data referenced with HIGEAR is replaced upon successful completion.
- When redacting a multi-page image, page image data referenced with HMIGEAR is replaced after all matches for that page are successfully redacted.
- When redacting a recognition page, the image data referenced with HIG_REC_IMAGE is not modified upon successful completion. Install a redacted callback to recover the redacted image data.
- When redacting a recognition document, the data referenced with HIG_REC_DOCUMENT is not modified upon successful completion. Install a redacted callback to recover the redacted image data.