Magick++ 7.1.1
Loading...
Searching...
No Matches
Functions.cpp
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
20using namespace std;
21
22static bool magick_initialized=false;
23
24// Clone C++ string as allocated C string, de-allocating any existing string
25MagickPPExport void Magick::CloneString(char **destination_,
26 const std::string &source_)
27{
28 MagickCore::CloneString(destination_,source_.c_str());
29}
30
31MagickPPExport void Magick::DisableOpenCL(void)
32{
33 MagickCore::SetOpenCLEnabled(MagickFalse);
34}
35
36MagickPPExport bool Magick::EnableOpenCL(void)
37{
38 bool
39 status;
40
41 status=MagickCore::SetOpenCLEnabled(MagickTrue) != MagickFalse;
42 return(status);
43}
44
45MagickPPExport void Magick::InitializeMagick(const char *path_)
46{
47 MagickCore::MagickCoreGenesis(path_,MagickFalse);
48 if (!magick_initialized)
49 magick_initialized=true;
50}
51
52MagickPPExport void Magick::SetRandomSeed(const unsigned long seed)
53{
54 MagickCore::SetRandomSecretKey(seed);
55}
56
57MagickPPExport 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
69MagickPPExport void Magick::TerminateMagick(void)
70{
71 if (magick_initialized)
72 {
73 magick_initialized=false;
74 MagickCore::MagickWandTerminus();
75 }
76}