diff --git a/Mousecape/Mousecape/Mousecape-Info.plist b/Mousecape/Mousecape/Mousecape-Info.plist index a43b3a6..5216362 100644 --- a/Mousecape/Mousecape/Mousecape-Info.plist +++ b/Mousecape/Mousecape/Mousecape-Info.plist @@ -34,11 +34,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1801 + 1811 CFBundleSignature ???? CFBundleVersion - 1801 + 1811 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Mousecape/Mousecape/src/models/MCCursor.m b/Mousecape/Mousecape/src/models/MCCursor.m index 01e7e36..4e1f309 100644 --- a/Mousecape/Mousecape/src/models/MCCursor.m +++ b/Mousecape/Mousecape/src/models/MCCursor.m @@ -105,8 +105,6 @@ - (BOOL)_readFromDictionary:(NSDictionary *)dictionary ofVersion:(CGFloat)versio NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithData:data]; rep.size = NSMakeSize(self.size.width, self.size.height * self.frameCount); - // PNGCodec ignores colorspace information. As an invariant to our cape files we make sure - // all images are converted to sRGB so we retag it beforehand [self setRepresentation:rep.retaggedSRGBSpace forScale:cursorScaleForScale(rep.pixelsWide / pointsWide.doubleValue)]; } @@ -131,7 +129,7 @@ - (NSDictionary *)dictionaryRepresentation { NSMutableArray *pngs = [NSMutableArray array]; for (NSString *key in self.representations) { NSBitmapImageRep *rep = self.representations[key]; - pngs[pngs.count] = [rep.ensuredSRGBSpace representationUsingType:NSPNGFileType properties:@{}]; + pngs[pngs.count] = [rep.ensuredSRGBSpace TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0]; } drep[MCCursorDictionaryRepresentationsKey] = pngs; diff --git a/Mousecape/Mousecape/src/views/MMAnimatingImageView.m b/Mousecape/Mousecape/src/views/MMAnimatingImageView.m index a20e361..f7a54b6 100755 --- a/Mousecape/Mousecape/src/views/MMAnimatingImageView.m +++ b/Mousecape/Mousecape/src/views/MMAnimatingImageView.m @@ -118,7 +118,7 @@ - (BOOL)layer:(CALayer *)layer shouldInheritContentsScale:(CGFloat)newScale from // Tell OSX that our view can accept images to be dragged in - (void)registerTypes { - [self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, NSPasteboardTypePNG, NSFilenamesPboardType, nil]]; + [self registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeTIFF, NSFilenamesPboardType, nil]]; } - (void)viewDidMoveToWindow { @@ -277,21 +277,15 @@ - (void)mouseDown:(NSEvent *)event { - (void)pasteboard:(NSPasteboard *)sender item:(NSPasteboardItem *)item provideDataForType:(NSString *)type { if ([type compare: NSPasteboardTypeTIFF] == NSOrderedSame) { [sender setData:[self.image TIFFRepresentation] forType:NSPasteboardTypeTIFF]; - } else if ([type compare: NSPasteboardTypePNG] == NSOrderedSame) { - NSImageRep *rep =self.image.representations.lastObject; - if ([rep isKindOfClass:[NSBitmapImageRep class]]) { - [sender setData:[(NSBitmapImageRep *)rep representationUsingType:NSPNGFileType properties:@{}] forType:NSPasteboardTypePNG]; - } else { - // abort(); - } } else if ([type compare:@"public.image"] == NSOrderedSame) { [sender writeObjects:@[ self.image ]]; } else if ([type compare:(__bridge NSString *)kPasteboardTypeFileURLPromise] == NSOrderedSame && SHOULDCOPY) { - NSURL *url = [[NSURL URLWithString:[item stringForType:@"com.apple.pastelocation"]] URLByAppendingPathComponent:[NSString stringWithFormat:@"Mousecape Image (%f).png", NSDate.date.timeIntervalSince1970]]; + NSURL *url = [[NSURL URLWithString:[item stringForType:@"com.apple.pastelocation"]] URLByAppendingPathComponent:[NSString stringWithFormat:@"Mousecape Image (%f).tiff", NSDate.date.timeIntervalSince1970]]; NSImageRep *rep =self.image.representations.firstObject; if ([rep isKindOfClass:[NSBitmapImageRep class]]) { - [[(NSBitmapImageRep *)rep representationUsingType:NSPNGFileType properties:@{}] writeToFile:url.path atomically:NO]; + NSBitmapImageRep* bitmap = (NSBitmapImageRep*)rep; + [[bitmap TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0] writeToFile:url.path atomically:NO]; } else { abort(); } diff --git a/Mousecape/mousecloak/MCDefs.m b/Mousecape/mousecloak/MCDefs.m index ef4dbd1..b3c49c1 100644 --- a/Mousecape/mousecloak/MCDefs.m +++ b/Mousecape/mousecloak/MCDefs.m @@ -85,7 +85,7 @@ void CGImageWriteToFile(CGImageRef image, CFStringRef path) { NSData *pngDataForImage(id image) { if ([image isKindOfClass:[NSBitmapImageRep class]]) { - return [(NSBitmapImageRep *)image representationUsingType:NSPNGFileType properties:@{}]; + return [(NSBitmapImageRep *)image TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0]; } // CGImage diff --git a/Mousecape/mousecloak/create.m b/Mousecape/mousecloak/create.m index 7fa96ef..75e935e 100644 --- a/Mousecape/mousecloak/create.m +++ b/Mousecape/mousecloak/create.m @@ -113,7 +113,7 @@ NSBitmapImageRep *image = [NSBitmapImageRep imageRepWithData:[NSData dataWithContentsOfFile:repPath]]; if (image) { - NSData *pngData = [image.ensuredSRGBSpace representationUsingType:NSPNGFileType properties:@{}]; + NSData *pngData = [image.ensuredSRGBSpace TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0]; [representations addObject:pngData]; } @@ -191,7 +191,7 @@ bytesPerRow:bpr.integerValue bitsPerPixel:bpp.integerValue]; - currentCursor[MCCursorDictionaryRepresentationsKey] = @[ [rep.ensuredSRGBSpace representationUsingType:NSPNGFileType properties:@{}] ]; + currentCursor[MCCursorDictionaryRepresentationsKey] = @[ [rep.ensuredSRGBSpace TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0] ]; currentCursor[MCCursorDictionaryPointsWideKey] = wide; currentCursor[MCCursorDictionaryPointsHighKey] = high; currentCursor[MCCursorDictionaryHotSpotXKey] = hotX;