-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
67 lines (55 loc) · 1.62 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <memory>
#include <queue>
#include <thread>
#include <Magick++.h>
#include <bits/stdc++.h>
using namespace std;
using namespace Magick;
mutex m;
condition_variable cd;
queue<string> my;
void process()
{
cout << "process:bedore " << endl;
unique_lock<mutex> lk(m);
cd.wait(lk,[](){return my.size()>0;});
cout << "process: " << my.front() << endl;
my.pop();
}
void addjob(string a)
{
// lock_guard<std::mutex> lk(m);
cout << "add job for: " << a << endl;
my.push(a);
cd.notify_all();
}
int main(int argc,char **argv)
{
InitializeMagick(*argv);
// Construct the image object. Seperating image construction from the
// the read operation ensures that a failure to read the image file
// doesn't render the image object useless.
Image image;
try {
// Read a file into image object
image.read( "logo:" );
// Crop the image to specified size (width, height, xOffset, yOffset)
image.crop( Geometry(1400,1400, 400, 400) );
image.rotate(60);
image.addNoise(NoiseType::ImpulseNoise);
// Write the image to a file
image.write( "logo.png" );
}
catch( Exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}