FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
skia-python/src/skia/SamplingOptions.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
/
SamplingOptions.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (62 loc) · 2.97 KB
Breadcrumbs
skia-python
/
src
/
skia
/
SamplingOptions.cpp
Copy path
File metadata and controls
71 lines (62 loc) · 2.97 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
#
include
"
common.h
"
#
include
<
include/core/SkSamplingOptions.h
>
/*
Reference:
https://github.com/google/skia/commit/95cc53bafd5fcd94b55a22450457cfde1dd0fd37
"Hide filterquality enum entirely"
The last of SkFilterQuality emulation is:
FilterQuality.kHigh_FilterQuality -> SamplingOptions(CubicResampler.Mitchell())
FilterQuality.kMedium_FilterQuality -> SamplingOptions(FilterMode.kLinear, MipmapMode.kNearest) // cpu
or SamplingOptions(FilterMode.kLinear, MipmapMode.kLinear) // gpu
FilterQuality.kLow_FilterQuality -> SamplingOptions(FilterMode.kLinear, MipmapMode.kNone)
FilterQuality.kNone_FilterQuality -> SamplingOptions(FilterMode.kNearest, MipmapMode.kNone)
*/
void
initSamplingOptions
(py::
module
& m) {
py::class_<SkSamplingOptions>
samplingoptions
(m,
"
SamplingOptions
"
);
py::enum_<SkFilterMode>(m,
"
FilterMode
"
)
.
value
(
"
kNearest
"
, SkFilterMode::
kNearest
,
"
single sample point (nearest neighbor)
"
)
.
value
(
"
kLinear
"
, SkFilterMode::
kLinear
,
"
interporate between 2x2 sample points (bilinear interpolation)
"
)
.
export_values
();
py::enum_<SkMipmapMode>(m,
"
MipmapMode
"
)
.
value
(
"
kNone
"
, SkMipmapMode::
kNone
,
"
ignore mipmap levels, sample from the
\"
base
\"
"
)
.
value
(
"
kNearest
"
, SkMipmapMode::
kNearest
,
"
sample from the nearest level
"
)
.
value
(
"
kLinear
"
, SkMipmapMode::
kLinear
,
"
interpolate between the two nearest levels
"
)
.
export_values
();
py::class_<SkCubicResampler>(m,
"
CubicResampler
"
)
.
def_readwrite
(
"
B
"
, &SkCubicResampler::B)
.
def_readwrite
(
"
C
"
, &SkCubicResampler::C)
.
def_static
(
"
Mitchell
"
, &SkCubicResampler::Mitchell)
.
def_static
(
"
CatmullRom
"
, &SkCubicResampler::CatmullRom);
samplingoptions
.
def
(py::init<>())
.
def
(py::init<SkSamplingOptions>(),
py::arg
(
"
SamplingOptions
"
))
.
def
(py::init<SkCubicResampler>(),
py::arg
(
"
CubicResampler
"
))
.
def
(py::init<SkFilterMode>(),
py::arg
(
"
FilterMode
"
))
.
def
(py::init<SkFilterMode, SkMipmapMode>(),
py::arg
(
"
FilterMode
"
),
py::arg
(
"
MipmapMode
"
))
.
def
(
"
isAniso
"
, &SkSamplingOptions::isAniso)
.
def_readonly
(
"
maxAniso
"
, &SkSamplingOptions::maxAniso)
.
def_readonly
(
"
useCubic
"
, &SkSamplingOptions::useCubic)
.
def_readonly
(
"
cubic
"
, &SkSamplingOptions::cubic)
.
def_readonly
(
"
filter
"
, &SkSamplingOptions::filter)
.
def_readonly
(
"
mipmap
"
, &SkSamplingOptions::mipmap)
.
def_static
(
"
Aniso
"
, &SkSamplingOptions::Aniso,
py::arg
(
"
maxAniso
"
))
.
def
(
"
__eq__
"
,
[](
const
SkSamplingOptions& self,
const
SkSamplingOptions& other) {
return
self == other;
},
py::is_operator
())
.
def
(
"
__ne__
"
,
[](
const
SkSamplingOptions& self,
const
SkSamplingOptions& other) {
return
self != other;
},
py::is_operator
());
}
Back
|
FazBrowse Home
|
New Git URL