Skip to content

Commit 307aaae

Browse files
committed
Surface constructor taking width, height, colortype as arguments
Final part of fixing kyamagu#323
1 parent 9ef249f commit 307aaae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/skia/Surface.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,15 @@ surface
246246
See :py:meth:`~MakeRasterN32Premul`
247247
)docstring",
248248
py::arg("width"), py::arg("height"), py::arg("surfaceProps") = nullptr)
249+
.def(py::init(
250+
[] (int width, int height, SkColorType colortype, const SkSurfaceProps* surfaceProps) {
251+
auto info = SkImageInfo::MakeN32Premul(width, height).makeColorType(colortype);
252+
return SkSurfaces::Raster(info, surfaceProps);
253+
}),
254+
R"docstring(
255+
See :py:meth:`~MakeRasterN32Premul` plus :py:class:`ImageInfo`'s :py:meth:`~makeColorType`
256+
)docstring",
257+
py::arg("width"), py::arg("height"), py::arg("colortype"), py::arg("surfaceProps") = nullptr)
249258
.def(py::init(
250259
[] (const SkImageInfo& imageinfo, size_t rowBytes, const SkSurfaceProps* surfaceProps) {
251260
return SkSurfaces::Raster(imageinfo, rowBytes, surfaceProps);

0 commit comments

Comments
 (0)