- for (int y = 32; y < 48; ++y) {
- uint8_t* p = a + y * stride;
- for (int x = 0; x < 48; ++x) {
- BOOST_CHECK_EQUAL (p[x * 4], 255);
- BOOST_CHECK_EQUAL (p[x * 4 + 1], 255);
- BOOST_CHECK_EQUAL (p[x * 4 + 2], 255);
- BOOST_CHECK_EQUAL (p[x * 4 + 3], 255);
- }
- }
+ background->alpha_blend (overlay, Position<int> (13, 17));
+
+ shared_ptr<Image> save = background->convert_pixel_format (dcp::YUV_TO_RGB_REC709, AV_PIX_FMT_RGB24, false, false);
+
+ write_image (save, "build/test/image_test_" + suffix + ".png", "RGB");
+ check_image ("build/test/image_test_" + suffix + ".png", private_data / ("image_test_" + suffix + ".png"));
+}
+
+/** Test Image::alpha_blend */
+BOOST_AUTO_TEST_CASE (alpha_blend_test)
+{
+ alpha_blend_test_one (AV_PIX_FMT_RGB24, "rgb24");
+ alpha_blend_test_one (AV_PIX_FMT_BGRA, "bgra");
+ alpha_blend_test_one (AV_PIX_FMT_RGBA, "rgba");
+ alpha_blend_test_one (AV_PIX_FMT_RGB48LE, "rgb48le");
+ alpha_blend_test_one (AV_PIX_FMT_YUV420P, "yuv420p");
+ alpha_blend_test_one (AV_PIX_FMT_YUV420P10, "yuv420p10");
+ alpha_blend_test_one (AV_PIX_FMT_YUV422P10LE, "yuv422p10le");