Documentation ¶
Overview ¶
Package screenshot captures screen-shot image as image.RGBA. Mac, Windows, Linux, FreeBSD, OpenBSD, NetBSD, and Solaris are supported.
Index ¶
- func Capture(x, y, width, height int) (*image.RGBA, error)
- func CaptureDisplay(displayIndex int) (*image.RGBA, error)
- func CaptureRect(rect image.Rectangle) (*image.RGBA, error)
- func DrawIcon(hDC win.HDC, x, y int, hIcon win.HANDLE) bool
- func GetCursorInfo(pCursorInfo *CURSORINFO) bool
- func GetDisplayBounds(displayIndex int) image.Rectangle
- func NumActiveDisplays() int
- func ScreenToClient(hwnd win.HWND, x, y int) (X, Y int, ok bool)
- type CURSORINFO
- type CaptureProvider
- type DWORD
- type DXGIScreenshot
- func (s *DXGIScreenshot) Capture() (*image.RGBA, error)
- func (s *DXGIScreenshot) CaptureBGRA() (*image.RGBA, error)
- func (s *DXGIScreenshot) DrawCursor(cursor int32)
- func (s *DXGIScreenshot) GetCaptureName() string
- func (s *DXGIScreenshot) GetDisplayId() int
- func (s *DXGIScreenshot) Init(display int) error
- func (s *DXGIScreenshot) Release()
- type HCURSOR
- type POINT
- type ScreenShot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Capture ¶
Capture returns screen capture of specified desktop region. x and y represent distance from the upper-left corner of main display. Y-axis is downward direction. This means coordinates system is similar to Windows OS.
func CaptureDisplay ¶
CaptureDisplay captures whole region of displayIndex'th display.
func CaptureRect ¶
CaptureRect captures specified region of desktop.
func GetCursorInfo ¶
func GetCursorInfo(pCursorInfo *CURSORINFO) bool
func GetDisplayBounds ¶
GetDisplayBounds returns the bounds of displayIndex'th display. The main display is displayIndex = 0.
func NumActiveDisplays ¶
func NumActiveDisplays() int
NumActiveDisplays returns the number of active displays.
Types ¶
type CaptureProvider ¶
type CaptureProvider int32
const ( ProviderAuto CaptureProvider = 0 ProviderGDI CaptureProvider = 1 ProviderDXGI CaptureProvider = 2 )
type DXGIScreenshot ¶
type DXGIScreenshot struct {
// contains filtered or unexported fields
}
func NewDXGIScreenshot ¶
func NewDXGIScreenshot() *DXGIScreenshot
func (*DXGIScreenshot) CaptureBGRA ¶
func (s *DXGIScreenshot) CaptureBGRA() (*image.RGBA, error)
func (*DXGIScreenshot) DrawCursor ¶
func (s *DXGIScreenshot) DrawCursor(cursor int32)
func (*DXGIScreenshot) GetCaptureName ¶
func (s *DXGIScreenshot) GetCaptureName() string
func (*DXGIScreenshot) GetDisplayId ¶
func (s *DXGIScreenshot) GetDisplayId() int
func (*DXGIScreenshot) Init ¶
func (s *DXGIScreenshot) Init(display int) error
func (*DXGIScreenshot) Release ¶
func (s *DXGIScreenshot) Release()
type POINT ¶
type POINT struct {
X, Y int32
}
http://msdn.microsoft.com/en-us/library/windows/desktop/dd162805.aspx
type ScreenShot ¶
type ScreenShot interface { // Init 初始化一个截屏实例,display是第几个屏幕,默认屏幕是0 Init(display int) error // GetDisplayId 获取当前实例所截图的屏幕编号 GetDisplayId() int // GetCaptureName 当前截图方法,GDI、DXGI GetCaptureName() string // Capture 截一张屏幕全图并用swizzle尝试使用simd方式转化为RGBA Capture() (*image.RGBA, error) // CaptureBGRA 截一张屏幕全图,不转换直接输出BGRA颜色格式 CaptureBGRA() (*image.RGBA, error) // Release 释放资源,注意实例使用完毕一定要主动释放资源否则将内存溢出 Release() // DrawCursor 是否绘制鼠标指针,0不绘制,1绘制,可动态设置 DrawCursor(cursor int32) }
func NewScreenShot ¶
func NewScreenShot(Provider CaptureProvider) ScreenShot