Magick++: Functions.cpp Source File

Magick++ 7.0.10

Functions.cpp
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2002, 2003
4 // Copyright Dirk Lemstra 2014-2017
5 //
6 // Simple C++ function wrappers for ImageMagick equivalents
7 //
8
9 #define MAGICKCORE_IMPLEMENTATION 1
10 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
11
12 #include "Magick++/Include.h"
13 #include <string>
14
15 using namespace std;
16
17 #include "Magick++/Functions.h"
18 #include "Magick++/Exception.h"
19
20 static bool magick_initialized=false;
21
22 // Clone C++ string as allocated C string, de-allocating any existing string
23 MagickPPExport void Magick::CloneString(char **destination_,
24 const std::string &source_)
25 {
26 MagickCore::CloneString(destination_,source_.c_str());
27 }
28
29 MagickPPExport void Magick::DisableOpenCL(void)
30 {
31 MagickCore::SetOpenCLEnabled(MagickFalse);
32 }
33
34 MagickPPExport bool Magick::EnableOpenCL(void)
35 {
36 bool
37 status;
38
39 status=MagickCore::SetOpenCLEnabled(MagickTrue) != MagickFalse;
40 return(status);
41 }
42
43 MagickPPExport void Magick::InitializeMagick(const char *path_)
44 {
45 MagickCore::MagickCoreGenesis(path_,MagickFalse);
46 if (!magick_initialized)
47 magick_initialized=true;
48 }
49
50 MagickPPExport void Magick::SetRandomSeed(const unsigned long seed)
51 {
52 MagickCore::SetRandomSecretKey(seed);
53 }
54
55 MagickPPExport bool Magick::SetSecurityPolicy(const std::string &policy_)
56 {
57 bool
58 status;
59
60 GetPPException;
61 status=MagickCore::SetMagickSecurityPolicy(policy_.c_str(),
62 exceptionInfo) != MagickFalse;
63 ThrowPPException(false);
64 return(status);
65 }
66
67 MagickPPExport void Magick::TerminateMagick(void)
68 {
69 if (magick_initialized)
70 {
71 magick_initialized=false;
72 MagickCore::MagickCoreTerminus();
73 }
74 }
Functions.h
std
STL namespace.
Magick::DisableOpenCL
MagickPPExport void DisableOpenCL(void)
Definition: Functions.cpp:29
Magick::EnableOpenCL
MagickPPExport bool EnableOpenCL(void)
Definition: Functions.cpp:34
Magick::SetRandomSeed
MagickPPExport void SetRandomSeed(const unsigned long seed)
Definition: Functions.cpp:50
MagickPPExport
#define MagickPPExport
Definition: Include.h:281
magick_initialized
static bool magick_initialized
Definition: Functions.cpp:20
ThrowPPException
#define ThrowPPException(quiet)
Definition: Include.h:1563
Include.h
Magick::CloneString
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:23
Magick::InitializeMagick
MagickPPExport void InitializeMagick(const char *path_)
Definition: Functions.cpp:43
Magick::SetSecurityPolicy
MagickPPExport bool SetSecurityPolicy(const std::string &policy_)
Definition: Functions.cpp:55
Magick::TerminateMagick
MagickPPExport void TerminateMagick()
Definition: Functions.cpp:67
GetPPException
#define GetPPException
Definition: Include.h:1544
Exception.h