fiddle with buffer options

This commit is contained in:
Robin Dunn
2019-07-25 22:05:44 -07:00
parent e7ebf2024e
commit fc590e69f5
3 changed files with 1858 additions and 1858 deletions

View File

@@ -94,7 +94,7 @@ cdef class SVGimage:
@staticmethod
def from_buffer(char[:] buff, str units='px', float dpi=96) -> SVGimage:
def from_buffer(const unsigned char[:] buff, str units='px', float dpi=96) -> SVGimage:
"""
Loads an SVG image from a buffer object (bytes, bytearray, memoryview, arrary of char, etc.)
@@ -104,7 +104,7 @@ cdef class SVGimage:
:rtype: SVGimage
"""
cdef char *pbuff = &buff[0]
cdef const unsigned char *pbuff = &buff[0]
img = SVGimage.from_ptr(nsvgParse(pbuff, bytes(units, 'utf-8'), dpi))
if img._ptr == NULL:
raise RuntimeError('Unable to parse SVG buffer')