Open Tunanzzz opened 4 months ago
I can get the type of shape from `def origination(self): """ Property for a list of live shapes or a line.
Some of the vector masks have associated live shape properties, that
are Photoshop feature to handle primitive shapes such as a rectangle,
an ellipse, or a line. Vector masks without live shape properties are
plain path objects.
See :py:mod:`psd_tools.api.shape`.
:return: List of :py:class:`~psd_tools.api.shape.Invalidated`,
:py:class:`~psd_tools.api.shape.Rectangle`,
:py:class:`~psd_tools.api.shape.RoundedRectangle`,
:py:class:`~psd_tools.api.shape.Ellipse`, or
:py:class:`~psd_tools.api.shape.Line`.
"""`
but if it's a just a Invalidated curve, the knots have its own type, how can i get it?
Check this document. psd-tools
follows this spec to parse information
https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
Check this document.
psd-tools
follows this spec to parse information https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/
Thanks for your answer, i get the path by `def _generate_symbol(path, width, height, command="C"): """Sequence generator for SVG path.""" if len(path) == 0: return
# Initial point.
yield "M"
yield path[0].anchor[1] * width
yield path[0].anchor[0] * height
yield command
# Closed path or open path
points = (
zip(path, path[1:] + path[0:1]) if path.is_closed() else zip(path, path[1:])
)
# Rest of the points.
for p1, p2 in points:
yield p1.leaving[1] * width
yield p1.leaving[0] * height
yield p2.preceding[1] * width
yield p2.preceding[0] * height
yield p2.anchor[1] * width
yield p2.anchor[0] * height
if path.is_closed():
yield "Z"`
but i cant get the fill color of the shape layer, how can i get it?
now, i can get the type of subpath, and the number of subpath in a shape layer by this code. element is used to define shapes. The element contains a d attribute, which defines the shape of the path. The shape of the path is composed of a series of commands and parameters.
The commands can be one of the following:
for subpath in paths: anchors = [(knot.anchor[1] * layer.width, knot.anchor[0] * layer.height) for knot in subpath]
By this way, I can the all the knot's anchor, but I don't know the type of knot. from GPT, svg's knot has these types: In SVG (Scalable Vector Graphics), theI read the code of ShapeLayer.vector_mask.paths, but can't find this info, could you help me? Thanks for your wonderful work !!!