Skip to content

Instantly share code, notes, and snippets.

- (void)copyAttributesFromObject:(NSManagedObject *)oldObject toObject:(NSManagedObject *)newObject
{
NSArray *attributeKeys = [[[oldObject entity] attributesByName] allKeys];
NSDictionary *attributes = [oldObject dictionaryWithValuesForKeys:attributeKeys];
[newObject setValuesForKeysWithDictionary:attributes];
}
@EverythingSolution
EverythingSolution / gist:1255741
Created October 1, 2011 07:47
Subpixel Test
static inline CGColorSpaceRef GetDeviceGrayScaleColorSpace(void)
{
static CGColorSpaceRef deviceGrayscaleSpace = NULL;
if (deviceGrayscaleSpace == NULL)
deviceGrayscaleSpace = CGColorSpaceCreateDeviceGray();
return deviceGrayscaleSpace;
}
static inline CGContextRef CreateGrayScaleCGBitmapContextForWidthAndHeight(void *data,
unsigned int width,
@EverythingSolution
EverythingSolution / gist:1196284
Created September 6, 2011 00:57
5 bits per pixel, no alpha
static const CGBitmapInfo kDefault16CGBitmapInfoNoAlpha = (kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder16Host);
CGContextRef CreateCGBitmapContextForWidthAndHeight(void *data, unsigned int width, unsigned int height)
{
CGColorSpaceRef colorSpace = GetDeviceRGBColorSpace(); // function to get static color space instance
CGBitmapInfo alphaInfo = kDefault16CGBitmapInfoNoAlpha;
return CGBitmapContextCreate(
data,
width,
height,
5, /* Bits per component */
@implementation ThreadyMcThreaderson
{
dispatch_queue_t _syncQueue;
}
- (id)init
{
self = [super init];
if (self)
{