"""
Synfig file format utilities
Copyright (C) 2011 Nikita Kitaev
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
###### Constants ##########################################
###### Layer parameters, types, and default values ########
layers = {}
# Layer_Composite is the parent of most layers
"z_depth": ["real", 0.0],
"amount": ["real", 1.0],
"blend_method": ["integer", 0],
}
"origin": ["vector", [0.0, 0.0]],
"canvas": ["canvas", None],
"zoom": ["real", 0.0],
"time_offset": ["time", "0s"],
"focus": ["vector", [0.0, 0.0]]
})
## Layers in mod_geometry
"color": ["color", [0,0,0,1]],
"radius": ["real", 1.0],
"feather": ["real", 0.0],
"origin": ["vector", [0.0, 0.0]],
"falloff": ["integer", 2]
})
"color": ["color", [0,0,0,1]],
"point1": ["vector", [0,0]],
"point2": ["vector", [1,1]],
"expand": ["real", 0.0],
})
"color": ["color", [0,0,0,1]],
"origin": ["vector", [0.0, 0.0]],
"feather": ["real", 0.0],
"blurtype": ["integer", 1],
"winding_style": ["integer", 0]
})
"bline": ["bline", None]
})
"bline": ["bline", None],
"width": ["real", 1.0],
"loopyness": ["real", 1.0],
"expand": ["real", 0.0],
})
## Layers in mod_gradient
"p1": ["vector", [0,0]],
"p2": ["vector", [1,1]],
"gradient": ["gradient", {0.0:[0,0,0,1], 1.0:[1,1,1,1]} ],
})
"gradient": ["gradient", {0.0:[0,0,0,1], 1.0:[1,1,1,1]} ],
"center": ["vector", [0,0]],
"radius": ["real", 1.0],
})
## Layers in lyr_std
"tl": ["vector", [-1,1]],
"br": ["vector", [1,-1]],
"c": ["integer", 1],
"gamma_adjust": ["real", 1.0],
"filename": ["string", ""], # <string>foo</string>
"time_offset": ["time", "0s"]
})
# transforms are not blending
layers["warp"] = {
"src_tl": ["vector", [-1,1]],
"src_br": ["vector", [1,-1]],
"dest_tl": ["vector", [-1,1]],
"dest_tr": ["vector", [1,1]],
"dest_br": ["vector", [1,-1]],
"dest_bl": ["vector", [-1,-1]],
"horizon": ["real", 4.0]
}
layers["rotate"] = {
"origin": ["vector", [0.0, 0.0]],
"amount": ["angle", 0] # <angle value=.../>
}
layers["translate"] = {
"origin": ["vector", [0.0, 0.0]]
}
## Layers in mod_filter
"size": ["vector", [1,1]],
"type": ["integer", 3] # 1 is fast gaussian, 3 is regular
})
###### Layer versions #####################################
layer_versions = {
"outline" : "0.2",
"rectangle" : "0.2",
"linear_gradient" : "0.0",
"blur" : "0.2",
None : "0.1" # default
}
###### Blend Methods ######################################
0 : "composite",
1 : "straight",
13 : "onto",
21 : "straight onto",
12 : "behind",
16 : "screen",
20 : "overlay",
17 : "hand light",
6 : "multiply",
7 : "divide",
4 : "add",
5 : "subtract",
18 : "difference",
2 : "brighten",
3 : "darken",
8 : "color",
9 : "hue",
10 : "saturation",
11 : "luminance",
14 : "alpha brighten", #deprecated
15 : "alpha darken", #deprecated
19 : "alpha over" #deprecated
}
###### Functions ##########################################
else:
raise Exception, "Invalid parameter type for layer"
else:
# Unknown layer, try to determine parameter type based on value
if value is None:
raise Exception, "No information for given layer"
return "integer"
return "real"
return "bool"
return "bline"
return "gradient"
else:
raise Exception, "Could not automatically determine parameter type"
return "vector"
return "color"
else:
# The first two could also be canvases
return "canvas"
return "string"
return layer_versions[layer]
else:
return layer_versions[None]
else:
return {}