Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/skia/Bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ bitmap

Subsequent calls to :py:meth:`getGenerationID` return a different value.
)docstring")
.def("eraseColor", &SkBitmap::eraseColor,
/*.def("eraseColor", &SkBitmap::eraseColor,
R"docstring(
Replaces pixel values with c, interpreted as being in the sRGB
:py:class:`ColorSpace`.
Expand All @@ -744,7 +744,7 @@ bitmap

:param int c: unpremultiplied color
)docstring",
py::arg("c"))
py::arg("c"))*/
.def("eraseARGB", &SkBitmap::eraseARGB,
R"docstring(
Replaces pixel values with unpremultiplied color built from a, r, g, and
Expand All @@ -763,7 +763,7 @@ bitmap
:param int b: amount of blue, from no blue (0) to full blue (255)
)docstring",
py::arg("a"), py::arg("r"), py::arg("g"), py::arg("b"))
.def("erase", &SkBitmap::erase,
/*.def("erase", &SkBitmap::erase,
R"docstring(
Replaces pixel values inside area with c.

Expand All @@ -778,7 +778,7 @@ bitmap
:param int c: unpremultiplied color
:param skia.IRect area: rectangle to fill
)docstring",
py::arg("c"), py::arg("area"))
py::arg("c"), py::arg("area"))*/
.def("getColor", &SkBitmap::getColor,
R"docstring(
Returns pixel at (x, y) as unpremultiplied color.
Expand Down Expand Up @@ -1013,11 +1013,11 @@ bitmap
:return: true if :py:class:`Bitmap` has direct access to pixels
)docstring",
py::arg("pixmap"))
.def("makeShader",
/*.def("makeShader",
py::overload_cast<SkTileMode, SkTileMode, const SkMatrix*>(
&SkBitmap::makeShader, py::const_),
py::arg("tmx") = SkTileMode::kClamp,
py::arg("tmy") = SkTileMode::kClamp, py::arg("localMatrix") = nullptr)
py::arg("tmy") = SkTileMode::kClamp, py::arg("localMatrix") = nullptr)*/
;


Expand Down
334 changes: 91 additions & 243 deletions src/skia/Canvas.cpp

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions src/skia/Codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,14 @@ codec
Returns a textual representation of :py:class:`Codec.Result`
)docstring",
py::arg("result"))
/* .def_static("MakeFromStream",
[] (std::unique_ptr<SkStream>,
/*.def_static(
"MakeFromStream",
[] (std::unique_ptr<SkStream> stream,
SkCodec::SelectionPolicy selectionPolicy) {

SkCodec::Result result;
auto codec = SkCodec::MakeFromStream(
stream, result, nullptr, selectionPolicy);
std::move(stream), &result, nullptr, selectionPolicy);
if (result != SkCodec::kSuccess)
throw std::runtime_error(SkCodec::ResultToString(result));
return codec;
Expand Down Expand Up @@ -371,7 +372,7 @@ codec
with it.
)docstring",
py::arg("stream"),
py::arg("selectionPolicy") = SelectionPolicy::kPreferStillImage) */
py::arg("selectionPolicy") = SkCodec::SelectionPolicy::kPreferStillImage)*/
.def_static("MakeFromData", &MakeFromData,
R"docstring(
If this data represents an encoded image that we know how to decode,
Expand Down
21 changes: 11 additions & 10 deletions src/skia/ColorFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace {
py::object ColorFilterAsAColorMode(SkColorFilter& colorFilter) {
SkColor color;
SkBlendMode mode;
auto result = colorFilter.asColorMode(&color, &mode);
auto result = colorFilter.asAColorMode(&color, &mode);
if (result)
return py::make_tuple(color, mode);
else
Expand Down Expand Up @@ -52,11 +52,11 @@ py::class_<SkColorFilter, sk_sp<SkColorFilter>, SkFlattenable> colorfilter(
~skia.OverdrawColorFilter
~skia.TableColorFilter
)docstring");

py::enum_<SkColorFilter::Flags>(colorfilter, "Flags", py::arithmetic())
/*
py::enum_<SkColorFilter::Flags>(colorfilter, "Flags", py::arithmetic())
.value("kAlphaUnchanged_Flag", SkColorFilter::kAlphaUnchanged_Flag)
.export_values();

*/
colorfilter
.def("asColorMode", &ColorFilterAsAColorMode)
.def("asAColorMode", &ColorFilterAsAColorMode,
Expand Down Expand Up @@ -86,12 +86,12 @@ colorfilter
)docstring")
// .def("appendStages", &SkColorFilter::appendStages)
// .def("program", &SkColorFilter::program)
.def("getFlags", &SkColorFilter::getFlags,
/*.def("getFlags", &SkColorFilter::getFlags,
R"docstring(
Returns the flags for this filter.

Override in subclasses to return custom flags.
)docstring")
)docstring")*/
.def("filterColor", &SkColorFilter::filterColor, py::arg("color"))
.def("filterColor4f", &SkColorFilter::filterColor4f,
R"docstring(
Expand All @@ -112,16 +112,17 @@ colorfilter
result = this(inner(...))
)docstring",
py::arg("inner"))
.def_static("Deserialize",
/*.def_static(
"Deserialize",
[] (py::buffer b) {
auto info = b.request();
auto flattenable = SkColorFilter::Deserialize(
SkColorFilter::GetFlattenableType(), info.ptr,
SkColorFilter:GetFlattenableType(), info.ptr,
info.shape[0] * info.strides[0]);
return sk_sp<SkColorFilter>(
reinterpret_cast<SkColorFilter*>(flattenable.release()));
},
py::arg("data"))
py::arg("data"))*/
;

py::class_<SkColorMatrix>(m, "ColorMatrix")
Expand All @@ -137,7 +138,7 @@ py::class_<SkColorFilters>(m, "ColorFilters")
CloneFlattenable<SkColorFilter>(inner));
},
py::arg("outer"), py::arg("inner"))
.def_static("Blend", &SkColorFilters::Blend, py::arg("c"), py::arg("mode"))
// .def_static("Blend", &SkColorFilters::Blend, py::arg("c"), py::arg("mode"))
// .def_static("Matrix",
// py::overload_cast<const SkColorMatrix&>(&SkColorFilters::Matrix))
.def_static("Matrix",
Expand Down
6 changes: 4 additions & 2 deletions src/skia/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ py::class_<PyAutoDocumentPage>(m, "_AutoDocumentPage")

py::class_<PyPDF> pdf(m, "PDF");

/* todo: not in use? vanished?
py::enum_<SkPDF::DocumentStructureType>(pdf, "DocumentStructureType")
.value("kDocument", SkPDF::DocumentStructureType::kDocument)
.value("kPart", SkPDF::DocumentStructureType::kPart)
Expand Down Expand Up @@ -184,18 +185,19 @@ py::enum_<SkPDF::DocumentStructureType>(pdf, "DocumentStructureType")
.value("kFormula", SkPDF::DocumentStructureType::kFormula)
.value("kForm", SkPDF::DocumentStructureType::kForm)
.export_values();
*/

py::class_<SkPDF::AttributeList>(pdf, "AttributeList")
.def(py::init<>())
.def("appendInt", &SkPDF::AttributeList::appendInt,
py::arg("owner"), py::arg("name"), py::arg("value"))
.def("appendFloat", &SkPDF::AttributeList::appendFloat,
py::arg("owner"), py::arg("name"), py::arg("value"))
.def("appendString", &SkPDF::AttributeList::appendString,
.def("appendString", &SkPDF::AttributeList::appendName,
py::arg("owner"), py::arg("name"), py::arg("value"))
.def("appendFloatArray", &SkPDF::AttributeList::appendFloatArray,
py::arg("owner"), py::arg("name"), py::arg("value"))
.def("appendStringArray", &SkPDF::AttributeList::appendStringArray,
.def("appendStringArray", &SkPDF::AttributeList::appendNodeIdArray,
py::arg("owner"), py::arg("name"), py::arg("value"))
;

Expand Down
Loading