OpenShot Library | libopenshot  0.2.5
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  #include "Magick++.h"
36 
37  // Determine ImageMagick version, as IM7 isn't fully
38  // backwards compatible
39  #ifndef NEW_MAGICK
40  #define NEW_MAGICK (MagickLibVersion >= 0x700)
41  #endif
42 
43  // IM7: <Magick::Image>->alpha(bool)
44  // IM6: <Magick::Image>->matte(bool)
45  #if NEW_MAGICK
46  #define MAGICK_IMAGE_ALPHA(im, a) im->alpha((a))
47  #else
48  #define MAGICK_IMAGE_ALPHA(im, a) im->matte((a))
49  #endif
50 
51  // IM7: vector<Magick::Drawable>
52  // IM6: list<Magick::Drawable>
53  // (both have the push_back() method which is all we use)
54  #if NEW_MAGICK
55  #define MAGICK_DRAWABLE std::vector<Magick::Drawable>
56  #else
57  #define MAGICK_DRAWABLE std::list<Magick::Drawable>
58  #endif
59 
60 #endif
61 #endif