automated snapshot
This commit is contained in:
13
storage.go
13
storage.go
@@ -85,18 +85,29 @@ func initSchema(db *sql.DB) error {
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
func (s *Storage) Save() (string, error) {
|
||||
func (s *Storage) Save(capture *SketchCapture) (string, error) {
|
||||
id, _ := s.gen.Next()
|
||||
kid := ids.Base62Encode(id)
|
||||
path := filepath.Join(s.snapshotsDir, kid)
|
||||
os.MkdirAll(path, 0755)
|
||||
|
||||
// wysiwyg at screen res
|
||||
img := rl.LoadImageFromScreen()
|
||||
defer rl.UnloadImage(img)
|
||||
|
||||
snapshotPng := filepath.Join(path, fmt.Sprintf("%s.png", kid))
|
||||
rl.ExportImage(*img, snapshotPng)
|
||||
|
||||
// capture full res compsite
|
||||
compositePng := filepath.Join(path, fmt.Sprintf("%s-composite.png", kid))
|
||||
rl.ExportImage(*capture.compositeImage, compositePng)
|
||||
|
||||
// capture full res layer
|
||||
for i, layerImage := range capture.layerImages {
|
||||
layerPng := filepath.Join(path, fmt.Sprintf("%s-%3d.png", kid, i))
|
||||
rl.ExportImage(*layerImage, layerPng)
|
||||
}
|
||||
|
||||
s.log.Printf("Checking git status...\n")
|
||||
|
||||
hash, branch, committed, err := CommitAllIfDirty(s.repoRoot, "automated snapshot", s.log)
|
||||
|
||||
Reference in New Issue
Block a user