Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (26 sloc) 0.656 kb
//
// 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.