Guest User

Untitled

a guest
Sep 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const void* const DataPointer = AvatarQueryIter->get<const void* const>(1);
  2.                 autorelease<NSData> Data = [[NSData alloc] initWithBytes:const_cast<void*>(DataPointer) length:Size];
  3.                 autorelease<NSImage> Image = [[NSImage alloc] initWithData:Data];
  4.                 const CGFloat ImageSize = 50.0;
  5.                 const CGFloat XOffset = 3.0;
  6.                 const CGFloat YOffset = -1.0;
  7.                 [Image setSize:NSMakeSize(ImageSize, ImageSize)];
  8.                 NSImage* RImage = [[NSImage alloc] initWithSize:NSMakeSize(ImageSize + fabsf(XOffset), ImageSize + fabsf(YOffset))];
  9.                 [NSGraphicsContext saveGraphicsState];
  10.                
  11.                 [RImage lockFocus];
  12.                
  13.                 NSRect rect = NSMakeRect(XOffset, YOffset, ImageSize, ImageSize);
  14.                 NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:5 yRadius:5];
  15.                 [path addClip];
  16.                
  17.                 [Image drawInRect:rect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];
  18.                
  19.                 [RImage unlockFocus];
  20.                
  21.                 [NSGraphicsContext restoreGraphicsState];
  22.                 DataSet.avatars[UserID] = RImage;
Add Comment
Please, Sign In to add comment