Documentation
¶
Overview ¶
Package video draws streaming images (video, camera, remote screens) with Video, from a paint.Stream (in giokit's Gio fork).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State records where the last layout put the frame, for mapping pointer positions and overlays. The zero value maps nothing until the first layout with a frame. It holds no resources and may be copied.
func (*State) Content ¶
Content is where the frame was drawn, in the widget's pixel coordinates. It extends past the widget for FitCover and an oversized FitNone.
type Video ¶
type Video struct {
ID string // the image area's id
Stream *paint.Stream // the frames; nil draws nothing
Fit Fit // how a frame fills the area; FitContain is the zero value
Label string // what the video shows, for screen readers; default th.Strings.Video
}
Video draws a paint.Stream: video, a camera, a remote screen. It fills its constraints and draws the newest frame scaled by Fit; it handles no input. Wrap it to add some, and use the state's mapping to convert between window and frame coordinates.
video.Video{ID: "screen", Stream: s, Label: "Tablet screen"}.Layout(gtx, th, &v.screen)
Before the first frame it draws nothing. To redraw on new frames, set the stream's OnFrame to invalidate the window (kit.App.Invalidate).
Video only reads the stream; its producer owns it. When the source ends, the producer calls Stream.Close, which releases the retained frame and refuses later ones; Video then draws nothing. Close does not call OnFrame, so invalidate the window yourself if the video is on screen.