How to use the cairocffi.ffi.cast function in cairocffi

To help you get started, we’ve selected a few cairocffi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cubicool / cairou / src / python / cairoucffi / api.py View on Github external
def cr_cast(cr):
    return cairocffi.Context._from_pointer(
        cairocffi.ffi.cast("cairo_t **", id(cr) + object.__basicsize__)[0],
        incref=True
    )
github Kozea / cairocffi / cairocffi / surfaces.py View on Github external
def __init__(self, hdc):
        pointer = cairo.cairo_win32_printing_surface_create(
            ffi.cast('void*', hdc))
        Surface.__init__(self, pointer)
github Jooyeshgar / amir / amir / weasyprintreport.py View on Github external
def draw_page(self, operation, print_ctx, page_num, document):
        page = document.pages[page_num]
        cairo_context = print_ctx.get_cairo_context()
        cairocffi_context = cairocffi.Context._from_pointer(
            cairocffi.ffi.cast(
                'cairo_t **', id(cairo_context) + object.__basicsize__)[0],
            incref=True)
        page.paint(cairocffi_context, left_x=0, top_y=-40, scale=0.75)