Merge master.
[dcpomatic.git] / src / lib / image.h
index ab809cc463030b0e73d47005c981e4e45a7e5327..23c85e92b044d1371650805ee6364b49a9063165 100644 (file)
@@ -31,15 +31,17 @@ extern "C" {
 #include <libavcodec/avcodec.h>
 #include <libavfilter/avfilter.h>
 }
+#include <dcp/image.h>
 #include "util.h"
 #include "position.h"
+#include "position_image.h"
 
 class Scaler;
 
-class Image
+class Image : public dcp::Image
 {
 public:
-       Image (AVPixelFormat, libdcp::Size, bool);
+       Image (AVPixelFormat, dcp::Size, bool);
        Image (AVFrame *);
        Image (Image const &);
        Image (boost::shared_ptr<const Image>, bool);
@@ -49,21 +51,22 @@ public:
        uint8_t ** data () const;
        int * line_size () const;
        int * stride () const;
-       libdcp::Size size () const;
+       dcp::Size size () const;
        bool aligned () const;
 
        int components () const;
        int line_factor (int) const;
        int lines (int) const;
 
-       boost::shared_ptr<Image> scale_and_convert_to_rgb (libdcp::Size, Scaler const *, bool) const;
-       boost::shared_ptr<Image> scale (libdcp::Size, Scaler const *, bool aligned) const;
-       boost::shared_ptr<Image> post_process (std::string, bool aligned) const;
-       void alpha_blend (boost::shared_ptr<const Image> image, Position<int> pos);
-       void copy (boost::shared_ptr<const Image> image, Position<int> pos);
+       boost::shared_ptr<Image> scale (dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
        boost::shared_ptr<Image> crop (Crop c, bool aligned) const;
+
+       boost::shared_ptr<Image> crop_scale_window (Crop c, dcp::Size, dcp::Size, Scaler const *, AVPixelFormat, bool aligned) const;
        
        void make_black ();
+       void make_transparent ();
+       void alpha_blend (boost::shared_ptr<const Image> image, Position<int> pos);
+       void copy (boost::shared_ptr<const Image> image, Position<int> pos);
 
        void read_from_socket (boost::shared_ptr<Socket>);
        void write_to_socket (boost::shared_ptr<Socket>) const;
@@ -72,21 +75,24 @@ public:
                return _pixel_format;
        }
 
+       std::string digest () const;
+
 private:
        friend class pixel_formats_test;
        
        void allocate ();
        void swap (Image &);
        float bytes_per_pixel (int) const;
-       void yuv_16_black (uint16_t);
+       void yuv_16_black (uint16_t, bool);
        static uint16_t swap_16 (uint16_t);
        
        AVPixelFormat _pixel_format; ///< FFmpeg's way of describing the pixel format of this Image
-       libdcp::Size _size; ///< size in pixels
        uint8_t** _data; ///< array of pointers to components
        int* _line_size; ///< array of sizes of the data in each line, in pixels (without any alignment padding bytes)
        int* _stride; ///< array of strides for each line (including any alignment padding bytes)
        bool _aligned;
 };
 
+extern PositionImage merge (std::list<PositionImage> images);
+
 #endif