FBScreenshot.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. @class UTType;
  11. NS_ASSUME_NONNULL_BEGIN
  12. @interface FBScreenshot : NSObject
  13. /**
  14. Retrieves non-scaled screenshot of the whole screen
  15. @param quality The number in range 0-3, where 0 is PNG (lossless), 3 is HEIC (lossless), 1- low quality JPEG and 2 - high quality JPEG
  16. @param error If there is an error, upon return contains an NSError object that describes the problem.
  17. @return Device screenshot as PNG-encoded data or nil in case of failure
  18. */
  19. + (nullable NSData *)takeInOriginalResolutionWithQuality:(NSUInteger)quality
  20. error:(NSError **)error;
  21. /**
  22. Retrieves non-scaled screenshot of the whole screen
  23. @param screenID The screen identifier to take the screenshot from
  24. @param compressionQuality Normalized screenshot quality value in range 0..1, where 1 is the best quality
  25. @param uti UTType... constant, which defines the type of the returned screenshot image
  26. @param timeout how much time to allow for the screenshot to be taken
  27. @param error If there is an error, upon return contains an NSError object that describes the problem.
  28. @return Device screenshot as PNG-, HEIC- or JPG-encoded data or nil in case of failure
  29. */
  30. + (nullable NSData *)takeInOriginalResolutionWithScreenID:(long long)screenID
  31. compressionQuality:(CGFloat)compressionQuality
  32. uti:(UTType *)uti
  33. timeout:(NSTimeInterval)timeout
  34. error:(NSError **)error;
  35. @end
  36. NS_ASSUME_NONNULL_END