1
1
package imageflow
2
2
3
3
// Decode is used to create a decode node in graph
4
- type Decode struct {
4
+ type decode struct {
5
5
IoID int `json:"io_id"`
6
6
}
7
7
8
8
// toStep is used to convert a Decode to step
9
- func (decode Decode ) toStep () map [string ]interface {} {
9
+ func (decode decode ) toStep () map [string ]interface {} {
10
10
decodeMap := make (map [string ]interface {})
11
11
decodeMap ["decode" ] = decode
12
12
return decodeMap
13
13
}
14
14
15
15
// Preset is a interface for encoder used to convert to image
16
- type Preset interface {
16
+ type presetInterface interface {
17
17
toPreset () interface {}
18
18
}
19
19
20
20
// Encode is used to convert to a image
21
- type Encode struct {
21
+ type encode struct {
22
22
IoID int `json:"io_id"`
23
23
Preset interface {} `json:"preset"`
24
24
}
25
25
26
26
// toStep is used to convert a Encode to step
27
- func (encode Encode ) toStep () interface {} {
27
+ func (encode encode ) toStep () interface {} {
28
28
encodeMap := make (map [string ]interface {})
29
29
encodeMap ["encode" ] = encode
30
30
return encodeMap
@@ -38,7 +38,7 @@ type MozJPEG struct {
38
38
39
39
// toPreset is used to convert the MozJPG to a preset
40
40
func (preset MozJPEG ) toPreset () interface {} {
41
- presetMap := make (map [string ]Preset )
41
+ presetMap := make (map [string ]presetInterface )
42
42
if preset .Quality == 0 {
43
43
preset .Quality = 100
44
44
}
@@ -61,7 +61,7 @@ type LosslessPNG struct {
61
61
62
62
// toPreset is used to LosslessPNG to Preset
63
63
func (preset LosslessPNG ) toPreset () interface {} {
64
- presetMap := make (map [string ]Preset )
64
+ presetMap := make (map [string ]presetInterface )
65
65
presetMap ["lodepng" ] = preset
66
66
return presetMap
67
67
}
@@ -76,7 +76,7 @@ type LossyPNG struct {
76
76
77
77
// toPreset is used to convert LossPNG to preset
78
78
func (preset LossyPNG ) toPreset () interface {} {
79
- presetMap := make (map [string ]Preset )
79
+ presetMap := make (map [string ]presetInterface )
80
80
presetMap ["pngquant" ] = preset
81
81
return presetMap
82
82
}
@@ -91,7 +91,7 @@ func (preset WebP) toPreset() interface{} {
91
91
if preset .Quality == 0 {
92
92
preset .Quality = 100
93
93
}
94
- presetMap := make (map [string ]Preset )
94
+ presetMap := make (map [string ]presetInterface )
95
95
presetMap ["webplossy" ] = preset
96
96
return presetMap
97
97
}
@@ -205,7 +205,7 @@ func (step Constrain) toStep() interface{} {
205
205
if step .CanvasColor != nil {
206
206
step .CanvasColor = step .CanvasColor .(Color ).toColor ()
207
207
}
208
- stepMap := make (map [string ]Step )
208
+ stepMap := make (map [string ]stepInterface )
209
209
stepMap ["constrain" ] = step
210
210
return stepMap
211
211
}
@@ -223,7 +223,7 @@ type Region struct {
223
223
// toStep create a step from Region
224
224
func (region Region ) toStep () interface {} {
225
225
region .BackgroundColor = region .BackgroundColor .(Color ).toColor ()
226
- stepMap := make (map [string ]Step )
226
+ stepMap := make (map [string ]stepInterface )
227
227
stepMap ["region" ] = region
228
228
return stepMap
229
229
}
@@ -241,7 +241,7 @@ type RegionPercentage struct {
241
241
// toStep create a step from Region
242
242
func (region RegionPercentage ) toStep () interface {} {
243
243
region .BackgroundColor = region .BackgroundColor .(Color ).toColor ()
244
- stepMap := make (map [string ]Step )
244
+ stepMap := make (map [string ]stepInterface )
245
245
stepMap ["region_percent" ] = region
246
246
return stepMap
247
247
}
@@ -256,7 +256,7 @@ type cropWhitespace struct {
256
256
257
257
// toStep create a step from Region
258
258
func (region cropWhitespace ) toStep () interface {} {
259
- stepMap := make (map [string ]Step )
259
+ stepMap := make (map [string ]stepInterface )
260
260
stepMap ["crop_whitespace" ] = region
261
261
return stepMap
262
262
}
@@ -312,7 +312,7 @@ type fillRect struct {
312
312
313
313
// toStep create a step from fillRect
314
314
func (region fillRect ) toStep () interface {} {
315
- stepMap := make (map [string ]Step )
315
+ stepMap := make (map [string ]stepInterface )
316
316
region .Color = region .Color .(Color ).toColor ()
317
317
stepMap ["fill_rect" ] = region
318
318
return stepMap
@@ -329,7 +329,7 @@ type ExpandCanvas struct {
329
329
330
330
// toStep create a step from fillRect
331
331
func (region ExpandCanvas ) toStep () interface {} {
332
- stepMap := make (map [string ]Step )
332
+ stepMap := make (map [string ]stepInterface )
333
333
region .Color = region .Color .(Color ).toColor ()
334
334
stepMap ["expand_canvas" ] = region
335
335
return stepMap
@@ -390,7 +390,7 @@ func (watermark watermark) toStep() interface{} {
390
390
if watermark .FitBox != nil {
391
391
watermark .FitBox = watermark .FitBox .(FitBox ).toFitBox ()
392
392
}
393
- stepMap := make (map [string ]Step )
393
+ stepMap := make (map [string ]stepInterface )
394
394
if watermark .Gravity != nil {
395
395
watermark .Gravity = watermark .Gravity .(ConstraintGravity ).toGravity ()
396
396
}
0 commit comments