yllan / JXLook

JPEG-XL viewer on macOS
MIT License
69 stars 7 forks source link

Migrate to QLPreviewProvider after macOS 12 is released #15

Closed JLHwung closed 2 years ago

JLHwung commented 3 years ago

The QLPreviewProvider will be available in macOS 12. Although currently it is not documented, I guess it will share the similar design with QLThumbnailProvider, so we could expect a providePreview function that accepts a handler of QLPreviewReply.

The shape of QLPreviewReply is here: https://developer.apple.com/documentation/quicklook/qlpreviewreply It accepts a content size and bitmap data.

Migrating to QLPreviewProvider might solve issues like #12. The border is in some view which is not accessible at the time when preparePreviewOfFile is invoked. Note that at this time we can only access (NSNextStepFrameViewBridge -> QLUIServiceView -> self.view) from superview, and none of them features a border. The outer view lost track of the content size so an ugly border is placed around the image.