2 * Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
4 * This file is part of CasparCG (www.casparcg.com).
6 * CasparCG is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * CasparCG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
19 * Author: Niklas P Andersson, niklas.p.andersson@svt.se
24 #include "util/bigendian_file_input_stream.h"
29 #include <boost/property_tree/ptree_fwd.hpp>
33 #include <common/memory.h>
35 namespace caspar { namespace psd {
38 typedef std::shared_ptr<layer> layer_ptr;
44 spl::shared_ptr<impl> impl_;
49 friend struct layer::impl;
51 void read_mask_data(bigendian_file_input_stream&);
53 image8bit_ptr bitmap_;
54 std::uint8_t default_value_;
60 bool enabled() const { return (flags_ & 2) == 0; }
61 bool linked() const { return (flags_ & 1) == 0; }
62 bool inverted() const { return (flags_ & 4) == 4; }
64 const point<int>& location() const { return rect_.location; }
65 const image8bit_ptr& bitmap() const { return bitmap_; }
70 void populate(bigendian_file_input_stream&, const psd_document&);
71 void read_channel_data(bigendian_file_input_stream&);
73 const std::wstring& name() const;
75 int sheet_color() const;
77 bool is_position_protected();
79 double text_scale() const;
81 const boost::property_tree::wptree& text_data() const;
83 bool is_solid() const;
84 color<std::uint8_t> solid_color() const;
86 bool has_timeline() const;
87 const boost::property_tree::wptree& timeline_data() const;
89 const point<int>& location() const;
90 const image8bit_ptr& bitmap() const;
92 int link_group_id() const;
93 void set_link_group_id(int id);