-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf-image.cpp
77 lines (58 loc) · 1.27 KB
/
pdf-image.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
68
69
70
71
72
73
74
75
76
/*
* pdf-writer.cpp
*
* Created on: Oct 31, 2017
* Author: gnat
*/
#include <phpcpp.h>
#include <string.h>
#include "pdf-image.h"
PdfImage::PdfImage() = default;
PdfImage::PdfImage(PdfImage &obj) {
index = 0;
width = 0;
height = 0;
x = obj.x;
y = obj.y;
imagepath = obj.imagepath;
if (obj.index > 0) {
index = obj.index;
}
if (obj.width > 0) {
width = obj.width;
height = obj.height;
}
}
void PdfImage::__construct(Php::Parameters ¶ms) {
x = params[0].numericValue();
y = params[1].numericValue();
imagepath = params[2].stringValue();
if (params.size() > 3) {
index = params[3].numericValue();
}
if (params.size() > 4) {
if (params.size() != 6) {
throw Php::Exception("When providing width/height parameters, both are required.");
}
width = params[4].numericValue();
height = params[5].numericValue();
}
}
Php::Value PdfImage::getX() {
return x;
}
Php::Value PdfImage::getY() {
return y;
}
Php::Value PdfImage::getIndex() {
return index;
}
Php::Value PdfImage::getImagePath() {
return imagepath;
}
Php::Value PdfImage::getWidth() {
return width;
}
Php::Value PdfImage::getHeight() {
return height;
}