mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-09 15:39:08 +00:00
Edges up towards reimplementing screenshots.
This commit is contained in:
parent
1a2545fdea
commit
ceeadd6a33
@ -364,27 +364,7 @@ struct ActivityObserver: public Activity::Observer {
|
||||
}
|
||||
|
||||
- (NSBitmapImageRep *)imageRepresentation {
|
||||
// Grab a screenshot.
|
||||
/* Outputs::Display::OpenGL::Screenshot screenshot(4, 3);
|
||||
|
||||
// Generate an NSBitmapImageRep containing the screenshot's data.
|
||||
NSBitmapImageRep *const result =
|
||||
[[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:screenshot.width
|
||||
pixelsHigh:screenshot.height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:4 * screenshot.width
|
||||
bitsPerPixel:0];
|
||||
|
||||
memcpy(result.bitmapData, screenshot.pixel_data.data(), size_t(screenshot.width*screenshot.height*4));
|
||||
|
||||
return result;*/
|
||||
return nil;
|
||||
return self.view.imageRepresentation;
|
||||
}
|
||||
|
||||
- (void)applyMedia:(const Analyser::Static::Media &)media {
|
||||
|
@ -20,4 +20,6 @@
|
||||
// ready for output when next requested.
|
||||
- (void)updateFrameBuffer;
|
||||
|
||||
- (nonnull NSBitmapImageRep *)imageRepresentation;
|
||||
|
||||
@end
|
||||
|
@ -1120,4 +1120,29 @@ using BufferingScanTarget = Outputs::Display::BufferingScanTarget;
|
||||
return &_scanTarget;
|
||||
}
|
||||
|
||||
- (NSBitmapImageRep *)imageRepresentation {
|
||||
// TODO: create a temporary texture, copy, and do as below but not re: _frameBuffer.
|
||||
|
||||
NSBitmapImageRep *const result =
|
||||
[[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:(NSInteger)_frameBuffer.width
|
||||
pixelsHigh:(NSInteger)_frameBuffer.height
|
||||
bitsPerSample:8
|
||||
samplesPerPixel:4
|
||||
hasAlpha:YES
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:4 * (NSInteger)_frameBuffer.width
|
||||
bitsPerPixel:0];
|
||||
|
||||
// [_frameBuffer
|
||||
// getBytes:result.bitmapData
|
||||
// bytesPerRow:_frameBuffer.width*4
|
||||
// fromRegion:MTLRegionMake2D(0, 0, _frameBuffer.width, _frameBuffer.height)
|
||||
// mipmapLevel:0];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -152,6 +152,11 @@
|
||||
*/
|
||||
- (void)releaseMouse;
|
||||
|
||||
/*!
|
||||
@returns An image of the view's current contents.
|
||||
*/
|
||||
- (nonnull NSBitmapImageRep *)imageRepresentation;
|
||||
|
||||
/*!
|
||||
@returns The CSScanTarget being used for this display.
|
||||
*/
|
||||
|
@ -194,6 +194,10 @@ static CVReturn DisplayLinkCallback(__unused CVDisplayLinkRef displayLink, const
|
||||
[self.responderDelegate paste:sender];
|
||||
}
|
||||
|
||||
- (NSBitmapImageRep *)imageRepresentation {
|
||||
return self.scanTarget.imageRepresentation;
|
||||
}
|
||||
|
||||
#pragma mark - NSDraggingDestination
|
||||
|
||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
|
||||
|
Loading…
x
Reference in New Issue
Block a user