addTextWatermark method

  1. @override
Future<String?> addTextWatermark(
  1. String filePath,
  2. String text,
  3. int x,
  4. int y,
  5. int textSize,
  6. Color color,
  7. bool isNeedRotateToPortrait,
  8. Color? backgroundTextColor,
  9. int quality,
  10. int? backgroundTextPaddingTop,
  11. int? backgroundTextPaddingBottom,
  12. int? backgroundTextPaddingLeft,
  13. int? backgroundTextPaddingRight,
  14. ImageFormat imageFormat,
)
override

Adds a text watermark to the image at the specified location with the given parameters. Use just for IOS or Android. For WEB version you should use addTextWatermarkUint8List()

Returns a String representing the path to the watermarked image.

Implementation

@override
Future<String?> addTextWatermark(
  String filePath,
  String text,
  int x,
  int y,
  int textSize,
  Color color,
  bool isNeedRotateToPortrait,
  Color? backgroundTextColor,
  int quality,
  int? backgroundTextPaddingTop,
  int? backgroundTextPaddingBottom,
  int? backgroundTextPaddingLeft,
  int? backgroundTextPaddingRight,
  ImageFormat imageFormat,
) async {
  final result = await watermarkImageChannel.invokeMethod<String?>(
    'addTextWatermark',
    {
      'text': text,
      'filePath': filePath,
      'x': x,
      'y': y,
      'textSize': textSize,
      'color': color.value.toInt(),
      'backgroundTextColor': backgroundTextColor?.value.toInt(),
      'quality': quality,
      'backgroundTextPaddingTop': backgroundTextPaddingTop,
      'backgroundTextPaddingBottom': backgroundTextPaddingBottom,
      'backgroundTextPaddingLeft': backgroundTextPaddingLeft,
      'backgroundTextPaddingRight': backgroundTextPaddingRight,
      'isNeedRotate': isNeedRotateToPortrait,
      'imageFormat': imageFormat.name,
    },
  );
  return result;
}