Merge branch 'release/v1.1' into develop

This commit is contained in:
Spencer Brower
2018-06-04 02:10:58 -04:00
6 changed files with 22 additions and 33 deletions

View File

@@ -1,8 +1,6 @@
package ps
import (
"fmt"
)
import "fmt"
// ModeEnum determines how aggressively the package will attempt to sync with Photoshop.
// Loading Photoshop files from scratch takes a long time, so the package saves

View File

@@ -1,22 +1,13 @@
package colors
package ps
import (
"encoding/hex"
// "fmt"
import "encoding/hex"
var (
ColorBlack Color = RGB{0, 0, 0}
ColorGray Color = RGB{128, 128, 128}
ColorWhite Color = RGB{255, 255, 255}
)
func Black() Color {
return &RGB{0, 0, 0}
}
func Gray() Color {
return &RGB{128, 128, 128}
}
func White() Color {
return &RGB{255, 255, 255}
}
// Color is an interface for color objects, allowing colors to be
// used in various formats.
//

1
go.mod Normal file
View File

@@ -0,0 +1 @@
module github.com/sbrow/ps

1
ps.go
View File

@@ -16,7 +16,6 @@ import (
"path/filepath"
"runtime"
"strings"
// "update"
)
// The name of the program that runs scripts on this OS.

1
sha Normal file
View File

@@ -0,0 +1 @@
cb37421ea4f7211be99ad4c5710f20155ccc8117

View File

@@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/sbrow/ps/colors"
"io/ioutil"
"log"
"os"
@@ -189,8 +188,8 @@ type ArtLayer struct {
parent Group // The LayerSet/Document this layer is in.
visible bool // Whether or not the layer is visible.
current bool // Whether we've checked this layer since we loaded from disk.
colors.Color // The layer's color overlay effect (if any).
*colors.Stroke // The layer's stroke effect (if any).
Color // The layer's color overlay effect (if any).
*Stroke // The layer's stroke effect (if any).
*TextItem // The layer's text, if it's a text layer.
}
@@ -233,8 +232,8 @@ func (a *ArtLayer) UnmarshalJSON(b []byte) error {
}
a.name = tmp.Name
a.bounds = tmp.Bounds
a.Color = colors.RGB{tmp.Color[0], tmp.Color[1], tmp.Color[2]}
a.Stroke = &colors.Stroke{tmp.StrokeAmt, colors.RGB{tmp.Stroke[0], tmp.Stroke[1], tmp.Stroke[2]}}
a.Color = RGB{tmp.Color[0], tmp.Color[1], tmp.Color[2]}
a.Stroke = &Stroke{tmp.StrokeAmt, RGB{tmp.Stroke[0], tmp.Stroke[1], tmp.Stroke[2]}}
a.visible = tmp.Visible
a.current = false
a.TextItem = tmp.TextItem
@@ -285,7 +284,7 @@ func (a *ArtLayer) SetActive() ([]byte, error) {
}
// SetColor creates a color overlay for the layer
func (a *ArtLayer) SetColor(c colors.Color) {
func (a *ArtLayer) SetColor(c Color) {
if a.Color.RGB() == c.RGB() {
if Mode == 2 || (Mode == 0 && a.current) {
// log.Println("Skipping color: already set.")
@@ -319,7 +318,7 @@ func (a *ArtLayer) SetColor(c colors.Color) {
}
}
func (a *ArtLayer) SetStroke(stk colors.Stroke, fill colors.Color) {
func (a *ArtLayer) SetStroke(stk Stroke, fill Color) {
if stk.Size == 0 {
a.Stroke = &stk
a.SetColor(fill)