giant_screenshot

package
v0.0.0-...-1f00af5 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLevelScreenshots

func CreateLevelScreenshots(lvl *level.Level, scroll render.Point) (large, medium, small, tiny image.Image, err error)

CreateLevelScreenshots generates a screenshot to save with the level data.

This is called by the editor upon level save, and outputs the screenshots that will be embedded within the level data itself.

Returns the large, medium and small images.

func CroppedScreenshot

func CroppedScreenshot(lvl *level.Level, viewport render.Rect) (image.Image, error)

CroppedScreenshot returns a rendered RGBA image of the level.

func GiantScreenshot

func GiantScreenshot(lvl *level.Level) (image.Image, error)

GiantScreenshot returns a rendered RGBA image of the entire level.

Only one thread should be doing this at a time. A sync.Mutex will cause an error to return if another goroutine is already in the process of generating a screenshot, and you'll have to wait and try later.

func SaveCroppedScreenshot

func SaveCroppedScreenshot(level *level.Level, viewport render.Rect) (string, error)

SaveCroppedScreenshot will take a screenshot and write it to a file on disk, returning the filename relative to ~/.config/doodle/screenshots

func SaveGiantScreenshot

func SaveGiantScreenshot(level *level.Level) (string, error)

SaveGiantScreenshot will take a screenshot and write it to a file on disk, returning the filename relative to ~/.config/doodle/screenshots

func Scale

func Scale(src image.Image, rect image.Rectangle, scale draw.Scaler) image.Image

Scale down an image. Example:

scaled := Scale(src, image.Rect(0, 0, 200, 200), draw.ApproxBiLinear)

func UpdateLevelScreenshots

func UpdateLevelScreenshots(lvl *level.Level, scroll render.Point) error

UpdateLevelScreenshots will generate and embed the screenshot PNGs into the level data.

func WallpaperToImage

func WallpaperToImage(lvl *level.Level, target *image.RGBA, width, height int, offset render.Point) *image.RGBA

WallpaperToImage accurately draws the wallpaper into an Image.

The image is assumed to have a rect of (0,0,width,height) and that width and height are positive. Used for the Giant Screenshot feature.

Pass an offset point to 'scroll' the wallpaper (for the Cropped Screenshot).

Types

This section is empty.

Jump to

Keyboard shortcuts

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