/* Image support for the NeXT/Open/GNUstep and MacOSX window system.
- Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2012
- Free Software Foundation, Inc.
+ Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2013 Free Software
+ Foundation, Inc.
This file is part of GNU Emacs.
/* This should be the first include, as it may set up #defines affecting
interpretation of even the system includes. */
#include <config.h>
-#include <setjmp.h>
#include "lisp.h"
#include "dispextern.h"
return [EmacsImage allocInitFromFile: file];
}
-int
+bool
ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data)
{
[bmRep release];
return nil;
}
-#define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10)
+#define hexchar(x) ('0' <= (x) && (x) <= '9' ? (x) - '0' : (x) - 'a' + 10)
s1 = *s++;
s2 = *s++;
c = hexchar (s1) * 0x10 + hexchar (s2);
{
NSSize s = [self size];
unsigned char *planes[5];
- CGFloat r, g, b, a;
+ EmacsCGFloat r, g, b, a;
NSColor *rgbColor;
if (bmRep == nil || color == nil)
if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
{
bmRep = (NSBitmapImageRep *) rep;
- onTiger = [bmRep respondsToSelector: @selector (colorAtX:y:)];
if ([bmRep numberOfPlanes] >= 3)
[bmRep getBitmapDataPlanes: pixmapData];
| (pixmapData[0][loc] << 16) | (pixmapData[1][loc] << 8)
| (pixmapData[2][loc]);
}
- else if (onTiger)
+ else
{
NSColor *color = [bmRep colorAtX: x y: y];
- CGFloat r, g, b, a;
+ EmacsCGFloat r, g, b, a;
[color getRed: &r green: &g blue: &b alpha: &a];
return ((int)(a * 255.0) << 24)
| ((int)(r * 255.0) << 16) | ((int)(g * 255.0) << 8)
| ((int)(b * 255.0));
}
- return 0;
}
- (void) setPixelAtX: (int)x Y: (int)y toRed: (unsigned char)r
pixmapData[2][loc] = b;
pixmapData[3][loc] = a;
}
- else if (onTiger)
+ else
{
[bmRep setColor:
[NSColor colorWithCalibratedRed: (r/255.0) green: (g/255.0)
pixmapData[3][loc] = a;
}
- else if (onTiger)
+ else
{
NSColor *color = [bmRep colorAtX: x y: y];
color = [color colorWithAlphaComponent: (a / 255.0)];
}
@end
-