Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose getScreenImage #30

Closed
wants to merge 1 commit into from
Closed

Conversation

brigand
Copy link

@brigand brigand commented Jun 6, 2015

I'm not sure if this is correct, but it seems to work. I'm very new to C/C++ stuff.

On a 300ms interval at 2560x1440 the memory usage goes from 20mb to 250mb and back down again.

It might be significantly faster if I can reuse buffers. Also, it's returning a SlowBuffer in 0.10, and the docs advise against using SlowBuffer for large data.

# 150ms interval, measure `robot.getScreenImage(0, 0, 2560, 1440);` with process.hrtime
Execution time (hr): 0s 97.8387ms
Execution time (hr): 0s 70.431239ms
Execution time (hr): 0s 70.394325ms
Execution time (hr): 0s 79.024596ms
Execution time (hr): 0s 96.242392ms
Execution time (hr): 0s 78.415336ms
Execution time (hr): 0s 73.583015ms
Execution time (hr): 0s 73.15636ms
Execution time (hr): 0s 77.463437ms
Execution time (hr): 0s 75.860151ms
Execution time (hr): 0s 129.808632ms
Execution time (hr): 0s 125.236072ms
Execution time (hr): 0s 127.089746ms
Execution time (hr): 0s 97.068304ms
Execution time (hr): 0s 87.929368ms
Execution time (hr): 0s 130.232699ms
Execution time (hr): 0s 135.494717ms
Execution time (hr): 0s 101.097455ms
Execution time (hr): 0s 85.203419ms
Execution time (hr): 0s 86.463413ms
Execution time (hr): 0s 116.454051ms
Execution time (hr): 0s 72.302956ms
Execution time (hr): 0s 64.864825ms
Execution time (hr): 0s 66.089723ms
Execution time (hr): 0s 77.848504ms
Execution time (hr): 0s 70.759078ms
Execution time (hr): 0s 75.107431ms
Execution time (hr): 0s 68.109502ms
Execution time (hr): 0s 70.178252ms
Execution time (hr): 0s 65.27376ms
Execution time (hr): 0s 100.983102ms
Average execution time (hr): 2s 88.58079225806452ms

@octalmage
Copy link
Owner

Looks good but I've been waiting to add screen related code until we got the Windows build working. These functions add a level of complexity on Windows and I feel that the Windows builds are a priority.

I've got similar code here:

https://github.com/octalmage/robotjs/tree/bitmap

#13 related.

@brigand
Copy link
Author

brigand commented Jun 12, 2015

Cool, I should have checked the branches :-)

@brigand brigand closed this Jun 12, 2015
@octalmage
Copy link
Owner

No worries! I actually came here to approve this pull request but someone JUST made progress on the windows build like an hour ago.

Really appreciate the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants