DocumentCleanupConfiguration class
The document cleanup configuration.
Constructors
- DocumentCleanupConfiguration({bool keepText = true, int maxUndoRedoStackSize = 3, int maxCleanupResolution = 0, int maxMaskBoundingBoxArea = 600000})
-
DocumentCleanupConfiguration.fromJson(Map<
String, dynamic> json) -
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- keepText ↔ bool
-
If true, detected text is preserved.
When enabled, text detection is run, which can be time-consuming.
For a better user experience, consider constructing the document cleanup asynchronously.
getter/setter pair
- maxCleanupResolution ↔ int
-
Maximum area (width × height) of the axis-aligned cleanup-region crop.
If the mask's bounding rectangle exceeds this limit, the input image is downscaled
before cleanup is applied. The cleaned result is then upscaled and written back
into the original-resolution image.
Use this option to limit peak memory consumption.
Memory consumption depends on both the input image resolution and the cleanup area size.
Set to 0 to disable the limit.
For example, setting it to 1200000 uses approximately 0.5 GB for a 12 MP input image.
Whenever possible, prefer running DocumentCleanup on smaller areas instead of relying on this option,
as it reduces cleanup quality.
getter/setter pair
- maxMaskBoundingBoxArea ↔ int
-
Maximum allowed area (width × height, in pixels) of the axis-aligned bounding
box enclosing all non-zero pixels of the mask passed to run().
If the mask's bounding box area exceeds this limit, cleanup is not performed:
run() returns the current (unchanged) image with status ERROR_MASK_TOO_LARGE
and the undo/redo history is left untouched.
Use this option as a hard guard against unintentionally large cleanup regions
that would take a long time to process. Execution time of a single cleanup
call grows roughly with the mask's bounding-box area, so capping it bounds
the worst-case latency of run().
Note the difference from maxCleanupResolution: maxCleanupResolution silently
reduces quality by internal downscaling to bound peak memory, whereas
maxMaskBoundingBoxArea rejects oversized masks outright so the caller can
react (e.g. ask the user to select a smaller area).
The default of 600000 (approximately 0.6 MP) is a good fit for typical
interactive cleanup on a single object or text block.
Set to 0 to disable the limit.
getter/setter pair
- maxUndoRedoStackSize ↔ int
-
Maximum number of undo/redo operations to keep in memory.
Must be non-negative. If 0, undo/redo operations are unavailable.
When the number of operations exceeds this limit, the oldest entries can no longer be undone.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
{ToJsonConfiguration? config}) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited