CSDisplayMetal.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // Copyright © 2019 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 <Foundation/Foundation.h>
  17. #import "UTMRenderSource.h"
  18. @import CoreGraphics;
  19. @class UTMScreenshot;
  20. typedef struct _SpiceSession SpiceSession;
  21. NS_ASSUME_NONNULL_BEGIN
  22. @interface CSDisplayMetal : NSObject <UTMRenderSource>
  23. @property (nonatomic, assign) BOOL ready;
  24. @property (nonatomic, readonly, nullable) SpiceSession *session;
  25. @property (nonatomic, readonly, assign) NSInteger channelID;
  26. @property (nonatomic, readonly, assign) NSInteger monitorID;
  27. @property (nonatomic, assign) CGSize displaySize;
  28. @property (nonatomic, readonly) UTMScreenshot *screenshot;
  29. @property (nonatomic, assign) BOOL inhibitCursor;
  30. @property (nonatomic) CGSize cursorSize;
  31. // properties from UTMRenderSource
  32. @property (nonatomic, readonly) BOOL cursorVisible;
  33. @property (nonatomic) CGPoint cursorOrigin;
  34. @property (nonatomic) CGPoint viewportOrigin;
  35. @property (nonatomic) CGFloat viewportScale;
  36. @property (nonatomic, readonly) dispatch_semaphore_t drawLock;
  37. @property (nonatomic, nullable) id<MTLDevice> device;
  38. @property (nonatomic, nullable, readonly) id<MTLTexture> displayTexture;
  39. @property (nonatomic, nullable, readonly) id<MTLTexture> cursorTexture;
  40. @property (nonatomic, readonly) NSUInteger displayNumVertices;
  41. @property (nonatomic, readonly) NSUInteger cursorNumVertices;
  42. @property (nonatomic, nullable, readonly) id<MTLBuffer> displayVertices;
  43. @property (nonatomic, nullable, readonly) id<MTLBuffer> cursorVertices;
  44. - (instancetype)init NS_UNAVAILABLE;
  45. - (instancetype)initWithSession:(nonnull SpiceSession *)session channelID:(NSInteger)channelID monitorID:(NSInteger)monitorID NS_DESIGNATED_INITIALIZER;
  46. - (instancetype)initWithSession:(nonnull SpiceSession *)session channelID:(NSInteger)channelID;
  47. - (void)updateVisibleAreaWithRect:(CGRect)rect;
  48. - (void)requestResolution:(CGRect)bounds;
  49. - (void)forceCursorPosition:(CGPoint)pos;
  50. @end
  51. NS_ASSUME_NONNULL_END