Magick++: Functions.cpp Source File

Magick++ 7.1.0

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 //
5 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // Simple C++ function wrappers for ImageMagick equivalents
9 //
10
11 #define MAGICKCORE_IMPLEMENTATION 1
12 #define MAGICK_PLUSPLUS_IMPLEMENTATION 1
13
14 #include "Magick++/Include.h"
15 #include <string>
16
17 #include "Magick++/Functions.h"
18 #include "Magick++/Exception.h"
19
20 using namespace std;
21
22 static bool magick_initialized=false;
23
24 // Clone C++ string as allocated C string, de-allocating any existing string
25 MagickPPExport void Magick::CloneString(char **destination_,
26 const std::string &source_)
27 {
28 MagickCore::CloneString(destination_,source_.c_str());
29 }
30
31 MagickPPExport void Magick::DisableOpenCL(void)
32 {
33 MagickCore::SetOpenCLEnabled(MagickFalse);
34 }
35
36 MagickPPExport bool Magick::EnableOpenCL(void)
37 {
38 bool
39 status;
40
41 status=MagickCore::SetOpenCLEnabled(MagickTrue) != MagickFalse;
42 return(status);
43 }
44
45 MagickPPExport void Magick::InitializeMagick(const char *path_)
46 {
47 MagickCore::MagickCoreGenesis(path_,MagickFalse);
48 if (!magick_initialized)
49 magick_initialized=true;
50 }
51
52 MagickPPExport void Magick::SetRandomSeed(const unsigned long seed)
53 {
54 MagickCore::SetRandomSecretKey(seed);
55 }
56
57 MagickPPExport bool Magick::SetSecurityPolicy(const std::string &policy_)
58 {
59 bool
60 status;
61
62 GetPPException;
63 status=MagickCore::SetMagickSecurityPolicy(policy_.c_str(),
64 exceptionInfo) != MagickFalse;
65 ThrowPPException(false);
66 return(status);
67 }
68
69 MagickPPExport void Magick::TerminateMagick(void)
70 {
71 if (magick_initialized)
72 {
73 magick_initialized=false;
74 MagickCore::MagickCoreTerminus();
75 }
76 }
Functions.h
std
STL namespace.
Magick::DisableOpenCL
MagickPPExport void DisableOpenCL(void)
Definition: Functions.cpp:31
Magick::EnableOpenCL
MagickPPExport bool EnableOpenCL(void)
Definition: Functions.cpp:36
Magick::SetRandomSeed
MagickPPExport void SetRandomSeed(const unsigned long seed)
Definition: Functions.cpp:52
MagickPPExport
#define MagickPPExport
Definition: Include.h:297
magick_initialized
static bool magick_initialized
Definition: Functions.cpp:22
ThrowPPException
#define ThrowPPException(quiet)
Definition: Include.h:1580
Include.h
Magick::CloneString
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:25
Magick::InitializeMagick
MagickPPExport void InitializeMagick(const char *path_)
Definition: Functions.cpp:45
Magick::SetSecurityPolicy
MagickPPExport bool SetSecurityPolicy(const std::string &policy_)
Definition: Functions.cpp:57
Magick::TerminateMagick
MagickPPExport void TerminateMagick()
Definition: Functions.cpp:69
GetPPException
#define GetPPException
Definition: Include.h:1561
Exception.h