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
30 #include "util\bigendian_file_input_stream.h"
35 #include <boost/property_tree/ptree.hpp>
37 namespace caspar { namespace psd {
40 typedef std::shared_ptr<layer> layer_ptr;
50 bool enabled() { return (flags_ & 2) == 0; }
51 bool linked() { return (flags_ & 1) == 0; }
52 bool inverted() { return (flags_ & 4) == 4; }
54 void read_mask_data(BEFileInputStream&);
58 psd::rect<long> rect_;
59 unsigned char default_value_;
63 layer() : blend_mode_(InvalidBlendMode), opacity_(255), baseClipping_(false), flags_(0), masks_(0)
66 static std::shared_ptr<layer> create(BEFileInputStream&);
67 void read_channel_data(BEFileInputStream&);
69 const std::wstring& name() const
73 const psd::rect<long>& rect() const
78 unsigned char opacity() const
83 unsigned short flags() const
88 bool visible() { return (flags_ & 2) == 0; } //the (PSD file-format) documentation is is saying the opposite but what the heck
91 const boost::property_tree::wptree& text_data() const { return text_layer_info_; }
93 const image8bit_ptr& image() const { return image_; }
95 const layer_mask& mask_info() const { return mask_; }
96 const image8bit_ptr& mask() const { return mask_.mask_; }
99 channel_ptr get_channel(channel_type);
100 void read_blending_ranges(BEFileInputStream&);
102 caspar::psd::rect<long> rect_;
103 std::vector<channel_ptr> channels_;
104 blend_mode blend_mode_;
105 unsigned char opacity_;
107 unsigned char flags_;
113 image8bit_ptr image_;
115 boost::property_tree::wptree text_layer_info_;
121 #endif //_PSDLAYER_H__