3 * Convert PixelType values macros and functions
5 * Copyright (C) 2011 Tomas Gavenciak <gavento@ucw.cz>
6 * Copyright (C) 2011-2014 Cyril Hrubis <metan@ucw.cz>
9 #include "GP_Convert.h"
11 @ # Loop around pixel types central for the conversion.
12 @ for pt in [pixeltypes_dict['RGB888'], pixeltypes_dict['RGBA8888']]:
14 GP_Pixel GP_{{ pt.name }}ToPixel(GP_Pixel pixel, GP_PixelType type)
18 @ for tf in pixeltypes:
20 case GP_PIXEL_UNKNOWN:
21 GP_ABORT("Cannot convert {{ pt.name }} to GP_PIXEL_UNKNOWN");
23 @ elif tf.is_palette():
24 case GP_PIXEL_{{ tf.name }}:
25 GP_ABORT("Cannot convert {{ pt.name }} to palette type {{ tf.name }}");
28 case GP_PIXEL_{{ tf.name }}:
29 GP_Pixel_{{ pt.name }}_TO_{{ tf.name }}(pixel, p);
33 GP_ABORT("Unknown PixelType %ud", type);
38 GP_Pixel GP_PixelTo{{ pt.name }}(GP_Pixel pixel, GP_PixelType type)
42 @ for sf in pixeltypes:
44 case GP_PIXEL_UNKNOWN:
45 GP_ABORT("Cannot convert from GP_PIXEL_UNKNOWN");
47 @ elif sf.is_palette():
48 case GP_PIXEL_{{ sf.name }}:
49 GP_ABORT("Cannot convert from palette type {{ sf.name }} (yet)");
52 case GP_PIXEL_{{ sf.name }}:
53 GP_Pixel_{{ sf.name }}_TO_{{ pt.name }}(pixel, p);
57 GP_ABORT("Unknown PixelType %u", type);