lib/psd/layer/info.rb in psd-1.3.3 vs lib/psd/layer/info.rb in psd-1.4.0

- old
+ new

@@ -1,10 +1,12 @@ class PSD class Layer module Info # All of the extra layer info sections that we know how to parse. LAYER_INFO = { + blend_clipping_elements: BlendClippingElements, + blend_interior_elements: BlendInteriorElements, type: TypeTool, legacy_type: LegacyTypeTool, metadata: MetadataSetting, layer_name_source: LayerNameSource, object_effects: ObjectEffects, @@ -13,11 +15,14 @@ nested_section_divider: NestedLayerDivider, reference_point: ReferencePoint, layer_id: LayerID, fill_opacity: FillOpacity, placed_layer: PlacedLayer, - vector_mask: VectorMask + vector_mask: VectorMask, + vector_mask_2: VectorMask2, + vector_stroke: VectorStroke, + vector_stroke_content: VectorStrokeContent } attr_reader :adjustments alias :info :adjustments @@ -44,11 +49,11 @@ next unless info.key == key PSD.logger.debug "Layer Info: key = #{key}, start = #{pos}, length = #{length}" begin - i = info.new(@file, length) + i = info.new(self, length) i.parse @adjustments[name] = i info_parsed = true rescue Exception => e @@ -58,20 +63,24 @@ break end if !info_parsed - PSD.logger.debug "Skipping: key = #{key}, pos = #{@file.tell}, length = #{length}" + PSD.logger.debug "Skipping: layer = #{name}, key = #{key}, pos = #{@file.tell}, length = #{length}" @file.seek pos + length end if @file.tell != (pos + length) PSD.logger.warn "Layer info key #{key} ended at #{@file.tell}, expected #{pos + length}" @file.seek pos + length end end @extra_data_end = @file.tell + end + + def vector_mask + info[:vector_mask_2] || info[:vector_mask] end def export_extra_data(outfile) outfile.write @file.read(@extra_data_end - @extra_data_begin) if @path_components && !@path_components.empty? \ No newline at end of file