using std::make_shared;
using std::max;
using std::min;
+using std::pair;
using std::runtime_error;
using std::shared_ptr;
using std::string;
+using std::vector;
using dcp::Size;
}
}
+
+shared_ptr<Image>
+Image::crop(Crop crop) const
+{
+ vector<uint8_t*> scale_in_data;
+ dcp::Size cropped_size;
+ std::tie(scale_in_data, cropped_size) = crop_source_pointers(crop);
+
+ auto out = make_shared<Image>(_pixel_format, cropped_size, _alignment);
+
+ for (int c = 0; c < planes(); ++c) {
+ auto const out_data = out->data()[c];
+ for (int y = 0; y < cropped_size.height; ++y) {
+ memcpy(out_data + y * out->stride()[c], scale_in_data[c] + y * stride()[c], cropped_size.width * bytes_per_pixel(c));
+ }
+ }
+
+ return out;
+}
+
bool fast
) const;
+ std::shared_ptr<Image> crop(Crop crop) const;
+
void make_black ();
void make_transparent ();
void alpha_blend (std::shared_ptr<const Image> image, Position<int> pos);