Documentation ¶
Index ¶
- func CreateLevelScreenshots(lvl *level.Level, scroll render.Point) (large, medium, small, tiny image.Image, err error)
- func CroppedScreenshot(lvl *level.Level, viewport render.Rect) (image.Image, error)
- func GiantScreenshot(lvl *level.Level) (image.Image, error)
- func SaveCroppedScreenshot(level *level.Level, viewport render.Rect) (string, error)
- func SaveGiantScreenshot(level *level.Level) (string, error)
- func Scale(src image.Image, rect image.Rectangle, scale draw.Scaler) image.Image
- func UpdateLevelScreenshots(lvl *level.Level, scroll render.Point) error
- func WallpaperToImage(lvl *level.Level, target *image.RGBA, width, height int, offset render.Point) *image.RGBA
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 ¶
CroppedScreenshot returns a rendered RGBA image of the level.
func GiantScreenshot ¶
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 ¶
SaveCroppedScreenshot will take a screenshot and write it to a file on disk, returning the filename relative to ~/.config/doodle/screenshots
func SaveGiantScreenshot ¶
SaveGiantScreenshot will take a screenshot and write it to a file on disk, returning the filename relative to ~/.config/doodle/screenshots
func Scale ¶
Scale down an image. Example:
scaled := Scale(src, image.Rect(0, 0, 200, 200), draw.ApproxBiLinear)
func UpdateLevelScreenshots ¶
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.