Documentation
¶
Overview ¶
Package cameraview puts a live camera inside your screen, with your own buttons over it. For a photo with no design of your own, the camera plugin is simpler: it opens the system's camera and needs no permission.
nimbus native plugin add camera-view
if ok, _ := cameraview.Request(ctx); ok {
setShow(true)
}
cameraview.View{Style: ui.Style{Grow: 1}, OnReady: ready}
photo, err := cameraview.Take(ctx, cameraview.Options{MaxSize: 1600})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
MaxSize int `json:"maxSize"` // its longer side, in pixels; 0 keeps it full size
Quality float32 `json:"quality"` // JPEG, 0 to 1; 0 means 0.85
}
Options say how to take a photo.
type Photo ¶
type Photo struct {
Data []byte `json:"data"` // the JPEG
Width int `json:"width"` // in pixels
Height int `json:"height"` // in pixels
}
Photo is a JPEG, turned the right way up.
type View ¶
type View struct {
Front bool // the camera on the screen's side
Torch bool // the light; back camera only
OnReady func() // the picture has started
OnError func(code string) // plugin.Denied or plugin.Unavailable: no permission, or no camera
Style ui.Style // its size and place on the screen
}
View is the live picture. Show one at a time.
Click to show internal directories.
Click to hide internal directories.