FreeRDP
Loading...
Searching...
No Matches
RDPCursor Class Reference
Inheritance diagram for RDPCursor:
Collaboration diagram for RDPCursor:

Instance Methods

(id) - initWithRGBABytes:width:height:hotspot:
 

Class Methods

(RDPCursor *) + defaultCursor
 

Protected Attributes

UIImage * _image
 
CGPoint _hotspot
 

Properties

UIImage * image
 
CGPoint hotspot
 

Detailed Description

Definition at line 13 of file RDPCursor.h.

Method Documentation

◆ defaultCursor

+ (RDPCursor *) defaultCursor

Definition at line 1 of file RDPCursor.m.

57{
58 const CGSize size = CGSizeMake(24.0, 32.0);
59 UIGraphicsBeginImageContextWithOptions(size, NO, 1.0);
60
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)];
69 [path closePath];
70 [[UIColor whiteColor] setFill];
71 [[UIColor blackColor] setStroke];
72 [path setLineWidth:2.0];
73 [path fill];
74 [path stroke];
75
76 UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
77 UIGraphicsEndImageContext();
78
79 RDPCursor *cursor = [[[RDPCursor alloc] init] autorelease];
80 [cursor setImage:image];
81 [cursor setHotspot:CGPointMake(2.0, 1.0)];
82 return cursor;
83}

◆ initWithRGBABytes:width:height:hotspot:

- (id) initWithRGBABytes: (const void *)  bytes
width: (NSUInteger)  width
height: (NSUInteger)  height
hotspot: (CGPoint)  hotspot 

Definition at line 1 of file RDPCursor.m.

17 :(const void *)bytes
18 width:(NSUInteger)width
19 height:(NSUInteger)height
20 hotspot:(CGPoint)hotspot
21{
22 self = [super init];
23 if (!self)
24 return nil;
25
26 if (!bytes || (width == 0) || (height == 0))
27 {
28 [self release];
29 return nil;
30 }
31
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);
38
39 CGColorSpaceRelease(colorSpace);
40 CGDataProviderRelease(provider);
41
42 if (!imageRef)
43 {
44 [self release];
45 return nil;
46 }
47
48 _image = [[UIImage imageWithCGImage:imageRef scale:1.0
49 orientation:UIImageOrientationUp] retain];
50 _hotspot = hotspot;
51 CGImageRelease(imageRef);
52 return self;
53}

Field Documentation

◆ _hotspot

- (CGPoint) _hotspot
protected

Definition at line 16 of file RDPCursor.h.

◆ _image

- (UIImage*) _image
protected

Definition at line 15 of file RDPCursor.h.

Property Documentation

◆ hotspot

- (CGPoint) hotspot
readwritenonatomicassign

Definition at line 20 of file RDPCursor.h.

◆ image

- (UIImage*) image
readwritenonatomicretain

Definition at line 19 of file RDPCursor.h.


The documentation for this class was generated from the following files: