Documentation
¶
Overview ¶
Package feed is the world seen through a camera at a size: a Picture drawn whole, in layers from one composition (Laid) or with its figures sharp over its ground.
Index ¶
- Constants
- type Feed
- func (f *Feed) Camera() camera.Camera
- func (f *Feed) Draw() *gfx.Image
- func (f *Feed) DrawGlass(dst *gfx.Image)
- func (f *Feed) DrawOn(dst *gfx.Image)
- func (f *Feed) Picture() Picture
- func (f *Feed) Proportions() (w, h float32, ok bool)
- func (f *Feed) Resize(w, h int)
- func (f *Feed) ToPixels(x, y, z float32) (px, py, depth float32, visible bool)
- func (f *Feed) ToWorld(px, py float32) (x, y float32, ok bool)
- type Laid
- type Picture
Constants ¶
const LayerFeather = 20
LayerFeather is the shown pixels an inner layer's edge fades over.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Feed ¶
type Feed struct {
// contains filtered or unexported fields
}
Feed is the world seen through a camera: picture drawn through cam every frame, drawn at its camera's resolution and shown at its size, its pixels the shown ones; a camera drawn in layers (camera.Layered) is drawn once a layer, the frame cropped to each, the widest first and the inner ones laid over with feathered edges, a Laid picture composed once for them all; one whose figures are sharp (camera.Figured) has a Laid picture's ground drawn so, or whole at its resolution, and what lies over it at every shown pixel. A camera.Snapped camera is drawn from its copy, taken as the feed is laid out (Resize): cropped, not the camera itself. Several feeds may share one picture.
func (*Feed) Draw ¶
Draw draws the world through the camera's copy into the feed's image: at the camera's resolution, or at the shown size in layers or with the figures sharp.
func (*Feed) DrawGlass ¶
DrawGlass has the picture's Glass sources draw on the glass over the feed, dst, as it is shown, through the camera's copy (ui draws it after everything laid over the feed).
func (*Feed) DrawOn ¶
DrawOn draws the world through the camera's copy onto dst, shown at dst's size: straight onto it at the resolution of every pixel, else drawn at the camera's and scaled up; in layers, each over the last; with the figures sharp, the ground scaled up and what lies over it straight onto dst. A dst of another size than the feed was laid at resizes it first.
func (*Feed) Proportions ¶
Proportions are the width and height of the world the feed shows whole, when its camera keeps the whole world in view.
func (*Feed) Resize ¶
Resize gives the feed its size, the camera's viewport with it, and takes the camera's copy the frame drawn next is drawn through (camera.Snapped): as the frame is laid out, on its barrier.
type Laid ¶
type Laid interface {
Lay(cam camera.Camera, apart bool)
DrawLayer(layer *gfx.Image, cam camera.Camera, at, hole camera.Window)
DrawOver(screen *gfx.Image, cam camera.Camera)
}
Laid is a Picture drawn in layers from one composition: Lay composes every source (the ground's alone when apart) through cam once, in cam's pixels; DrawLayer draws what was composed into layer, cam cropped to the frame's window at, the pieces placed by the window's scale and offset, the Directs drawing through cam, the ground leaving out the frame's window hole a layer drawn after covers; DrawOver composes the Overlying sources and draws them onto screen over the layers laid since Lay, tested against their depths placed at screen's size, the last laid over the first. A nil layer or screen only composes.