В настоящее время у меня проблемы с CGImageRef
.
Всякий раз, когда я создаю CGImageRef
и смотрю на него в представлении отладчика, в Xcode это nil
.
Вот код:
-(void)mouseMoved:(NSEvent *)theEvent{
if (self.shoulddrag) {
NSPoint event_location = [theEvent locationInWindow];//direct from the docs
NSPoint local_point = [self convertPoint:event_location fromView:nil];//direct from the docs
CGImageRef theImage = (__bridge CGImageRef)(self.image);
CGImageRef theClippedImage = CGImageCreateWithImageInRect(theImage, CGRectMake(local_point.x,local_point.y,1,1));
NSImage * image = [[NSImage alloc] initWithCGImage:theClippedImage size:NSZeroSize];
self.pixleView.image = image;
CGImageRelease(theClippedImage);
}
}
Хотя все остальное вроде работает. Я не могу понять. Любая помощь будет оценена по достоинству.
Примечание: self.pixelView
— это экземпляр NSImageView
, который никоим образом не был переопределен.