IMG_ImageIO.m
changeset 292 5953114c0d27
parent 283 ec183abd5996
child 308 ea460af4ceff
equal deleted inserted replaced
291:0a42199fd73f 292:5953114c0d27
   210     Uint32 Gmask;
   210     Uint32 Gmask;
   211     Uint32 Bmask;
   211     Uint32 Bmask;
   212     
   212     
   213     CGContextRef bitmap_context;
   213     CGContextRef bitmap_context;
   214     CGBitmapInfo bitmap_info;
   214     CGBitmapInfo bitmap_info;
   215     CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
   215 
   216     
   216 	/* This sets up a color space that results in identical values
       
   217 	 * as the image data itself, which is the same as the standalone
       
   218 	 * libpng loader.
       
   219 	 * Thanks to Allegro. :)
       
   220 	 */
       
   221 	CGFloat whitePoint[3] = { 1, 1, 1 };
       
   222 	CGFloat blackPoint[3] = { 0, 0, 0 };
       
   223 	CGFloat gamma[3] = { 2.2, 2.2, 2.2 };
       
   224 	CGFloat matrix[9] = {
       
   225 		1, 1, 1,
       
   226 		1, 1, 1,
       
   227 		1, 1, 1
       
   228 	};
       
   229 	CGColorSpaceRef color_space =
       
   230 		CGColorSpaceCreateCalibratedRGB(
       
   231 									whitePoint, blackPoint, gamma, matrix
       
   232 									);   
       
   233 	
   217     if (alpha == kCGImageAlphaNone ||
   234     if (alpha == kCGImageAlphaNone ||
   218         alpha == kCGImageAlphaNoneSkipFirst ||
   235         alpha == kCGImageAlphaNoneSkipFirst ||
   219         alpha == kCGImageAlphaNoneSkipLast) {
   236         alpha == kCGImageAlphaNoneSkipLast) {
   220         bitmap_info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; /* XRGB */
   237         bitmap_info = kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host; /* XRGB */
   221         Amask = 0x00000000;
   238         Amask = 0x00000000;