UTMScreenshot.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // Copyright © 2020 osy. All rights reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. //
  16. #import "TargetConditionals.h"
  17. #if TARGET_OS_IPHONE
  18. #include <UIKit/UIKit.h>
  19. #else
  20. #include <AppKit/AppKit.h>
  21. #endif
  22. NS_ASSUME_NONNULL_BEGIN
  23. @interface UTMScreenshot : NSObject
  24. #if TARGET_OS_IPHONE
  25. @property (nonatomic, readonly) UIImage *image;
  26. #else
  27. @property (nonatomic, readonly) NSImage *image;
  28. #endif
  29. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  30. #if TARGET_OS_IPHONE
  31. - (instancetype)initWithImage:(UIImage *)image;
  32. #else
  33. - (instancetype)initWithImage:(NSImage *)image;
  34. #endif
  35. - (instancetype)initWithContentsOfURL:(NSURL *)url;
  36. - (void)writeToURL:(NSURL *)url atomically:(BOOL)atomically;
  37. @end
  38. NS_ASSUME_NONNULL_END