Skip to content

A Windows Desktop Duplication library for Kotlin Native Mingw64

License

Notifications You must be signed in to change notification settings

Syrou/DesktopDuplikation

Repository files navigation

Desktop Duplikation

A library to make usage of Windows Desktop Duplication API easy on Kotlin Native for target mingw64.

Kotlin

Dependencies

In order to build this project you need to install directx 11 headers to your msys2 installation. Either create a system environment variable called MINGW64_DIR and point to your msys2 installation, or install it under C:/msys64/mingw64

$ pacman -S mingw-w64-x86_64-headers-git

If you wish to use this code as a pre-compiled library, put this into your gradle mingw64 dependencies:

implementation("io.github.syrou:desktopduplikation:0.0.3")

Usage

In order to automatically clear arena allocation, use the .use {} lambda

val desktopDuplikationManager = DesktopDuplikationManager()
desktopDuplikationManager.use {
    if(!desktopDuplikationManager.initialize()) return
    desktopDuplikationManager.captureNext { sr, desc ->
        desktopDuplikationManager.dumpBitmap(
            "c:\\test.bmp",
            sr.pData as CArrayPointer<ByteVar>,
            sr.RowPitch.toInt(),
            desc.Width.toInt(),
            desc.Height.toInt()
        )
    }
}

Releases

No releases published

Packages

No packages published

Languages