diff --git a/cairocffi/constants.py b/cairocffi/constants.py index 0c15275..b8e63bf 100644 --- a/cairocffi/constants.py +++ b/cairocffi/constants.py @@ -61,6 +61,8 @@ FORMAT_A1 = 3 FORMAT_RGB16_565 = 4 FORMAT_RGB30 = 5 +FORMAT_RGB96F = 6 +FORMAT_RGBA128F = 7 OPERATOR_CLEAR = 0 OPERATOR_SOURCE = 1 @@ -244,9 +246,6 @@ SVG_UNIT_PERCENT = 9 _CAIRO_HEADERS = r""" - const char* CAIRO_TAG_DEST = "cairo.dest"; - const char* CAIRO_TAG_LINK = "Link"; - int cairo_version (void); @@ -338,7 +337,9 @@ CAIRO_FORMAT_A8 = 2, CAIRO_FORMAT_A1 = 3, CAIRO_FORMAT_RGB16_565 = 4, - CAIRO_FORMAT_RGB30 = 5 + CAIRO_FORMAT_RGB30 = 5, + CAIRO_FORMAT_RGB96F = 6, + CAIRO_FORMAT_RGBA128F = 7 } cairo_format_t; typedef cairo_status_t (*cairo_write_func_t) (void *closure, @@ -1907,8 +1908,8 @@ cairo_debug_reset_static_data (void); - const int CAIRO_PDF_OUTLINE_ROOT = 0; - +const int CAIRO_PDF_OUTLINE_ROOT = 0; + typedef enum _cairo_pdf_version { CAIRO_PDF_VERSION_1_4, diff --git a/utils/mkconstants.py b/utils/mkconstants.py index b98e67f..9c6dad5 100644 --- a/utils/mkconstants.py +++ b/utils/mkconstants.py @@ -1,6 +1,7 @@ import os import re import sys +import textwrap import pycparser.c_generator @@ -54,15 +55,11 @@ def read_cairo_header(cairo_git_dir, suffix): def generate(cairo_git_dir): # Remove comments, preprocessor instructions and macros. - source = ''' - const char* CAIRO_TAG_DEST = "cairo.dest"; - const char* CAIRO_TAG_LINK = "Link"; - ''' - source += read_cairo_header(cairo_git_dir, '') + source = read_cairo_header(cairo_git_dir, '') - source += ''' + source += textwrap.dedent(''' const int CAIRO_PDF_OUTLINE_ROOT = 0; - ''' + ''') source += read_cairo_header(cairo_git_dir, '-pdf') source += read_cairo_header(cairo_git_dir, '-ps') @@ -84,8 +81,13 @@ def generate(cairo_git_dir): ast = pycparser.CParser().parse(source) - print('# *** Do not edit this file ***') - print('# Generated by utils/mkconstants.py\n') + print(textwrap.dedent('''\ + # *** Do not edit this file *** + # Generated by utils/mkconstants.py + + TAG_DEST = b"cairo.dest" + + TAG_LINK = b"Link"\n''')) PrintEnumsVisitor().visit(ast) print('_CAIRO_HEADERS = r"""%s"""' % source)