lib/psd/layer/info.rb in psd-2.1.2 vs lib/psd/layer/info.rb in psd-3.1.2

- old
+ new

@@ -10,25 +10,31 @@ metadata: MetadataSetting, layer_name_source: LayerNameSource, object_effects: ObjectEffects, name: UnicodeName, section_divider: LayerSectionDivider, + sheet_color: SheetColor, nested_section_divider: NestedLayerDivider, reference_point: ReferencePoint, layer_id: LayerID, fill_opacity: FillOpacity, placed_layer: PlacedLayer, locked: Locked, + solid_color: SolidColor, vector_mask: VectorMask, - vector_mask_2: VectorMask2, + vector_origination: VectorOrigination, vector_stroke: VectorStroke, vector_stroke_content: VectorStrokeContent - } + }.freeze attr_reader :adjustments alias :info :adjustments + LAYER_INFO.keys.each do |key| + define_method(key) { @adjustments[key] } + end + private # This section is a bit tricky to parse because it represents all of the # extra data that describes this layer. def parse_layer_info @@ -45,11 +51,11 @@ length = Util.pad2 @file.read_int pos = @file.tell key_parseable = false LAYER_INFO.each do |name, info| - next unless info.key == key + next unless info.should_parse?(key) PSD.logger.debug "Layer Info: key = #{key}, start = #{pos}, length = #{length}" i = info.new(self, length) @adjustments[name] = LazyExecute.new(i, @file).now(:skip).later(:parse) @@ -62,13 +68,9 @@ @file.seek length, IO::SEEK_CUR end end @extra_data_end = @file.tell - end - - def vector_mask - info[:vector_mask_2] || info[:vector_mask] end end end end \ No newline at end of file