feed

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 4 Imported by: 0 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.

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

View Source
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 NewFeed

func NewFeed(cam camera.Camera, picture Picture) *Feed

NewFeed is the world picture draws seen through cam.

func (*Feed) Camera

func (f *Feed) Camera() camera.Camera

Camera is the camera the feed draws its picture through.

func (*Feed) Draw

func (f *Feed) Draw() *gfx.Image

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

func (f *Feed) DrawGlass(dst *gfx.Image)

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

func (f *Feed) DrawOn(dst *gfx.Image)

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) Picture

func (f *Feed) Picture() Picture

Picture is what the feed draws.

func (*Feed) Proportions

func (f *Feed) Proportions() (w, h float32, ok bool)

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

func (f *Feed) Resize(w, h int)

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.

func (*Feed) ToPixels

func (f *Feed) ToPixels(x, y, z float32) (px, py, depth float32, visible bool)

ToPixels is where in the feed the world point (x, y) at height z lies, as the camera's copy draws it, and its depth; visible is false for a point outside the feed or behind the eye.

func (*Feed) ToWorld

func (f *Feed) ToWorld(px, py float32) (x, y float32, ok bool)

ToWorld is the point of the world under the feed's pixel (px, py), false where the camera sees no ground there.

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.

type Picture

type Picture interface {
	DrawWorld(screen *gfx.Image, cam camera.Camera)
}

Picture is what is in the world before a camera, drawn through the camera it is handed.

Jump to

Keyboard shortcuts

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