Windows Capture Simple Screen Capture for Windows πŸ”₯

Overview

Windows Capture   Crates.io GitHub Workflow Status (with event) Crates.io

Windows Capture is a highly efficient Rust library that enables you to effortlessly capture the screen using the Graphics Capture API. This library allows you to easily capture the screen of your Windows-based computer and use it for various purposes, such as creating instructional videos, taking screenshots, or recording your gameplay. With its intuitive interface and robust functionality, Windows-Capture is an excellent choice for anyone looking for a reliable and easy-to-use screen capturing solution.

Features

  • Only Updates The Frame When Required.
  • High Performance.
  • Easy To Use.
  • Latest Screen Capturing API.

Installation

Add this library to your Cargo.toml:

[dependencies]
windows-capture = "1.0.17"

or run this command

cargo add windows-capture

Usage

use std::time::Instant;

use windows_capture::{
    capture::{WindowsCaptureHandler, WindowsCaptureSettings},
    frame::Frame,
    window::Window,
};

struct Capture {
    fps: usize,
    last_output: Instant,
}

impl WindowsCaptureHandler for Capture {
    type Flags = ();

    fn new(_: Self::Flags) -> Self {
        Self {
            fps: 0,
            last_output: Instant::now(),
        }
    }

    fn on_frame_arrived(&mut self, _frame: &Frame) {
        self.fps += 1;

        if self.last_output.elapsed().as_secs() >= 1 {
            println!("{}", self.fps);
            self.fps = 0;
            self.last_output = Instant::now();
        }
    }

    fn on_closed(&mut self) {
        println!("Closed");
    }
}

fn main() {
    let settings = WindowsCaptureSettings {
        item: Window::get_foreground().into(),
        capture_cursor: false,
        draw_border: true,
        flags: (),
    };

    Capture::start(settings).unwrap();
}

Documentation

Detailed documentation for each API and type can be found here.

Contributing

Contributions are welcome! If you find a bug or want to add new features to the library, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

You might also like...
A grub theme in the style of the Minecraft singleplayer (sp) world selection screen!

Minecraft World Selection Grub Theme Wowie, another Minecraft grub theme! But this time it's in the style of the singleplayer world selection menu, wh

A screen saver for the terminal πŸŒƒ
A screen saver for the terminal πŸŒƒ

tnap - Let's take a nap πŸ’€ tnap is a screen saver for the terminal. You can rest the terminal in a secure. Features Display images in the terminal and

Windows-rs - Rust for Windows

Rust for Windows The windows crate lets you call any Windows API past, present, and future using code generated on the fly directly from the metadata

Switch windows of same app with alt + ` on windows pc.

Windows Switcher Switch windows of same app with alt + ` on windows pc. 250k single file executable downloaded from Github Release. No installation re

Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)

is-wsl Check if the process is running inside Windows Subsystem for Linux (Bash on Windows) Inspired by sindresorhus/is-wsl and made for Rust lang. Ca

Use Thunk to build your Rust program that runs on old Windows platforms, support Windows XP and more!

Use Thunk to build your Rust program that runs on old platforms. Thunk uses VC-LTL5 and YY-Thunks to build programs that support old platforms. So, ho

A simple TTS tool for Windows that reads directly from the clipboard.
A simple TTS tool for Windows that reads directly from the clipboard.

Quick Text-To-Speech A simple TTS tool for Windows that reads directly from the clipboard or from textfiles that are dragged into the window. Screensh

Simple template to use csr and ssr leptos with tauri for ios/android/windows/macos/linux and web dev

Tailwind-Leptos-Tauri Template Simple template to use csr and ssr leptos with tauri for ios/android/windows/macos/linux and web dev Just clone the rep

a simple program that you can scrap, is shit and really simple but is cool.

if you want to run it you need to have installed curl by default scrap youtube, but you can change it, also change the number of threads and run: carg

Owner
null
A small utility that moves the start menu to the top-center of the screen in Windows 11.

TopCenterStart11 A small utility that moves the start menu to the top-center of the screen in Windows 11. As of right now, this application can only p

Ryan de Jonge 12 Nov 12, 2022
A super simple but lightweight logging library that tries to capture the most important (status) information.

Hackerlog A super simple but lightweight logging library that tries to capture the most important (status) information. The following is supported: Lo

434b 3 Aug 22, 2023
Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)

WSLGit This project provides a small executable that forwards all arguments to git running inside Bash on Windows/Windows Subsystem for Linux (WSL). T

A. R. S. 1.1k Jan 3, 2023
Cross-platform terminal screen clearing library

ClearScreen Cross-platform terminal screen clearing library. API documentation. Dual-licensed with Apache 2.0 and MIT. Uses Caretaker Maintainership.

null 23 Dec 30, 2022
Standard Graphics is a command-line tool for printing 2D graphics from any language to any screen.

2D graphics in any programming language with just print statements!

Caleb Winston 123 Nov 20, 2022
a FREE and MODERN split-screen tetris game WITHOUT ADS

tetr:: A ✨ modern ✨ Tetris game made in OpenGL and Rust Gameplay tetr:: is an implementaion of modern Tetris, and essentially a clone of tetr.io. This

Adam Harmansky 3 Sep 10, 2022
Adapt the screen's color spectrum according to the hour of the day in order to improve your sleep

circadianlight What It Is Circadian Light is a program, currently only working on Linux with X, that controls the color spectrum of your screen accord

null 7 Dec 28, 2022
High performance wlroots screen recording, featuring hardware encoding

wl-screenrec High performance wlroots based screen recorder. Uses dma-buf transfers to get surface, and uses the GPU to do both the pixel format conve

Russell Greene 32 Jan 21, 2023
on-screen keyboard display for your coding streams.

⌨ OSKD (On-screen key display) OSKD is an on-screen keyboard display that can be used during streams. It provides an intuitive and easy-to-use interfa

Sammwy 46 May 6, 2023
πŸ‘€Little program I made in πŸ¦€Rust that reminds me every 20 minutes to look away from my computer πŸ–₯screen.

?? eye break Little program I made in ?? Rust that reminds me every 20 minutes to look away from my computer ?? screen. I stay way too long on the com

Goldy 3 Apr 9, 2023