summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-02-02 22:33:27 +0000
committerCarl Hetherington <cth@carlh.net>2015-02-02 22:33:27 +0000
commit989f182558193a51e0a26603fb2ca59f827216a0 (patch)
tree7d2b2511967e5417838a4343341e5aa9d26cf2b8 /examples
parent0d7fe66361a40702cb97357955cf35256f1d2c26 (diff)
Remove Image and ARGBImage and just dump RGB data into
uint8_t* buffers. This is hopefully simpler than trying to come up with some Image hierarchy that suits everything.
Diffstat (limited to 'examples')
-rw-r--r--examples/read_dcp.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/examples/read_dcp.cc b/examples/read_dcp.cc
index 901ef8ce..d1416b28 100644
--- a/examples/read_dcp.cc
+++ b/examples/read_dcp.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -32,8 +32,11 @@
#include "stereo_picture_mxf.h"
#include "sound_mxf.h"
#include "subtitle_content.h"
-#include "argb_image.h"
+#include "xyz_image.h"
+#include "colour_conversion.h"
+#include "rgb_xyz.h"
#include <Magick++.h>
+#include <boost/scoped_array.hpp>
/** @file examples/read_dcp.cc
* @brief Shows how to read a DCP.
@@ -80,10 +83,14 @@ main ()
/* Get the 1000th frame of it */
boost::shared_ptr<const dcp::MonoPictureFrame> picture_frame_j2k = picture_mxf->get_frame(999);
- /* Get a ARGB copy of it */
- boost::shared_ptr<dcp::ARGBImage> picture_image_rgb = picture_frame_j2k->argb_image ();
+ /* Get the frame as an XYZ image */
+ boost::shared_ptr<const dcp::XYZImage> picture_image_xyz = picture_frame_j2k->xyz_image ();
- Magick::Image image (picture_image_rgb->size().width, picture_image_rgb->size().height, "BGRA", Magick::CharPixel, picture_image_rgb->data ());
+ /* Convert to ARGB */
+ boost::scoped_array<uint8_t> rgba (new uint8_t[picture_image_xyz->size().width * picture_image_xyz->size().height * 4]);
+ dcp::xyz_to_rgba (picture_image_xyz, dcp::ColourConversion::xyz_to_srgb(), rgba.get ());
+
+ Magick::Image image (picture_image_xyz->size().width, picture_image_xyz->size().height, "BGRA", Magick::CharPixel, rgba.get ());
image.write ("frame.png");
return 0;