10#include <winpr/wtypes.h>
14@synthesize image = _image;
15@synthesize hotspot = _hotspot;
17- (id)initWithRGBABytes:(const
void *)bytes
18 width:(NSUInteger)width
19 height:(NSUInteger)height
20 hotspot:(CGPoint)hotspot
26 if (!bytes || (width == 0) || (height == 0))
32 NSData *pixelData = [NSData dataWithBytes:bytes length:width * height * 4];
33 CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)pixelData);
34 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
35 CGImageRef imageRef = CGImageCreate(width, height, 8, 32, width * 4, colorSpace,
36 kCGBitmapByteOrderDefault | kCGImageAlphaLast, provider,
37 nullptr, NO, kCGRenderingIntentDefault);
39 CGColorSpaceRelease(colorSpace);
40 CGDataProviderRelease(provider);
48 _image = [[UIImage imageWithCGImage:imageRef scale:1.0
49 orientation:UIImageOrientationUp] retain];
51 CGImageRelease(imageRef);
58 const CGSize size = CGSizeMake(24.0, 32.0);
59 UIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
61 UIBezierPath *path = [UIBezierPath bezierPath];
62 [path moveToPoint:CGPointMake(2.0, 1.0)];
63 [path addLineToPoint:CGPointMake(2.0, 25.0)];
64 [path addLineToPoint:CGPointMake(8.5, 19.0)];
65 [path addLineToPoint:CGPointMake(13.0, 30.0)];
66 [path addLineToPoint:CGPointMake(18.0, 28.0)];
67 [path addLineToPoint:CGPointMake(13.5, 17.0)];
68 [path addLineToPoint:CGPointMake(22.0, 17.0)];
70 [[UIColor whiteColor] setFill];
71 [[UIColor blackColor] setStroke];
72 [path setLineWidth:2.0];
76 UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
77 UIGraphicsEndImageContext();
80 [cursor setImage:image];
81 [cursor setHotspot:CGPointMake(2.0, 1.0)];