Magick++  6.9.3
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-2016
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 MagickPPExport void Magick::CloneString(char **destination_,
23  const std::string &source_)
24 {
25  MagickCore::CloneString(destination_,source_.c_str());
26 }
27 
29 {
31  MagickCore::InitImageMagickOpenCL(MagickCore::MAGICK_OPENCL_OFF,NULL,NULL,
32  exceptionInfo);
33  ThrowPPException(false);
34 }
35 
36 MagickPPExport bool Magick::EnableOpenCL(const bool useCache_)
37 {
38  bool
39  status;
40 
42  if (useCache_)
43  status=MagickCore::InitImageMagickOpenCL(
44  MagickCore::MAGICK_OPENCL_DEVICE_SELECT_AUTO,NULL,NULL,exceptionInfo) ==
45  MagickTrue;
46  else
47  status=MagickCore::InitImageMagickOpenCL(
48  MagickCore::MAGICK_OPENCL_DEVICE_SELECT_AUTO_CLEAR_CACHE,NULL,NULL,
49  exceptionInfo) == MagickTrue;
50  ThrowPPException(false);
51  return(status);
52 }
53 
55 {
56  MagickCore::MagickCoreGenesis(path_,MagickFalse);
57  if (!magick_initialized)
58  magick_initialized=true;
59 }
60 
61 MagickPPExport void Magick::SetRandomSeed(const unsigned long seed)
62 {
63  MagickCore::SetRandomSecretKey(seed);
64 }
65 
67 {
69  {
70  magick_initialized=false;
71  MagickCore::MagickCoreTerminus();
72  }
73 }
MagickPPExport bool EnableOpenCL(const bool useCache_=true)
Definition: Functions.cpp:36
MagickPPExport void DisableOpenCL(void)
Definition: Functions.cpp:28
MagickPPExport void SetRandomSeed(const unsigned long seed)
Definition: Functions.cpp:61
#define MagickPPExport
Definition: Include.h:261
static bool magick_initialized
Definition: Functions.cpp:20
#define ThrowPPException(quiet)
Definition: Include.h:1524
MagickPPExport void CloneString(char **destination_, const std::string &source_)
Definition: Functions.cpp:22
MagickPPExport void InitializeMagick(const char *path_)
Definition: Functions.cpp:54
MagickPPExport void TerminateMagick()
Definition: Functions.cpp:66
#define GetPPException
Definition: Include.h:1520