anonymizeScreenshot method
Future<Uint8List?>
anonymizeScreenshot({
- required Uint8List imageBytes,
- required BuildContext context,
- required double devicePixelRatio,
Simple anonymization - blur all text if enabled
Implementation
Future<Uint8List?> anonymizeScreenshot({
required Uint8List imageBytes,
required BuildContext context,
required double devicePixelRatio,
}) async {
ObslyLogger.debug('anonymizeScreenshot called - enabled: ${_config?.enabled}, devicePixelRatio: $devicePixelRatio');
if (_config?.enabled != true) {
ObslyLogger.debug('Anonymization disabled, returning original image');
return imageBytes;
}
try {
// Find all text widgets
final textAreas = _findTextWidgets(context, devicePixelRatio);
ObslyLogger.verboseDetails('SCREENSHOT', 'Text widgets found: ${textAreas.length}');
if (textAreas.isEmpty) {
ObslyLogger.debug('No text areas found, returning original image');
return imageBytes;
}
// Apply blur in main thread (compute() doesn't work for canvas operations)
return await _blurText({
'imageBytes': imageBytes,
'textAreas': textAreas,
});
} catch (e) {
ObslyLogger.error('Error anonymizing screenshot: $e');
return imageBytes;
}
}