objective c - Ported OSX Obj-C/CG Screenshot Code to js-ctypes - crash on final line -
i ported objective-c/coregraphics code takes screenshot of multiple monitors it's not working. jsctypes guys won't able because section me answering questions lol
the objc/cg code here: https://stackoverflow.com/a/28247749/1828637
my jsctypes type/struct/declares here: https://github.com/noitidart/nativeshot/blob/mac-troubleshooting/modules/ostypes_mac.jsm
the jsctypes port here: https://github.com/noitidart/nativeshot/blob/mac-troubleshooting/modules/workers/mainworker.js#l443-656
and last line line 643 causes crash:
var rez_writetofile = ostypes.api('objc_msgsend')(data, ostypes.helper.sel('writetofile:atomically:'), mynsstrings.get(os.path.join(os.constants.path.desktopdir, 'full_ss.png')), ostypes.const.yes); this coincides objectivec of
[data writetofile:@"/tmp/screenshot.png" atomically:yes]; except changed path ...desktop/...png
i wrote sepearte gists, align lines in text diff software make sure did everything.
- here objc/cg: https://gist.github.com/noitidart/8affcd8bee60d22dcb52
- and here jsctypes: https://gist.github.com/noitidart/3d4a4e8df625dbea8cc1
i dont think missed dont know why crashes on final line
do of objc/cg people see type definition wrong or missed (for example objc code uses compound statments i'm not sure understood/translated them correctly in port).
wowww after struggling hours posting realize right away haha
casing typo in selector!! had writetofile:atomically instead of writetofile:atomically!
if test out, it's simple firefox addon test case.
- install addon allows installing addons github repos here: https://addons.mozilla.org/en-us/firefox/addon/github-extension-installer/
- go commit on branch works here: https://github.com/noitidart/nativeshot/tree/f5f2e8606d3c5c657e901239d3ceb8c8c79a4494
- then click "add firefox" button @ bottom right, below "download zip" button
- click on toolbar button icon gets added firefox, seen in screenshot: http://i.imgur.com/n7lsxje.png
- check desktop have single png file screenshot of monitors, huge props @kenthomas!
Comments
Post a Comment