-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathexample1.cpp
More file actions
31 lines (24 loc) · 724 Bytes
/
Copy pathexample1.cpp
File metadata and controls
31 lines (24 loc) · 724 Bytes
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
#include "pbPlots.hpp"
#include "supportLib.hpp"
using namespace std;
int main(){
bool success;
StringReference *errorMessage = CreateStringReferenceLengthValue(0, L' ');
RGBABitmapImageReference *imageReference = CreateRGBABitmapImageReference();
vector<double> xs{-2, -1, 0, 1, 2};
vector<double> ys{2, -1, -2, -1, 2};
success = DrawScatterPlot(imageReference, 600, 400, &xs, &ys, errorMessage);
if(success){
vector<double> *pngdata = ConvertToPNG(imageReference->image);
WriteToFile(pngdata, "example1.png");
DeleteImage(imageReference->image);
}else{
cerr << "Error: ";
for(wchar_t c : *errorMessage->string){
wcerr << c;
}
cerr << endl;
}
FreeAllocations();
return success ? 0 : 1;
}