Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (26 sloc) 656 Bytes
//
// DTImage+HTML.m
// DTCoreText
//
// Created by Oliver Drobnik on 31.01.12.
// Copyright (c) 2012 Drobnik.com. All rights reserved.
//
#import "DTImage+HTML.h"
#if TARGET_OS_IPHONE
@implementation UIImage (HTML)
- (NSData *)dataForPNGRepresentation
{
return UIImagePNGRepresentation(self);
}
@end
#else
@implementation NSImage (HTML)
- (NSData *)dataForPNGRepresentation
{
[self lockFocus];
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, self.size.width, self.size.height)];
[self unlockFocus];
return [bitmapRep representationUsingType:NSPNGFileType properties:Nil];
}
@end
#endif
Jump to Line
Something went wrong with that request. Please try again.