Unholy melange of stuff; setup a standard test config; send / receive subs to / from...
[dcpomatic.git] / src / lib / image.cc
index f5aef84442c545d56c8d817a48228a75bea47d6a..30dc4292f40cc064172ea9363198ddd7127019c4 100644 (file)
@@ -244,6 +244,30 @@ Image::alpha_blend (shared_ptr<Image> other, Position position)
        }
 }
 
+void
+Image::read_from_socket (shared_ptr<Socket> socket)
+{
+       for (int i = 0; i < components(); ++i) {
+               uint8_t* p = data()[i];
+               for (int y = 0; y < lines(i); ++y) {
+                       socket->read_definite_and_consume (p, line_size()[i], 30);
+                       p += stride()[i];
+               }
+       }
+}
+
+void
+Image::write_to_socket (shared_ptr<Socket> socket) const
+{
+       for (int i = 0; i < components(); ++i) {
+               uint8_t* p = data()[i];
+               for (int y = 0; y < lines(i); ++y) {
+                       socket->write (p, line_size()[i], 30);
+                       p += stride()[i];
+               }
+       }
+}
+
 /** Construct a SimpleImage of a given size and format, allocating memory
  *  as required.
  *