Last active
August 29, 2015 14:03
-
-
Save wilg/2d7f3057345321db0202 to your computer and use it in GitHub Desktop.
Quick Look Doesn't Work!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CoreFoundation/CoreFoundation.h> | |
#include <CoreServices/CoreServices.h> | |
#include <QuickLook/QuickLook.h> | |
#include <Cocoa/Cocoa.h> | |
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options); | |
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview); | |
OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options) | |
{ | |
@autoreleasepool { | |
NSURL *inputImageURL = (__bridge_transfer NSURL *)(CFBundleCopyResourceURL(QLPreviewRequestGetGeneratorBundle(preview), | |
(__bridge CFStringRef)@"MyImage", | |
(__bridge CFStringRef)@"png", NULL)); | |
NSImage *inputImage = [[NSImage alloc] initWithContentsOfURL:inputImageURL]; | |
QLPreviewRequestSetDataRepresentation(preview, | |
(__bridge CFDataRef)([inputImage TIFFRepresentation]), | |
kUTTypeImage, | |
nil); | |
} | |
return noErr; | |
} | |
void CancelPreviewGeneration(void *thisInterface, QLPreviewRequestRef preview) | |
{ | |
// Implement only if supported | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment