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 
30 {
31  MagickCore::SetOpenCLEnabled(MagickFalse);
32 }
33 
35 {
36  bool
37  status;
38 
39  status=MagickCore::SetOpenCLEnabled(MagickTrue) != MagickFalse;
40  return(status);
41 }
42 
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 
61  status=MagickCore::SetMagickSecurityPolicy(policy_.c_str(),
62  exceptionInfo) != MagickFalse;
63  ThrowPPException(false);
64  return(status);
65 }
66 
68 {
70  {
71  magick_initialized=false;
72  MagickCore::MagickCoreTerminus();
73  }
74 }
STL namespace.
MagickPPExport void DisableOpenCL(void)
Definition: Functions.cpp:29
MagickPPExport bool EnableOpenCL(void)
Definition: Functions.cpp:34
MagickPPExport void SetRandomSeed(const unsigned long seed)
Definition: Functions.cpp:50
#define MagickPPExport
Definition: Include.h:281
static bool magick_initialized
Definition: Functions.cpp:20
#define ThrowPPException(quiet)
Definition: Include.h:1563
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:23
MagickPPExport void InitializeMagick(const char *path_)
Definition: Functions.cpp:43
MagickPPExport bool SetSecurityPolicy(const std::string &policy_)
Definition: Functions.cpp:55
MagickPPExport void TerminateMagick()
Definition: Functions.cpp:67
#define GetPPException
Definition: Include.h:1544