dcap

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2024 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

dcap

Cross platform desktop capture library for golang

Installation

go get github.com/diiyw/dcap

Usage

package main

import (
    "fmt"
    "github.com/diiyw/dcap"
)

func main() {
    d, err := NewDCap()
	if err != nil {
		fmt.Println(err)
        return
	}
    defer d.Close()
    if err = d.CaptureDisplay(0); err != nil {
		fmt.Println(err)
        return
	}
    fi, err := os.Create("test.png")
    if err != nil {
        fmt.Println(err)
        return
    }
    png.Encode(fi, d.Image())
    fi.Close()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DCap

type DCap struct {
	Displays []image.Rectangle
	// contains filtered or unexported fields
}

func NewDCap

func NewDCap() (*DCap, error)

func (*DCap) Capture

func (d *DCap) Capture(x, y, width, height int) error

func (*DCap) CaptureDisplay

func (d *DCap) CaptureDisplay(displayIndex int) error

func (*DCap) ClipboardGet

func (d *DCap) ClipboardGet() (string, error)

ClipboardGet get text from clipboard

func (*DCap) ClipboardSet

func (d *DCap) ClipboardSet(text string) error

ClipboardSet set text to clipboard

func (*DCap) Close added in v0.2.0

func (d *DCap) Close()

Close close connection

func (*DCap) Image added in v0.1.1

func (d *DCap) Image() *image.RGBA

Image return image.RGBA with copy

func (*DCap) ImageNoCopy added in v0.1.1

func (d *DCap) ImageNoCopy() *image.RGBA

ImageNoCopy return image.RGBA without copy

func (*DCap) MouseMove

func (d *DCap) MouseMove(x, y int) error

MouseMove move mouse to x,y

func (*DCap) NewImage

func (d *DCap) NewImage(x, y, width, height int)

NewImage create new image

func (*DCap) Scroll

func (d *DCap) Scroll(x, y int)

func (*DCap) ToggleKey

func (d *DCap) ToggleKey(key string, down bool) error

ToggleKey toggle keyboard event

func (*DCap) ToggleMouse

func (d *DCap) ToggleMouse(button MouseButton, down bool) error

ToggleMouse toggle mouse button event, https://www.x.org/releases/X11R7.7/doc/xextproto/xtest.html

type MouseButton

type MouseButton byte

MouseButton button of mouse

const (
	// MouseLeft left button for mouse
	MouseLeft MouseButton = iota
	// MouseMiddle middle button for mouse
	MouseMiddle
	// MouseRight right button for mouse
	MouseRight
)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址