boundingRectWithSize method

CGRect boundingRectWithSize(
  1. CGSize size, {
  2. required NSStringDrawingOptions options,
  3. NSDictionary? attributes,
  4. NSStringDrawingContext? context,
})

boundingRectWithSize:options:attributes:context:

Implementation

objc.CGRect boundingRectWithSize(
  objc.CGSize size, {
  required NSStringDrawingOptions options,
  objc.NSDictionary? attributes,
  NSStringDrawingContext? context,
}) {
  objc.checkOsVersionInternal(
    'NSString.boundingRectWithSize:options:attributes:context:',
    iOS: (false, (7, 0, 0)),
    macOS: (false, (10, 11, 0)),
  );
  final _ptr = pkg_ffi.calloc<objc.CGRect>();
  objc.useMsgSendVariants
      ? _objc_msgSend_k8g3uStret(
          _ptr,
          this.ref.pointer,
          _sel_boundingRectWithSize_options_attributes_context_,
          size,
          options.value,
          attributes?.ref.pointer ?? ffi.nullptr,
          context?.ref.pointer ?? ffi.nullptr,
        )
      : _ptr.ref = _objc_msgSend_k8g3u(
          this.ref.pointer,
          _sel_boundingRectWithSize_options_attributes_context_,
          size,
          options.value,
          attributes?.ref.pointer ?? ffi.nullptr,
          context?.ref.pointer ?? ffi.nullptr,
        );
  final _finalizable = _ptr.cast<ffi.Uint8>().asTypedList(
    ffi.sizeOf<objc.CGRect>(),
    finalizer: pkg_ffi.calloc.nativeFree,
  );
  return ffi.Struct.create<objc.CGRect>(_finalizable);
}