FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
skia-python/src/skia/Size.cpp at main · skia-python/skia-python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
skia-python
/
skia-python
Public
Notifications
You must be signed in to change notification settings
Fork
52
Star
322
Code
Issues
44
Pull requests
6
Discussions
Actions
Projects
Security and quality
1
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
skia-python
/
src
/
skia
/
Size.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
126 lines (122 loc) · 4.7 KB
Breadcrumbs
skia-python
/
src
/
skia
/
Size.cpp
Copy path
File metadata and controls
126 lines (122 loc) · 4.7 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#
include
"
common.h
"
void
initSize
(py::
module
&m) {
//
ISize
py::class_<SkISize>(m,
"
ISize
"
)
.
def
(
py::init
(&SkISize::MakeEmpty))
.
def
(
py::init
(&SkISize::Make),
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
py::init
(
[] (py::tuple t) {
if
(t.
size
() !=
2
)
throw
py::value_error
(
"
ISize must have exactly two elements.
"
);
return
SkISize::Make
(t[
0
].
cast
<
int32_t
>(), t[
1
].
cast
<
int32_t
>());
}),
py::arg
(
"
t
"
))
.
def
(
"
set
"
, &SkISize::set,
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
"
isZero
"
, &SkISize::isZero,
R"docstring(
Returns true iff fWidth == 0 && fHeight == 0.
)docstring"
)
.
def
(
"
isEmpty
"
, &SkISize::isEmpty,
"
Returns true if either width or height are <= 0.
"
)
.
def
(
"
setEmpty
"
, &SkISize::setEmpty,
R"docstring(
Set the width and height to 0.
)docstring"
)
.
def
(
"
width
"
, &SkISize::width)
.
def
(
"
height
"
, &SkISize::height)
.
def
(
"
area
"
, &SkISize::area)
.
def
(
"
equals
"
, &SkISize::equals,
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
"
__eq__
"
,
[] (
const
SkISize& self,
const
SkISize& other) {
return
self.
fWidth
== other.
fWidth
&& self.
fHeight
== other.
fHeight
;
},
py::arg
(
"
other
"
),
py::is_operator
())
.
def
(
"
__ne__
"
,
[] (
const
SkISize& self,
const
SkISize& other) {
return
self.
fWidth
!= other.
fWidth
|| self.
fHeight
!= other.
fHeight
;
},
py::arg
(
"
other
"
),
py::is_operator
())
.
def_static
(
"
Make
"
, &SkISize::Make,
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def_static
(
"
MakeEmpty
"
, &SkISize::MakeEmpty)
.
def_readwrite
(
"
fWidth
"
, &SkISize::
fWidth
)
.
def_readwrite
(
"
fHeight
"
, &SkISize::
fHeight
)
.
def
(
"
__iter__
"
,
[] (
const
SkISize& isize) {
return
py::make_iterator
(&isize.
fWidth
, &isize.
fWidth
+
2
);
},
py::keep_alive<
0
,
1
>())
.
def
(
"
__len__
"
, [] (
const
SkISize& isize) {
return
2
; })
.
def
(
"
__repr__
"
,
[] (
const
SkISize& isize) {
std::stringstream s;
s <<
"
ISize(
"
<< isize.
fWidth
<<
"
,
"
<< isize.
fHeight
<<
"
)
"
;
return
s.
str
();
})
;
py::implicitly_convertible<py::tuple, SkISize>();
//
Size
py::class_<SkSize>(m,
"
Size
"
)
.
def
(
py::init
(&SkSize::MakeEmpty))
.
def
(
py::init
(py::overload_cast<SkScalar, SkScalar>(&SkSize::Make)),
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
py::init
(py::overload_cast<
const
SkISize&>(&SkSize::Make)),
py::arg
(
"
isize
"
))
.
def
(
py::init
(
[] (py::tuple t) {
if
(t.
size
() !=
2
)
throw
py::value_error
(
"
Size must have exactly two elements.
"
);
return
SkSize::Make
(t[
0
].
cast
<SkScalar>(), t[
1
].
cast
<SkScalar>());
}),
py::arg
(
"
t
"
))
.
def
(
"
set
"
, &SkSize::set,
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
"
isZero
"
, &SkSize::isZero,
R"docstring(
Returns true iff fWidth == 0 && fHeight == 0.
)docstring"
)
.
def
(
"
isEmpty
"
, &SkSize::isEmpty,
R"docstring(
Returns true if either width or height are <= 0.
)docstring"
)
.
def
(
"
setEmpty
"
, &SkSize::setEmpty,
R"docstring(
Set the width and height to 0.
)docstring"
)
.
def
(
"
width
"
, &SkSize::width)
.
def
(
"
height
"
, &SkSize::height)
.
def
(
"
equals
"
, &SkSize::equals,
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def
(
"
toRound
"
, &SkSize::toRound)
.
def
(
"
toCeil
"
, &SkSize::toCeil)
.
def
(
"
toFloor
"
, &SkSize::toFloor)
.
def
(
"
__eq__
"
,
[] (
const
SkSize& self,
const
SkSize& other) {
return
self.
fWidth
== other.
fWidth
&& self.
fHeight
== other.
fHeight
;
},
py::arg
(
"
other
"
),
py::is_operator
())
.
def
(
"
__ne__
"
,
[] (
const
SkSize& self,
const
SkSize& other) {
return
self.
fWidth
!= other.
fWidth
|| self.
fHeight
!= other.
fHeight
;
},
py::arg
(
"
other
"
),
py::is_operator
())
.
def_static
(
"
Make
"
, py::overload_cast<SkScalar, SkScalar>(&SkSize::Make),
py::arg
(
"
width
"
),
py::arg
(
"
height
"
))
.
def_static
(
"
Make
"
, py::overload_cast<
const
SkISize&>(&SkSize::Make),
py::arg
(
"
isize
"
))
.
def_static
(
"
MakeEmpty
"
, &SkSize::MakeEmpty)
.
def_readwrite
(
"
fWidth
"
, &SkSize::
fWidth
)
.
def_readwrite
(
"
fHeight
"
, &SkSize::
fHeight
)
.
def
(
"
__iter__
"
,
[] (
const
SkSize& size) {
return
py::make_iterator
(&size.
fWidth
, &size.
fWidth
+
2
);
},
py::keep_alive<
0
,
1
>())
.
def
(
"
__len__
"
, [] (
const
SkSize& size) {
return
2
; })
.
def
(
"
__repr__
"
,
[] (
const
SkSize& size) {
std::stringstream s;
s <<
"
Size(
"
<< size.
fWidth
<<
"
,
"
<< size.
fHeight
<<
"
)
"
;
return
s.
str
();
})
;
py::implicitly_convertible<SkISize, SkSize>();
py::implicitly_convertible<py::tuple, SkSize>();
}
Back
|
FazBrowse Home
|
New Git URL