mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-04 11:00:07 +01:00
fiddle with buffer options
This commit is contained in:
3710
wx/svg/_nanosvg.c
3710
wx/svg/_nanosvg.c
File diff suppressed because it is too large
Load Diff
@@ -94,7 +94,7 @@ cdef extern from 'nanosvg.h':
|
||||
|
||||
cdef NSVGimage *nsvgParseFromFile(const char *filename, const char *units, float dpi)
|
||||
|
||||
cdef NSVGimage *nsvgParse(char *input, const char *units, float dpi)
|
||||
cdef NSVGimage *nsvgParse(const unsigned char *input, const char *units, float dpi)
|
||||
|
||||
cdef void nsvgDelete(NSVGimage *image)
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user