]> git.sesse.net Git - casparcg/blobdiff - modules/psd/layer.h
* made it optional to normalize coordinates of a text-producer in order for it to...
[casparcg] / modules / psd / layer.h
index 1deea9bab7ece96fe7b8aefd27dfb0d7a130e426..fe2c339a1ea5bf2f080e7a9d7a6e47f7b3bcbb3f 100644 (file)
@@ -32,6 +32,7 @@
 #include "image.h"
 #include "misc.h"
 #include "channel.h"
+#include <boost/property_tree/ptree.hpp>
 
 namespace caspar { namespace psd {
 
@@ -46,10 +47,12 @@ public:
                friend class layer;
        public:
 
-               bool enabled() { return !((flags_ & 2) == 2); }
+               bool enabled() { return (flags_ & 2) == 0; }
+               bool linked() { return (flags_ & 1) == 0;  }
+               bool inverted() { return (flags_ & 4) == 4; }
+
                void read_mask_data(BEFileInputStream&);
 
-       private:
                char                    mask_id_;
                image8bit_ptr   mask_;
                psd::rect<long> rect_;
@@ -57,10 +60,11 @@ public:
                unsigned char   flags_;
        };
 
-       layer() : blend_mode_(InvalidBlendMode), opacity_(255), baseClipping_(false), flags_(0), masks_(0)
+       layer() : blend_mode_(InvalidBlendMode), link_group_id_(0), opacity_(255), baseClipping_(false), flags_(0), protection_flags_(0), masks_(0)
        {}
 
        static std::shared_ptr<layer> create(BEFileInputStream&);
+       void populate(BEFileInputStream&);
        void read_channel_data(BEFileInputStream&);
 
        const std::wstring& name() const
@@ -76,11 +80,26 @@ public:
        {
                return opacity_;
        }
-       bool visible() { return (flags_ & 2) == 2; }
+
+       unsigned short flags() const
+       {
+               return flags_;
+       }
+
+       bool visible() { return (flags_ & 2) == 0; }    //the (PSD file-format) documentation is is saying the opposite but what the heck
+       bool is_position_protected() { return (protection_flags_& 4) == 4; }
+       bool is_text() const;
+
+       const boost::property_tree::wptree& text_data() const { return text_layer_info_; }
 
        const image8bit_ptr& image() const { return image_; }
+
+       const layer_mask& mask_info() const { return mask_; }
        const image8bit_ptr& mask() const { return mask_.mask_; }
 
+       int link_group_id() { return link_group_id_; }
+       void set_link_group_id(int id) { link_group_id_ = id; }
+
 private:
        channel_ptr get_channel(channel_type);
        void read_blending_ranges(BEFileInputStream&);
@@ -88,15 +107,19 @@ private:
        caspar::psd::rect<long>                 rect_;
        std::vector<channel_ptr>                channels_;
        blend_mode                                              blend_mode_;
+       int                                                             link_group_id_;
        unsigned char                                   opacity_;
        bool                                                    baseClipping_;
        unsigned char                                   flags_;
+       int                                                             protection_flags_;
        std::wstring                                    name_;
        char                                                    masks_;
 
        layer_mask                                              mask_;
 
        image8bit_ptr                                   image_;
+
+       boost::property_tree::wptree    text_layer_info_;
 };
 
 }      //namespace psd