You need to log in to create posts and topics.
Re: Screen captures
77,940 Posts
#1 · February 23, 2022, 1:03 pm
Quote from Forum Archives on February 23, 2022, 1:03 pmPosted by: fblistserve <fblistserve@...>
Rich wrote:
I am looking for a way to capture a section of a window into the clipboard as a graphic.I previously did this in the old 32-bit version of FB with this command:Call DrawPicture(ClipBoardPictureHandle,GWorldRect)How can I do the same thing with 64-bit Cocoa FB.
Have you thought about a plan to accomplish it Rich? More complex goals are easier if broken down into their basic steps before tackling the programming bits.For example, one of the steps would take a graphic image and put it on the clipboard. All clipboard action is done via the NSPasteboard class.The following Objective-C code would accomplish this step ( but you would need to look up/translate into the FB CocoaUI equivalent ).NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; NSArray *copiedObjects = [NSArray arrayWithObject:image]; BOOL copied = [pasteboard writeObjects:copiedObjects]; etc....
The other step would be to capture a portion of a window as a graphic image. That means we need to specify a rectangle to capture within in window.
One way to do this would be with CG's
CGImageRef CGWindowListCreateImageFromArrayIt takes an array ( of windows ) and a rectangle and returns a CGImageRef.
No time to write the code but with the above you should be able to write it yourself or at least get a prototype going.
--
To unsubscribe, send ANY message to: [email protected] To access the list archives, go to: http://freegroups.net/groups/futurebasic/
Posted by: fblistserve <fblistserve@...>
Rich wrote:
I am looking for a way to capture a section of a window into the clipboard as a graphic.I previously did this in the old 32-bit version of FB with this command:Call DrawPicture(ClipBoardPictureHandle,GWorldRect)How can I do the same thing with 64-bit Cocoa FB.
Have you thought about a plan to accomplish it Rich? More complex goals are easier if broken down into their basic steps before tackling the programming bits.
For example, one of the steps would take a graphic image and put it on the clipboard. All clipboard action is done via the NSPasteboard class.
The following Objective-C code would accomplish this step ( but you would need to look up/translate into the FB CocoaUI equivalent ).
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard clearContents]; NSArray *copiedObjects = [NSArray arrayWithObject:image]; BOOL copied = [pasteboard writeObjects:copiedObjects]; etc....
The other step would be to capture a portion of a window as a graphic image. That means we need to specify a rectangle to capture within in window.
One way to do this would be with CG's
CGImageRef CGWindowListCreateImageFromArray
It takes an array ( of windows ) and a rectangle and returns a CGImageRef.
No time to write the code but with the above you should be able to write it yourself or at least get a prototype going.
--
To unsubscribe, send ANY message to: [email protected] To access the list archives, go to: http://freegroups.net/groups/futurebasic/
Click for thumbs down.0Click for thumbs up.0