Commit a27023a9 authored by Ryan LeFevre's avatar Ryan LeFevre

Add color fetching from text layers

parent eff5abdf
...@@ -60,6 +60,17 @@ module.exports = class TextElements extends LayerInfo ...@@ -60,6 +60,17 @@ module.exports = class TextElements extends LayerInfo
@engineData.EngineDict.ParagraphRun.RunArray.map (s) -> @engineData.EngineDict.ParagraphRun.RunArray.map (s) ->
alignments[Math.min(parseInt(s.ParagraphSheet.Properties.Justification, 10), 3)] alignments[Math.min(parseInt(s.ParagraphSheet.Properties.Justification, 10), 3)]
# Return all colors used for text in this layer. The colors are returned in RGBA
# format as an array of arrays.
colors: ->
# If the color is opaque black, this field is sometimes omitted.
return [[0, 0, 0, 255]] if not @engineData? or not @styles().FillColor?
@styles().FillColor.map (s) ->
values = s.Values.map (v) -> Math.round(v * 255)
values.push values.shift() # Change ARGB -> RGBA for consistency
values
styles: -> styles: ->
return {} unless @engineData? return {} unless @engineData?
return @_styles if @_styles? return @_styles if @_styles?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment