@@ -44,19 +44,20 @@ + (NSCursor *)invisibleCursor
4444{
4545 static NSCursor *invisibleCursor = NULL ;
4646 if (!invisibleCursor) {
47- // RAW 16x16 transparent GIF
48- static unsigned char cursorBytes[] = {
49- 0x47 , 0x49 , 0x46 , 0x38 , 0x37 , 0x61 , 0x10 , 0x00 , 0x10 , 0x00 , 0x80 ,
50- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x21 , 0xF9 , 0x04 ,
51- 0x01 , 0x00 , 0x00 , 0x01 , 0x00 , 0x2C , 0x00 , 0x00 , 0x00 , 0x00 , 0x10 ,
52- 0x00 , 0x10 , 0x00 , 0x00 , 0x02 , 0x0E , 0x8C , 0x8F , 0xA9 , 0xCB , 0xED ,
53- 0x0F , 0xA3 , 0x9C , 0xB4 , 0xDA , 0x8B , 0xB3 , 0x3E , 0x05 , 0x00 , 0x3B
54- };
55-
56- NSData *cursorData = [NSData dataWithBytesNoCopy: &cursorBytes[0 ]
57- length: sizeof (cursorBytes)
58- freeWhenDone: NO ];
59- NSImage *cursorImage = [[NSImage alloc ] initWithData: cursorData];
47+ const int size = 32 ;
48+ NSImage *cursorImage = [[NSImage alloc ] initWithSize: NSMakeSize (size, size)];
49+ NSBitmapImageRep *imgrep = [[NSBitmapImageRep alloc ] initWithBitmapDataPlanes: NULL
50+ pixelsWide: size
51+ pixelsHigh: size
52+ bitsPerSample: 8
53+ samplesPerPixel: 4
54+ hasAlpha: YES
55+ isPlanar: NO
56+ colorSpaceName: NSDeviceRGBColorSpace
57+ bytesPerRow: (size * 4 )
58+ bitsPerPixel: 32 ];
59+ [cursorImage addRepresentation: imgrep];
60+
6061 invisibleCursor = [[NSCursor alloc ] initWithImage: cursorImage
6162 hotSpot: NSZeroPoint ];
6263 }
0 commit comments