项目作者: quadrupleslap

项目描述 :
📸 Screen capture made easy!
高级语言: Rust
项目地址: git://github.com/quadrupleslap/scrap.git
创建时间: 2017-06-10T16:21:13Z
项目社区:https://github.com/quadrupleslap/scrap

开源协议:

下载


scrap

Scrap records your screen! At least it does if you’re on Windows, macOS, or Linux.

Usage

  1. [dependencies]
  2. scrap = "0.5"

Its API is as simple as it gets!

  1. struct Display; /// A screen.
  2. struct Frame; /// An array of the pixels that were on-screen.
  3. struct Capturer; /// A recording instance.
  4. impl Capturer {
  5. /// Begin recording.
  6. pub fn new(display: Display) -> io::Result<Capturer>;
  7. /// Try to get a frame.
  8. /// Returns WouldBlock if it's not ready yet.
  9. pub fn frame<'a>(&'a mut self) -> io::Result<Frame<'a>>;
  10. pub fn width(&self) -> usize;
  11. pub fn height(&self) -> usize;
  12. }
  13. impl Display {
  14. /// The primary screen.
  15. pub fn primary() -> io::Result<Display>;
  16. /// All the screens.
  17. pub fn all() -> io::Result<Vec<Display>>;
  18. pub fn width(&self) -> usize;
  19. pub fn height(&self) -> usize;
  20. }
  21. impl<'a> ops::Deref for Frame<'a> {
  22. /// A frame is just an array of bytes.
  23. type Target = [u8];
  24. }

The Frame Format

  • The frame format is guaranteed to be packed BGRA.
  • The width and height are guaranteed to remain constant.
  • The stride might be greater than the width, and it may also vary between frames.

System Requirements

OS Minimum Requirements
macOS macOS 10.8
Linux XCB + SHM + RandR
Windows DirectX 11.1