OpenShot Library | libopenshot 0.2.7
MagickUtilities.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Header file for MagickUtilities (IM6/IM7 compatibility overlay)
4 * @author Jonathan Thomas <jonathan@openshot.org>
5 * @author FeRD (Frank Dana) <ferdnyc@gmail.com>
6 */
7
8/* LICENSE
9 *
10 * Copyright (c) 2008-2019 OpenShot Studios, LLC
11 * <http://www.openshotstudios.com/>. This file is part of
12 * OpenShot Library (libopenshot), an open-source project dedicated to
13 * delivering high quality video editing and animation solutions to the
14 * world. For more information visit <http://www.openshot.org/>.
15 *
16 * OpenShot Library (libopenshot) is free software: you can redistribute it
17 * and/or modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of the
19 * License, or (at your option) any later version.
20 *
21 * OpenShot Library (libopenshot) is distributed in the hope that it will be
22 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
28 */
29
30#ifndef OPENSHOT_MAGICK_UTILITIES_H
31#define OPENSHOT_MAGICK_UTILITIES_H
32
33#ifdef USE_IMAGEMAGICK
34
35// Exclude a warning message with IM6 headers
36#pragma GCC diagnostic push
37#pragma GCC diagnostic ignored "-Wignored-qualifiers"
38 #include "Magick++.h"
39#pragma GCC diagnostic pop
40
41 // Determine ImageMagick version, as IM7 isn't fully
42 // backwards compatible
43 #ifndef NEW_MAGICK
44 #define NEW_MAGICK (MagickLibVersion >= 0x700)
45 #endif
46
47 // IM7: <Magick::Image>->alpha(bool)
48 // IM6: <Magick::Image>->matte(bool)
49 #if NEW_MAGICK
50 #define MAGICK_IMAGE_ALPHA(im, a) im->alpha((a))
51 #else
52 #define MAGICK_IMAGE_ALPHA(im, a) im->matte((a))
53 #endif
54
55 // IM7: vector<Magick::Drawable>
56 // IM6: list<Magick::Drawable>
57 // (both have the push_back() method which is all we use)
58 #if NEW_MAGICK
59 #define MAGICK_DRAWABLE std::vector<Magick::Drawable>
60 #else
61 #define MAGICK_DRAWABLE std::list<Magick::Drawable>
62 #endif
63
64#endif
65#endif