Cython: shader.pyx

Generated by Cython 0.29.21

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: shader.c

    +0001: # cython: binding=False, boundscheck=False, wraparound=False, nonecheck=False, cdivision=True,

      __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     0002: # cython: optimize.use_switch=True

     0003: # encoding: utf-8

     0004:

     0005: """

     0006:                  GNU GENERAL PUBLIC LICENSE

     0007:                        Version 3, 29 June 2007

     0008:

     0009:  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>

     0010:  Everyone is permitted to copy and distribute verbatim copies

     0011:  of this license document, but changing it is not allowed.

     0012:

     0013: Copyright Yoann Berenguer

     0014: """

     0015:

     0016:

     0017: """

     0018: Version 1.0.1 (yank)

     0019: + new cartoon effect added to library for offline surface processing. This shader cannot

     0020:   be used in real time due to the amount of transformation.

     0021:

     0022: Version 1.0.2 same than 1.0.1

     0023: + new cartoon effect added to library for offline surface processing. This shader cannot

     0024:   be used in real time due to the amount of transformation.

     0025:

     0026:

     0027: Version 1.0.3

     0028: ++ New transition effect (blend effect)

     0029:

     0030: ++ BUG CORRECTED IN rgb_split

     0031: #         unsigned char [:] red   = numpy.empty(z, uint8, order='C')

     0032: #         unsigned char [:] green = numpy.empty(z, uint8, order='C')

     0033: #         unsigned char [:] blue  = numpy.empty(z, uint8, order='C')

     0034: # TO

     0035: #         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')

     0036: #         unsigned char [:] green = numpy.zeros(z, uint8, order='C')

     0037: #         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')

     0038:

     0039: # ++ Predator mode has now a blending mode

     0040: # int blend = pygame.BLEND_RGB_ADD

     0041: # Also change declaration in pxd file and pyx bint inv_colormap and bint fast

     0042: cpdef predator_vision(object surface_, unsigned int sobel_threshold=*,

     0043:                            unsigned int bpf_threshold=*, unsigned int bloom_threshold=*,

     0044:                            bint inv_colormap=*, bint fast=*, int blend=*)

     0045:

     0046: ++ Renamed all the methods with a quicker and easier name to remember

     0047:

     0048: ++ corrected algos swirl and swirl2 (divided r by r_max)

     0049:

     0050: ++ new algorithm dirt_lens effect

     0051:

     0052: ++ Change brightness and brightness_exclude, no change if shift_ == 0

     0053:

     0054: ++ Changed /corrected bug with color_reduction algorithm.

     0055:

     0056: ++ Added Dithering algorithm

     0057: ++ Added Color_palette

     0058: ++ added bilateral filter

     0059: ++ added emboss filter

     0060: ++ pixelation

     0061: ++ convert to 27 colors

     0062: ++ spectrum surface

     0063: ++ horizontal gradient (unit misc.pyx)

     0064:

     0065: ++ create misc.pxd file

     0066:

     0067: """

     0068:

     0069:

     0070:

     0071:

    +0072: __VERSION__ = "1.0.3"

      if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_kp_s_1_0_3) < 0) __PYX_ERR(1, 72, __pyx_L1_error)

     0073:

    +0074: import warnings

      __pyx_t_1 = __Pyx_Import(__pyx_n_s_warnings, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_warnings, __pyx_t_1) < 0) __PYX_ERR(1, 74, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     0075:

    +0076: warnings.filterwarnings("ignore", category=FutureWarning)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_warnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_category, __pyx_builtin_FutureWarning) < 0) __PYX_ERR(1, 76, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__55, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    /* … */
      __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_ignore); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 76, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__55);
      __Pyx_GIVEREF(__pyx_tuple__55);

    +0077: warnings.filterwarnings("ignore", category=RuntimeWarning)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_category, __pyx_builtin_RuntimeWarning) < 0) __PYX_ERR(1, 77, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__55, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +0078: warnings.filterwarnings("ignore", category=ImportWarning)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_filterwarnings); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_category, __pyx_builtin_ImportWarning) < 0) __PYX_ERR(1, 78, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__55, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 78, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     0079:

    +0080: try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L7_try_end;
        __pyx_L2_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L7_try_end:;
      }

    +0081:     import numpy

          __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(1, 81, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +0082:     from numpy import empty, uint8, int16, float32, asarray, linspace, \

          __pyx_t_1 = PyList_New(12); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_n_s_empty);
          __Pyx_GIVEREF(__pyx_n_s_empty);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_empty);
          __Pyx_INCREF(__pyx_n_s_uint8);
          __Pyx_GIVEREF(__pyx_n_s_uint8);
          PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_uint8);
          __Pyx_INCREF(__pyx_n_s_int16);
          __Pyx_GIVEREF(__pyx_n_s_int16);
          PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_int16);
          __Pyx_INCREF(__pyx_n_s_float32);
          __Pyx_GIVEREF(__pyx_n_s_float32);
          PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_float32);
          __Pyx_INCREF(__pyx_n_s_asarray);
          __Pyx_GIVEREF(__pyx_n_s_asarray);
          PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_asarray);
          __Pyx_INCREF(__pyx_n_s_linspace);
          __Pyx_GIVEREF(__pyx_n_s_linspace);
          PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_linspace);
          __Pyx_INCREF(__pyx_n_s_ascontiguousarray);
          __Pyx_GIVEREF(__pyx_n_s_ascontiguousarray);
          PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_ascontiguousarray);
          __Pyx_INCREF(__pyx_n_s_zeros);
          __Pyx_GIVEREF(__pyx_n_s_zeros);
          PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_zeros);
          __Pyx_INCREF(__pyx_n_s_uint16);
          __Pyx_GIVEREF(__pyx_n_s_uint16);
          PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_uint16);
          __Pyx_INCREF(__pyx_n_s_uint32);
          __Pyx_GIVEREF(__pyx_n_s_uint32);
          PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_uint32);
          __Pyx_INCREF(__pyx_n_s_int32);
          __Pyx_GIVEREF(__pyx_n_s_int32);
          PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_s_int32);
          __Pyx_INCREF(__pyx_n_s_int8);
          __Pyx_GIVEREF(__pyx_n_s_int8);
          PyList_SET_ITEM(__pyx_t_1, 11, __pyx_n_s_int8);
          __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_empty, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint8, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int16); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_int16, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_float32, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_asarray, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_linspace, __pyx_t_1) < 0) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_ascontiguousarray, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_zeros, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint16); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint16, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_uint32, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_int32, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_int8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 82, __pyx_L2_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_int8, __pyx_t_1) < 0) __PYX_ERR(1, 83, __pyx_L2_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     0083:         ascontiguousarray, zeros, uint16, uint32, int32, int8

    +0084: except ImportError:

        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
        if (__pyx_t_7) {
          __Pyx_AddTraceback("PygameShader.shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(1, 84, __pyx_L4_except_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);

    +0085:     raise ImportError("\n<numpy> library is missing on your system."

          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 85, __pyx_L4_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(1, 85, __pyx_L4_except_error)
        }
        goto __pyx_L4_except_error;
        __pyx_L4_except_error:;
    /* … */
      __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_numpy_library_is_missing_on_you); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 85, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__56);
      __Pyx_GIVEREF(__pyx_tuple__56);

     0086:           "\nTry: \n   C:\\pip install numpy on a window command prompt.")

     0087:

     0088: cimport numpy as np

     0089:

    +0090: try:

      {
        /*try:*/ {
    /* … */
        }
      }

     0091:     cimport cython

     0092:     from cython.parallel cimport prange

     0093:

     0094: except ImportError:

     0095:     raise ImportError("\n<cython> library is missing on your system."

     0096:           "\nTry: \n   C:\\pip install cython on a window command prompt.")

     0097:

     0098: # PYGAME IS REQUIRED

    +0099: try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L21_try_end;
        __pyx_L16_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L21_try_end:;
      }

    +0100:     import pygame

          __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame, 0, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 100, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pygame, __pyx_t_3) < 0) __PYX_ERR(1, 100, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +0101:     from pygame import Color, Surface, SRCALPHA, RLEACCEL, BufferProxy, HWACCEL, HWSURFACE, \

          __pyx_t_3 = PyList_New(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_n_s_Color);
          __Pyx_GIVEREF(__pyx_n_s_Color);
          PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_Color);
          __Pyx_INCREF(__pyx_n_s_Surface);
          __Pyx_GIVEREF(__pyx_n_s_Surface);
          PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_Surface);
          __Pyx_INCREF(__pyx_n_s_SRCALPHA);
          __Pyx_GIVEREF(__pyx_n_s_SRCALPHA);
          PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_SRCALPHA);
          __Pyx_INCREF(__pyx_n_s_RLEACCEL);
          __Pyx_GIVEREF(__pyx_n_s_RLEACCEL);
          PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_RLEACCEL);
          __Pyx_INCREF(__pyx_n_s_BufferProxy);
          __Pyx_GIVEREF(__pyx_n_s_BufferProxy);
          PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_s_BufferProxy);
          __Pyx_INCREF(__pyx_n_s_HWACCEL);
          __Pyx_GIVEREF(__pyx_n_s_HWACCEL);
          PyList_SET_ITEM(__pyx_t_3, 5, __pyx_n_s_HWACCEL);
          __Pyx_INCREF(__pyx_n_s_HWSURFACE);
          __Pyx_GIVEREF(__pyx_n_s_HWSURFACE);
          PyList_SET_ITEM(__pyx_t_3, 6, __pyx_n_s_HWSURFACE);
          __Pyx_INCREF(__pyx_n_s_QUIT);
          __Pyx_GIVEREF(__pyx_n_s_QUIT);
          PyList_SET_ITEM(__pyx_t_3, 7, __pyx_n_s_QUIT);
          __Pyx_INCREF(__pyx_n_s_K_SPACE);
          __Pyx_GIVEREF(__pyx_n_s_K_SPACE);
          PyList_SET_ITEM(__pyx_t_3, 8, __pyx_n_s_K_SPACE);
          __Pyx_INCREF(__pyx_n_s_BLEND_RGB_ADD);
          __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_ADD);
          PyList_SET_ITEM(__pyx_t_3, 9, __pyx_n_s_BLEND_RGB_ADD);
          __Pyx_INCREF(__pyx_n_s_Rect);
          __Pyx_GIVEREF(__pyx_n_s_Rect);
          PyList_SET_ITEM(__pyx_t_3, 10, __pyx_n_s_Rect);
          __Pyx_INCREF(__pyx_n_s_BLEND_RGB_MAX);
          __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_MAX);
          PyList_SET_ITEM(__pyx_t_3, 11, __pyx_n_s_BLEND_RGB_MAX);
          __Pyx_INCREF(__pyx_n_s_BLEND_RGB_MIN);
          __Pyx_GIVEREF(__pyx_n_s_BLEND_RGB_MIN);
          PyList_SET_ITEM(__pyx_t_3, 12, __pyx_n_s_BLEND_RGB_MIN);
          __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Color); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_Color, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_Surface, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SRCALPHA); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_SRCALPHA, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_RLEACCEL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_RLEACCEL, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BufferProxy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_BufferProxy, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_HWACCEL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_HWACCEL, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_HWSURFACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_HWSURFACE, __pyx_t_3) < 0) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_QUIT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_QUIT, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_K_SPACE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_K_SPACE, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_ADD, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_Rect, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_MAX, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_BLEND_RGB_MIN); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 101, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLEND_RGB_MIN, __pyx_t_3) < 0) __PYX_ERR(1, 102, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     0102:     QUIT, K_SPACE, BLEND_RGB_ADD, Rect, BLEND_RGB_MAX, BLEND_RGB_MIN

    +0103:     from pygame.surfarray import pixels3d, array_alpha, pixels_alpha, array3d, \

          __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_n_s_pixels3d);
          __Pyx_GIVEREF(__pyx_n_s_pixels3d);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_pixels3d);
          __Pyx_INCREF(__pyx_n_s_array_alpha);
          __Pyx_GIVEREF(__pyx_n_s_array_alpha);
          PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_array_alpha);
          __Pyx_INCREF(__pyx_n_s_pixels_alpha);
          __Pyx_GIVEREF(__pyx_n_s_pixels_alpha);
          PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_pixels_alpha);
          __Pyx_INCREF(__pyx_n_s_array3d);
          __Pyx_GIVEREF(__pyx_n_s_array3d);
          PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_array3d);
          __Pyx_INCREF(__pyx_n_s_make_surface);
          __Pyx_GIVEREF(__pyx_n_s_make_surface);
          PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_make_surface);
          __Pyx_INCREF(__pyx_n_s_blit_array);
          __Pyx_GIVEREF(__pyx_n_s_blit_array);
          PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_blit_array);
          __Pyx_INCREF(__pyx_n_s_pixels_red);
          __Pyx_GIVEREF(__pyx_n_s_pixels_red);
          PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_pixels_red);
          __Pyx_INCREF(__pyx_n_s_pixels_green);
          __Pyx_GIVEREF(__pyx_n_s_pixels_green);
          PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_pixels_green);
          __Pyx_INCREF(__pyx_n_s_pixels_blue);
          __Pyx_GIVEREF(__pyx_n_s_pixels_blue);
          PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_pixels_blue);
          __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_surfarray, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels3d, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_alpha, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_alpha, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_array3d, __pyx_t_1) < 0) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_make_surface, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_blit_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_blit_array, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_red); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_red, __pyx_t_1) < 0) __PYX_ERR(1, 104, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_green); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_green, __pyx_t_1) < 0) __PYX_ERR(1, 105, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_pixels_blue); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_pixels_blue, __pyx_t_1) < 0) __PYX_ERR(1, 105, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     0104:         make_surface, blit_array, pixels_red, \

     0105:     pixels_green, pixels_blue

    +0106:     from pygame.image import frombuffer, fromstring, tostring

          __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_n_s_frombuffer);
          __Pyx_GIVEREF(__pyx_n_s_frombuffer);
          PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_frombuffer);
          __Pyx_INCREF(__pyx_n_s_fromstring);
          __Pyx_GIVEREF(__pyx_n_s_fromstring);
          PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_fromstring);
          __Pyx_INCREF(__pyx_n_s_tostring);
          __Pyx_GIVEREF(__pyx_n_s_tostring);
          PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_tostring);
          __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_image, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_frombuffer, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_fromstring, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_tostring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_tostring, __pyx_t_3) < 0) __PYX_ERR(1, 106, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +0107:     from pygame.math import Vector2

          __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 107, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_n_s_Vector2);
          __Pyx_GIVEREF(__pyx_n_s_Vector2);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Vector2);
          __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_math, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 107, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Vector2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 107, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_Vector2, __pyx_t_1) < 0) __PYX_ERR(1, 107, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +0108:     from pygame import _freetype

          __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 108, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_n_s_freetype);
          __Pyx_GIVEREF(__pyx_n_s_freetype);
          PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_freetype);
          __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 108, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_freetype); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 108, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_freetype, __pyx_t_3) < 0) __PYX_ERR(1, 108, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +0109:     from pygame._freetype import STYLE_STRONG, STYLE_NORMAL

          __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_n_s_STYLE_STRONG);
          __Pyx_GIVEREF(__pyx_n_s_STYLE_STRONG);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_STYLE_STRONG);
          __Pyx_INCREF(__pyx_n_s_STYLE_NORMAL);
          __Pyx_GIVEREF(__pyx_n_s_STYLE_NORMAL);
          PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_STYLE_NORMAL);
          __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame__freetype, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_STYLE_STRONG); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_STYLE_STRONG, __pyx_t_1) < 0) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_STYLE_NORMAL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_STYLE_NORMAL, __pyx_t_1) < 0) __PYX_ERR(1, 109, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    +0110:     from pygame.transform import scale, smoothscale, rotate, scale2x

          __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_n_s_scale);
          __Pyx_GIVEREF(__pyx_n_s_scale);
          PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_scale);
          __Pyx_INCREF(__pyx_n_s_smoothscale);
          __Pyx_GIVEREF(__pyx_n_s_smoothscale);
          PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_smoothscale);
          __Pyx_INCREF(__pyx_n_s_rotate);
          __Pyx_GIVEREF(__pyx_n_s_rotate);
          PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_s_rotate);
          __Pyx_INCREF(__pyx_n_s_scale2x);
          __Pyx_GIVEREF(__pyx_n_s_scale2x);
          PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_s_scale2x);
          __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_transform, __pyx_t_3, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_scale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothscale, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_rotate); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_rotate, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_scale2x); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_scale2x, __pyx_t_3) < 0) __PYX_ERR(1, 110, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +0111:     from pygame.pixelcopy import array_to_surface

          __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 111, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_n_s_array_to_surface);
          __Pyx_GIVEREF(__pyx_n_s_array_to_surface);
          PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_array_to_surface);
          __pyx_t_3 = __Pyx_Import(__pyx_n_s_pygame_pixelcopy, __pyx_t_1, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 111, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 111, __pyx_L16_error)
          __Pyx_GOTREF(__pyx_t_1);
          if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_to_surface, __pyx_t_1) < 0) __PYX_ERR(1, 111, __pyx_L16_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     0112:

    +0113: except ImportError:

        __pyx_t_7 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
        if (__pyx_t_7) {
          __Pyx_AddTraceback("PygameShader.shader", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) __PYX_ERR(1, 113, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_2);

    +0114:     raise ImportError("\n<Pygame> library is missing on your system."

          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 114, __pyx_L18_except_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_Raise(__pyx_t_8, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __PYX_ERR(1, 114, __pyx_L18_except_error)
        }
        goto __pyx_L18_except_error;
        __pyx_L18_except_error:;
    /* … */
      __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_Pygame_library_is_missing_on_yo); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__57);
      __Pyx_GIVEREF(__pyx_tuple__57);

     0115:           "\nTry: \n   C:\\pip install pygame on a window command prompt.")

     0116:

    +0117: try:

      {
        /*try:*/ {
    /* … */
        }
      }

     0118:     cimport cython

     0119:     from cython.parallel cimport prange

     0120:     from cpython cimport PyObject_CallFunctionObjArgs, PyObject, \

     0121:         PyList_SetSlice, PyObject_HasAttr, PyObject_IsInstance, \

     0122:         PyObject_CallMethod, PyObject_CallObject

     0123:     from cpython.dict cimport PyDict_DelItem, PyDict_Clear, PyDict_GetItem, PyDict_SetItem, \

     0124:         PyDict_Values, PyDict_Keys, PyDict_Items

     0125:     from cpython.list cimport PyList_Append, PyList_GetItem, PyList_Size, PyList_SetItem

     0126:     from cpython.object cimport PyObject_SetAttr

     0127:

     0128: except ImportError:

     0129:     raise ImportError("\n<cython> library is missing on your system."

     0130:           "\nTry: \n   C:\\pip install cython on a window command prompt.")

     0131:

    +0132: from PygameShader.gaussianBlur5x5 import canny_blur5x5_surface24_c

      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_n_s_canny_blur5x5_surface24_c);
      __Pyx_GIVEREF(__pyx_n_s_canny_blur5x5_surface24_c);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_canny_blur5x5_surface24_c);
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_PygameShader_gaussianBlur5x5, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_canny_blur5x5_surface24_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 132, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_canny_blur5x5_surface24_c, __pyx_t_2) < 0) __PYX_ERR(1, 132, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

     0133: from PygameShader.misc cimport color_diff_hsv, color_diff_hsl, close_color

     0134:

     0135: from libc.stdlib cimport rand, malloc

     0136: from libc.math cimport sqrt, atan2, sin, cos, nearbyint, exp, pow, floor

     0137: from libc.stdlib cimport malloc, free

     0138: from libc.math cimport round as round_c

     0139:

     0140: from libc.stdio cimport printf

     0141:

    +0142: cdef float M_PI = 3.14159265358979323846

      __pyx_v_12PygameShader_6shader_M_PI = 3.14159265358979323846;

    +0143: cdef float M_PI2 =3.14159265358979323846/2.0

      __pyx_v_12PygameShader_6shader_M_PI2 = (3.14159265358979323846 / 2.0);

    +0144: cdef float M_2PI =2 * 3.14159265358979323846

      __pyx_v_12PygameShader_6shader_M_2PI = (2.0 * 3.14159265358979323846);

     0145:

    +0146: cdef float RAD_TO_DEG=<float>(180.0/M_PI)

      __pyx_v_12PygameShader_6shader_RAD_TO_DEG = ((float)(180.0 / __pyx_v_12PygameShader_6shader_M_PI));

    +0147: cdef float DEG_TO_RAD=<float>(M_PI/180.0)

      __pyx_v_12PygameShader_6shader_DEG_TO_RAD = ((float)(__pyx_v_12PygameShader_6shader_M_PI / 180.0));

     0148:

    +0149: cdef float C1 = <float>7.0/<float>16.0

      __pyx_v_12PygameShader_6shader_C1 = (((float)7.0) / ((float)16.0));

    +0150: cdef float C2 = <float>3.0/<float>16.0

      __pyx_v_12PygameShader_6shader_C2 = (((float)3.0) / ((float)16.0));

    +0151: cdef float C3 = <float>5.0/<float>16.0

      __pyx_v_12PygameShader_6shader_C3 = (((float)5.0) / ((float)16.0));

    +0152: cdef float C4 = <float>1.0/<float>16.0

      __pyx_v_12PygameShader_6shader_C4 = (((float)1.0) / ((float)16.0));

     0153:

    +0154: cdef int THREADS = 4

      __pyx_v_12PygameShader_6shader_THREADS = 4;

     0155:

     0156: DEF HALF         = 1.0/2.0

     0157: DEF ONE_THIRD    = 1.0/3.0

     0158: DEF ONE_FOURTH   = 1.0/4.0

     0159: DEF ONE_FIFTH    = 1.0/5.0

     0160: DEF ONE_SIXTH    = 1.0/6.0

     0161: DEF ONE_SEVENTH  = 1.0/7.0

     0162: DEF ONE_HEIGHT   = 1.0/8.0

     0163: DEF ONE_NINTH    = 1.0/9.0

     0164: DEF ONE_TENTH    = 1.0/10.0

     0165: DEF ONE_ELEVENTH = 1.0/11.0

     0166: DEF ONE_TWELVE   = 1.0/12.0

     0167: DEF ONE_32       = 1.0/32.0

     0168: DEF ONE_64       = 1.0/64.0

     0169: DEF ONE_128      = 1.0/128.0

     0170: DEF ONE_255      = 1.0/255.0

     0171: DEF ONE_360      = 1.0/360.0

     0172: DEF TWO_THIRD    = 2.0/3.0

     0173:

     0174: cdef float[360] COS_TABLE

     0175: cdef float[360] SIN_TABLE

     0176: cdef int ANGLE

    +0177: for ANGLE in range(0, 360):

      for (__pyx_t_7 = 0; __pyx_t_7 < 0x168; __pyx_t_7+=1) {
        __pyx_v_12PygameShader_6shader_ANGLE = __pyx_t_7;

    +0178:     COS_TABLE[ANGLE] = <float>cos(<float>(ANGLE * DEG_TO_RAD))

        (__pyx_v_12PygameShader_6shader_COS_TABLE[__pyx_v_12PygameShader_6shader_ANGLE]) = ((float)cos(((float)(__pyx_v_12PygameShader_6shader_ANGLE * __pyx_v_12PygameShader_6shader_DEG_TO_RAD))));

    +0179:     SIN_TABLE[ANGLE] = <float>sin(<float>(ANGLE * DEG_TO_RAD))

        (__pyx_v_12PygameShader_6shader_SIN_TABLE[__pyx_v_12PygameShader_6shader_ANGLE]) = ((float)sin(((float)(__pyx_v_12PygameShader_6shader_ANGLE * __pyx_v_12PygameShader_6shader_DEG_TO_RAD))));
      }

     0180:

    +0181: COLORS_CPC64 = numpy.array(

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    /* … */
      __pyx_t_32 = PyTuple_New(1); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_33);
      __pyx_t_33 = 0;
    /* … */
      __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_32, __pyx_t_33); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 181, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORS_CPC64, __pyx_t_30) < 0) __PYX_ERR(1, 181, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

    +0182:     [[0, 0, 0],

      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
    /* … */
      __pyx_t_33 = PyList_New(27); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_33, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_33, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_33, 2, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_33, 3, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_10);
      PyList_SET_ITEM(__pyx_t_33, 4, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_11);
      PyList_SET_ITEM(__pyx_t_33, 5, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_12);
      PyList_SET_ITEM(__pyx_t_33, 6, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_13);
      PyList_SET_ITEM(__pyx_t_33, 7, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_14);
      PyList_SET_ITEM(__pyx_t_33, 8, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_33, 9, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_16);
      PyList_SET_ITEM(__pyx_t_33, 10, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_17);
      PyList_SET_ITEM(__pyx_t_33, 11, __pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_18);
      PyList_SET_ITEM(__pyx_t_33, 12, __pyx_t_18);
      __Pyx_GIVEREF(__pyx_t_19);
      PyList_SET_ITEM(__pyx_t_33, 13, __pyx_t_19);
      __Pyx_GIVEREF(__pyx_t_20);
      PyList_SET_ITEM(__pyx_t_33, 14, __pyx_t_20);
      __Pyx_GIVEREF(__pyx_t_21);
      PyList_SET_ITEM(__pyx_t_33, 15, __pyx_t_21);
      __Pyx_GIVEREF(__pyx_t_22);
      PyList_SET_ITEM(__pyx_t_33, 16, __pyx_t_22);
      __Pyx_GIVEREF(__pyx_t_23);
      PyList_SET_ITEM(__pyx_t_33, 17, __pyx_t_23);
      __Pyx_GIVEREF(__pyx_t_24);
      PyList_SET_ITEM(__pyx_t_33, 18, __pyx_t_24);
      __Pyx_GIVEREF(__pyx_t_25);
      PyList_SET_ITEM(__pyx_t_33, 19, __pyx_t_25);
      __Pyx_GIVEREF(__pyx_t_26);
      PyList_SET_ITEM(__pyx_t_33, 20, __pyx_t_26);
      __Pyx_GIVEREF(__pyx_t_27);
      PyList_SET_ITEM(__pyx_t_33, 21, __pyx_t_27);
      __Pyx_GIVEREF(__pyx_t_28);
      PyList_SET_ITEM(__pyx_t_33, 22, __pyx_t_28);
      __Pyx_GIVEREF(__pyx_t_29);
      PyList_SET_ITEM(__pyx_t_33, 23, __pyx_t_29);
      __Pyx_GIVEREF(__pyx_t_30);
      PyList_SET_ITEM(__pyx_t_33, 24, __pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_31);
      PyList_SET_ITEM(__pyx_t_33, 25, __pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_32);
      PyList_SET_ITEM(__pyx_t_33, 26, __pyx_t_32);
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_10 = 0;
      __pyx_t_11 = 0;
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      __pyx_t_14 = 0;
      __pyx_t_15 = 0;
      __pyx_t_16 = 0;
      __pyx_t_17 = 0;
      __pyx_t_18 = 0;
      __pyx_t_19 = 0;
      __pyx_t_20 = 0;
      __pyx_t_21 = 0;
      __pyx_t_22 = 0;
      __pyx_t_23 = 0;
      __pyx_t_24 = 0;
      __pyx_t_25 = 0;
      __pyx_t_26 = 0;
      __pyx_t_27 = 0;
      __pyx_t_28 = 0;
      __pyx_t_29 = 0;
      __pyx_t_30 = 0;
      __pyx_t_31 = 0;
      __pyx_t_32 = 0;

    +0183:     [0, 0, 128],

      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 183, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_int_128);

    +0184:     [0, 0, 255],

      __pyx_t_8 = PyList_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 184, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_8, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_8, 2, __pyx_int_255);

    +0185:     [128, 0, 0],

      __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_9, 2, __pyx_int_0);

    +0186:     [128, 0, 128],

      __pyx_t_10 = PyList_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 186, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_10, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_10, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_10, 2, __pyx_int_128);

    +0187:     [128, 0, 255],

      __pyx_t_11 = PyList_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_11, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_11, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_11, 2, __pyx_int_255);

    +0188:     [255, 0, 0],

      __pyx_t_12 = PyList_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 188, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_12, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_12, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_12, 2, __pyx_int_0);

    +0189:     [255, 0, 128],

      __pyx_t_13 = PyList_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_13, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_13, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_13, 2, __pyx_int_128);

    +0190:     [255, 0, 255],

      __pyx_t_14 = PyList_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 190, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_14, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_14, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_14, 2, __pyx_int_255);

    +0191:     [0, 128, 0],

      __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 191, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_15, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_15, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_15, 2, __pyx_int_0);

    +0192:     [0, 128, 128],

      __pyx_t_16 = PyList_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_16, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_16, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_16, 2, __pyx_int_128);

    +0193:     [0, 128, 255],

      __pyx_t_17 = PyList_New(3); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 193, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_17, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_17, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_17, 2, __pyx_int_255);

    +0194:     [128, 128, 0],

      __pyx_t_18 = PyList_New(3); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 194, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_18, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_18, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_18, 2, __pyx_int_0);

    +0195:     [128, 128, 128],

      __pyx_t_19 = PyList_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_19, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_19, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_19, 2, __pyx_int_128);

    +0196:     [128, 128, 255],

      __pyx_t_20 = PyList_New(3); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_20);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_20, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_20, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_20, 2, __pyx_int_255);

    +0197:     [255, 128, 0],

      __pyx_t_21 = PyList_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_21, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_21, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_21, 2, __pyx_int_0);

    +0198:     [255, 128, 128],

      __pyx_t_22 = PyList_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_22);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_22, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_22, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_22, 2, __pyx_int_128);

    +0199:     [255, 128, 255],

      __pyx_t_23 = PyList_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_23);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_23, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_23, 1, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_23, 2, __pyx_int_255);

    +0200:     [0, 255, 0],

      __pyx_t_24 = PyList_New(3); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_24, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_24, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_24, 2, __pyx_int_0);

    +0201:     [0, 255, 128],

      __pyx_t_25 = PyList_New(3); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_25, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_25, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_25, 2, __pyx_int_128);

    +0202:     [0, 255, 255],

      __pyx_t_26 = PyList_New(3); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_26);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_26, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_26, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_26, 2, __pyx_int_255);

    +0203:     [128, 255, 0],

      __pyx_t_27 = PyList_New(3); if (unlikely(!__pyx_t_27)) __PYX_ERR(1, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_27, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_27, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_27, 2, __pyx_int_0);

    +0204:     [128, 255, 128],

      __pyx_t_28 = PyList_New(3); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_28);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_28, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_28, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_28, 2, __pyx_int_128);

    +0205:     [128, 255, 255],

      __pyx_t_29 = PyList_New(3); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 205, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_29, 0, __pyx_int_128);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_29, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_29, 2, __pyx_int_255);

    +0206:     [255, 255, 0],

      __pyx_t_30 = PyList_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_0);

    +0207:     [255, 255, 128],

      __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 207, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_128);
      __Pyx_GIVEREF(__pyx_int_128);
      PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_128);

    +0208:     [255, 255, 255]], dtype=numpy.uint8)

      __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_255);
      __Pyx_INCREF(__pyx_int_255);
      __Pyx_GIVEREF(__pyx_int_255);
      PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_255);
    /* … */
      __pyx_t_33 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_GetModuleGlobalName(__pyx_t_31, __pyx_n_s_numpy); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_uint8); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      if (PyDict_SetItem(__pyx_t_33, __pyx_n_s_dtype, __pyx_t_30) < 0) __PYX_ERR(1, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

     0209:

     0210: cdef:

    +0211:     float [:, :] COLORS_CPC64_C = numpy.divide(COLORS_CPC64, 255.0).astype(dtype=float32)

      __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_numpy); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_divide); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_COLORS_CPC64); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __pyx_t_32 = PyTuple_New(2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_GIVEREF(__pyx_t_30);
      PyTuple_SET_ITEM(__pyx_t_32, 0, __pyx_t_30);
      __Pyx_INCREF(__pyx_float_255_0);
      __Pyx_GIVEREF(__pyx_float_255_0);
      PyTuple_SET_ITEM(__pyx_t_32, 1, __pyx_float_255_0);
      __pyx_t_30 = 0;
      __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_32, NULL); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_astype); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_t_30 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_float32); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      if (PyDict_SetItem(__pyx_t_30, __pyx_n_s_dtype, __pyx_t_33) < 0) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_empty_tuple, __pyx_t_30); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_t_34 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_33, PyBUF_WRITABLE); if (unlikely(!__pyx_t_34.memview)) __PYX_ERR(1, 211, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_COLORS_CPC64_C, 1);
      __pyx_v_12PygameShader_6shader_COLORS_CPC64_C = __pyx_t_34;
      __pyx_t_34.memview = NULL;
      __pyx_t_34.data = NULL;

     0212:

     0213:

     0214:

     0215: # todo  BILATERAL FILTER (CHECK project spritesheetstudio tools) + PIXELATE and PIXEL

     0216: #  BLOCKS

     0217: # TODO FUNCTION TESTING IMAGE

     0218: # TODO ADD HSV

     0219:

     0220:

     0221:

    +0222: cpdef inline void rgb_to_bgr(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_bgr(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_bgr", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.rgb_to_bgr", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_rgb_to_bgr[] = "  \n    SHADER RGB to BGR\n  \n    Convert your game display from RGB to BGR format\n    This algorithm can also be used to transform pygame texture in the equivalent bgr format\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n    new surface.\n\n    e.g:\n    rgb_to_bgr(surface)\n\n    :param surface_    : Pygame surface or display surface compatible (image 24-32 bit with or \n                         without per-pixel transparency / alpha channel)\n    :return             : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_1rgb_to_bgr(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_bgr (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_rgb_to_bgr(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_rgb_to_bgr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_bgr", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rgb_to_bgr(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 222, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_bgr", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0223:     """

     0224:     SHADER RGB to BGR

     0225:

     0226:     Convert your game display from RGB to BGR format

     0227:     This algorithm can also be used to transform pygame texture in the equivalent bgr format

     0228:

     0229:     * The changes are automatically applied inplace to the surface you do not need to create a

     0230:     new surface.

     0231:

     0232:     e.g:

     0233:     rgb_to_bgr(surface)

     0234:

     0235:     :param surface_    : Pygame surface or display surface compatible (image 24-32 bit with or

     0236:                          without per-pixel transparency / alpha channel)

     0237:     :return             : void

     0238:     """

    +0239:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 239, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 239, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 239, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0240:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 239, __pyx_L1_error)
        }
      }
      #endif

     0241:

    +0242:     shader_rgb_to_bgr_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 242, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_rgb_to_bgr_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0243:

     0244:

    +0245: cpdef inline void rgb_to_brg(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_to_brg(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_brg", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.rgb_to_brg", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_2rgb_to_brg[] = "\n    SHADER RGB TO BRG\n\n    Convert your game display from RGB to BRG format.\n    This algorithm can also be used to transform pygame texture in the equivalent BRG format\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n    \n    e.g:\n    rgb_to_brg(surface)\n\n    :param surface_: Pygame surface or display surface compatible (image 24-32 bit with or without \n                     per-pixel transparency / alpha channel)\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_3rgb_to_brg(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_brg (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_2rgb_to_brg(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_2rgb_to_brg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_brg", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rgb_to_brg(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_brg", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0246:     """

     0247:     SHADER RGB TO BRG

     0248:

     0249:     Convert your game display from RGB to BRG format.

     0250:     This algorithm can also be used to transform pygame texture in the equivalent BRG format

     0251:

     0252:     * The changes are automatically applied inplace to the surface you do not need to create a

     0253:       new surface.

     0254:

     0255:     e.g:

     0256:     rgb_to_brg(surface)

     0257:

     0258:     :param surface_: Pygame surface or display surface compatible (image 24-32 bit with or without

     0259:                      per-pixel transparency / alpha channel)

     0260:     :return: void

     0261:     """

    +0262:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 262, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 262, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 262, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0263:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 263, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 262, __pyx_L1_error)
        }
      }
      #endif

     0264:

    +0265:     shader_rgb_to_brg_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 265, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_rgb_to_brg_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0266:

    +0267: cpdef inline void greyscale(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_greyscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("greyscale", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.greyscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_4greyscale[] = "\n    SHADER GRAYSCALE (CONSERVE LUMINOSITY)\n\n    This shader transform the game display on a grayscale video game effect\n    \n    * This shader can also be applied to pygame textures/surface to transform them into\n      an equivalent grayscale model\n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n\n    e.g:\n    greyscale(surface)\n\n    :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with \n                       or without per-pixel transparency / alpha channel)\n    :return          : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_5greyscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("greyscale (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_4greyscale(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_4greyscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("greyscale", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_greyscale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 267, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.greyscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0268:     """

     0269:     SHADER GRAYSCALE (CONSERVE LUMINOSITY)

     0270:

     0271:     This shader transform the game display on a grayscale video game effect

     0272:

     0273:     * This shader can also be applied to pygame textures/surface to transform them into

     0274:       an equivalent grayscale model

     0275:     * The changes are automatically applied inplace to the surface you do not need to create a

     0276:       new surface.

     0277:

     0278:     e.g:

     0279:     greyscale(surface)

     0280:

     0281:     :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with

     0282:                        or without per-pixel transparency / alpha channel)

     0283:     :return          : void

     0284:

     0285:     """

    +0286:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 286, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 286, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0287:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 286, __pyx_L1_error)
        }
      }
      #endif

     0288:

    +0289:     shader_greyscale_luminosity24_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 289, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0290:

     0291:

    +0292: cpdef inline void sepia(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sepia(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sepia", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.sepia", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_6sepia[] = "\n    SHADER SEPIA MODEL\n\n    Transform your video game into an equivalent sepia model\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.\n\n    e.g:\n    sepia(surface)\n\n\n    :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with \n                       or without per-pixel transparency / alpha channel)\n    :return:         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_7sepia(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sepia (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_6sepia(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_6sepia(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sepia", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_sepia(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.sepia", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0293:     """

     0294:     SHADER SEPIA MODEL

     0295:

     0296:     Transform your video game into an equivalent sepia model

     0297:

     0298:     * The changes are automatically applied inplace to the surface you do not need to create a

     0299:       new surface.

     0300:

     0301:     e.g:

     0302:     sepia(surface)

     0303:

     0304:

     0305:     :param surface_  : Pygame surface or display surface compatible (image 24-32 bit with

     0306:                        or without per-pixel transparency / alpha channel)

     0307:     :return:         : void

     0308:     """

    +0309:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 309, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0310:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 309, __pyx_L1_error)
        }
      }
      #endif

     0311:

    +0312:     shader_sepia24_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 312, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_sepia24_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0313:

     0314:

     0315: @cython.boundscheck(False)

     0316: @cython.wraparound(False)

     0317: @cython.nonecheck(False)

     0318: @cython.cdivision(True)

    +0319: cdef inline void median_fast(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_fast(PyObject *__pyx_v_surface_, struct __pyx_opt_args_12PygameShader_6shader_median_fast *__pyx_optional_args) {
      unsigned short __pyx_v_kernel_size_ = ((unsigned short)2);
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)1);
      PyObject *__pyx_v_surface_cp = NULL;
      int __pyx_v_w;
      int __pyx_v_h;
      __Pyx_memviewslice __pyx_v_surface_cp_arr = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_j;
      __Pyx_memviewslice __pyx_v_org_surface = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_fast", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
          }
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.median_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_surface_cp);
      __PYX_XDEC_MEMVIEW(&__pyx_v_surface_cp_arr, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_org_surface, 1);
      __Pyx_RefNannyFinishContext();
    }

     0320:         object surface_,

     0321:         unsigned short int kernel_size_=2,

     0322:         unsigned short int reduce_factor_=1

     0323: ):

     0324:     """

     0325:     This function cannot be called directly from python script (cdef)

     0326:

     0327:     :param surface_: pygame.surface; Surface compatible 24-32 bit

     0328:     :param kernel_size_: integer; size of the kernel

     0329:     :param reduce_factor_: integer; value of 1 divide the image by 2, value of 2 div the image by 4

     0330:     :return: void

     0331:     """

     0332:

    +0333:     surface_cp = surface_.copy()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 333, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_surface_cp = __pyx_t_1;
      __pyx_t_1 = 0;

     0334:     cdef:

     0335:         int w, h

    +0336:     w, h = surface_cp.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_cp, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 336, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 336, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 336, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     0337:

    +0338:     surface_cp = smoothscale(surface_cp, (w >> reduce_factor_, h >> reduce_factor_))

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_w >> __pyx_v_reduce_factor_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_h >> __pyx_v_reduce_factor_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_cp, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_cp, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface_cp);
        __Pyx_GIVEREF(__pyx_v_surface_cp);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_surface_cp);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_surface_cp, __pyx_t_1);
      __pyx_t_1 = 0;

     0339:

     0340:     cdef:

    +0341:         unsigned char [:, :, :] surface_cp_arr = pixels3d(surface_cp)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_cp) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_cp);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 341, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 341, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_surface_cp_arr = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     0342:         int i, j

    +0343:         unsigned char[:, :, :] org_surface = pixels3d(surface_)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 343, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_org_surface = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     0344:

    +0345:     shader_median_filter24_inplace_c(surface_cp_arr, kernel_size_)

      __pyx_t_10.__pyx_n = 1;
      __pyx_t_10.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_v_surface_cp_arr, &__pyx_t_10);

    +0346:     surface_cp_arr = scale_array24_c(surface_cp_arr, w, h)

      __pyx_t_11 = __pyx_f_12PygameShader_6shader_scale_array24_c(__pyx_v_surface_cp_arr, __pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 346, __pyx_L1_error)
      __PYX_XDEC_MEMVIEW(&__pyx_v_surface_cp_arr, 1);
      __pyx_v_surface_cp_arr = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     0347:

    +0348:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L7:;
          }
      }

    +0349:         for i in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_7 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static)
    /* … */
            __pyx_t_7 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_12; __pyx_t_6++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_j = ((int)0xbad0bad0);

    +0350:             for j in range(h):

                                __pyx_t_13 = __pyx_v_h;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                                  __pyx_v_j = __pyx_t_15;

    +0351:                 org_surface[i, j, 0] = surface_cp_arr[i, j, 0]

                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 0;
                                  __pyx_t_19 = __pyx_v_i;
                                  __pyx_t_20 = __pyx_v_j;
                                  __pyx_t_21 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_19 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_21 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[2]) )));

    +0352:                 org_surface[i, j, 1] = surface_cp_arr[i, j, 1]

                                  __pyx_t_18 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_16 = 1;
                                  __pyx_t_21 = __pyx_v_i;
                                  __pyx_t_20 = __pyx_v_j;
                                  __pyx_t_19 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_21 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_19 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[2]) )));

    +0353:                 org_surface[i, j, 2] = surface_cp_arr[i, j, 2]

                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 2;
                                  __pyx_t_19 = __pyx_v_i;
                                  __pyx_t_20 = __pyx_v_j;
                                  __pyx_t_21 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_org_surface.data + __pyx_t_19 * __pyx_v_org_surface.strides[0]) ) + __pyx_t_20 * __pyx_v_org_surface.strides[1]) ) + __pyx_t_21 * __pyx_v_org_surface.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_surface_cp_arr.data + __pyx_t_16 * __pyx_v_surface_cp_arr.strides[0]) ) + __pyx_t_17 * __pyx_v_surface_cp_arr.strides[1]) ) + __pyx_t_18 * __pyx_v_surface_cp_arr.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     0354:

     0355:

    +0356: cpdef inline void median(

    static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median *__pyx_optional_args) {
      unsigned short __pyx_v_kernel_size_ = ((unsigned short)2);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
      __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_8median[] = "\n    SHADER MEDIAN FILTER COMPATIBLE 24-32 bit IMAGE\n\n    This shader cannot be used for real time display rendering as the performance \n    of the algorithm is not satisfactory < 50 fps. \n    The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_      : Pygame surface or display surface compatible (image 24-32 bit with \n                           or without per-pixel transparency / alpha channel)\n    :param kernel_size_  : integer; Kernel size or neighbourhood pixels to be included default is 2\n                           Increase the effect with kernel size > 2 (effect overall speed is \n                           degrading quickly with large kernel size e.g > 2)\n    :param fast_         : boolean; Flag for fast calculation (default True). Improve overall speed \n                           performance by using smaller texture sizes (see reduce_factor_ option)\n    :param reduce_factor_: integer; Int value to reduce the size of the original surface to \n                           process. A value of 1, divide the original surface by 2 and a value of 2\n                           reduce the surface by 4 (value of 1 and 2 are acceptable, over 2 the \n                           image quality is too pixelated and blur) default value is 1 (div by 2).\n                           This argument as no effect if flag fast_=False\n    :return:             : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_9median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      unsigned short __pyx_v_kernel_size_;
      int __pyx_v_fast_;
      unsigned short __pyx_v_reduce_factor_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,&__pyx_n_s_fast,&__pyx_n_s_reduce_factor,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
              if (value) { values[3] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median") < 0)) __PYX_ERR(1, 356, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_kernel_size_ = __Pyx_PyInt_As_unsigned_short(values[1]); if (unlikely((__pyx_v_kernel_size_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 358, __pyx_L3_error)
        } else {
          __pyx_v_kernel_size_ = ((unsigned short)2);
        }
        if (values[2]) {
          __pyx_v_fast_ = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_fast_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 359, __pyx_L3_error)
        } else {
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_8median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned short __pyx_v_kernel_size_, int __pyx_v_fast_, unsigned short __pyx_v_reduce_factor_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 3;
      __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_t_1.fast_ = __pyx_v_fast_;
      __pyx_t_1.reduce_factor_ = __pyx_v_reduce_factor_;
      __pyx_f_12PygameShader_6shader_median(__pyx_v_surface_, 0, &__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 356, __pyx_L1_error)
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0357:         object surface_,

     0358:         unsigned short int kernel_size_=2,

    +0359:         bint fast_=True,

      int __pyx_v_fast_ = ((int)1);
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)1);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_fast_ = __pyx_optional_args->fast_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
            }
          }
        }
      }
    /* … */
          __pyx_v_fast_ = ((int)1);
        }
        if (values[3]) {
          __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[3]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 360, __pyx_L3_error)
        } else {
          __pyx_v_reduce_factor_ = ((unsigned short)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("median", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 356, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.median", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_8median(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_, __pyx_v_fast_, __pyx_v_reduce_factor_);

     0360:         unsigned short int reduce_factor_=1

     0361: ) except *:

     0362:     """

     0363:     SHADER MEDIAN FILTER COMPATIBLE 24-32 bit IMAGE

     0364:

     0365:     This shader cannot be used for real time display rendering as the performance

     0366:     of the algorithm is not satisfactory < 50 fps.

     0367:     The code would have to be changed and improved with C or assembler in order to

     0368:     be adapted for a real time application.

     0369:

     0370:     In the state, this shader can be used for texture/surface transformation offline

     0371:

     0372:     * The changes are automatically applied inplace to the surface you do not need to create a

     0373:       new surface.

     0374:

     0375:     :param surface_      : Pygame surface or display surface compatible (image 24-32 bit with

     0376:                            or without per-pixel transparency / alpha channel)

     0377:     :param kernel_size_  : integer; Kernel size or neighbourhood pixels to be included default is 2

     0378:                            Increase the effect with kernel size > 2 (effect overall speed is

     0379:                            degrading quickly with large kernel size e.g > 2)

     0380:     :param fast_         : boolean; Flag for fast calculation (default True). Improve overall speed

     0381:                            performance by using smaller texture sizes (see reduce_factor_ option)

     0382:     :param reduce_factor_: integer; Int value to reduce the size of the original surface to

     0383:                            process. A value of 1, divide the original surface by 2 and a value of 2

     0384:                            reduce the surface by 4 (value of 1 and 2 are acceptable, over 2 the

     0385:                            image quality is too pixelated and blur) default value is 1 (div by 2).

     0386:                            This argument as no effect if flag fast_=False

     0387:     :return:             : void

     0388:     """

    +0389:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 389, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0390:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 390, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 389, __pyx_L1_error)
        }
      }
      #endif

     0391:

    +0392:     if kernel_size_ <= 0:

      __pyx_t_3 = ((__pyx_v_kernel_size_ <= 0) != 0);
      if (unlikely(__pyx_t_3)) {
    /* … */
      }

    +0393:         raise ValueError('\nArgument kernel_size_ cannot be <= 0')

        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 393, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(1, 393, __pyx_L1_error)
    /* … */
      __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Argument_kernel_size__cannot_be); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 393, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple_);
      __Pyx_GIVEREF(__pyx_tuple_);

    +0394:     if not 0 < reduce_factor_ < 9:

      __pyx_t_3 = (0 < __pyx_v_reduce_factor_);
      if (__pyx_t_3) {
        __pyx_t_3 = (__pyx_v_reduce_factor_ < 9);
      }
      __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0);
      if (unlikely(__pyx_t_4)) {
    /* … */
      }

    +0395:         raise ValueError('\nArgument reduce_factor_ must be in range [1 ... 8] ')

        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 395, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_Raise(__pyx_t_2, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(1, 395, __pyx_L1_error)
    /* … */
      __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Argument_reduce_factor__must_be); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__2);
      __Pyx_GIVEREF(__pyx_tuple__2);

     0396:

    +0397:     if fast_:

      __pyx_t_4 = (__pyx_v_fast_ != 0);
      if (__pyx_t_4) {
    /* … */
        goto __pyx_L5;
      }

    +0398:         median_fast(surface_, kernel_size_, reduce_factor_)

        __pyx_t_5.__pyx_n = 2;
        __pyx_t_5.kernel_size_ = __pyx_v_kernel_size_;
        __pyx_t_5.reduce_factor_ = __pyx_v_reduce_factor_;
        __pyx_f_12PygameShader_6shader_median_fast(__pyx_v_surface_, &__pyx_t_5);

     0399:     else:

    +0400:         shader_median_filter24_inplace_c(pixels3d(surface_), kernel_size_)

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 400, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 400, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_8.__pyx_n = 1;
        __pyx_t_8.kernel_size_ = __pyx_v_kernel_size_;
        __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_t_7, &__pyx_t_8);
        __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
        __pyx_t_7.memview = NULL;
        __pyx_t_7.data = NULL;
      }
      __pyx_L5:;

     0401:

     0402:

    +0403: cpdef inline void median_grayscale(

    static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_grayscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_grayscale *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_grayscale", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_10median_grayscale[] = "\n    SHADER MEDIAN FILTER (GRAYSCALE)\n\n    This shader cannot be used for real time rendering as the performance of the algorithm are not\n    satisfactory. The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer\n    :param kernel_size_: integer; Kernel size (must be > 0), default value = 2\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_11median_grayscale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_kernel_size_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_grayscale (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median_grayscale") < 0)) __PYX_ERR(1, 403, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_kernel_size_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_kernel_size_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 405, __pyx_L3_error)
        } else {
          __pyx_v_kernel_size_ = ((int)2);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("median_grayscale", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 403, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_10median_grayscale(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_10median_grayscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_grayscale", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_f_12PygameShader_6shader_median_grayscale(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.median_grayscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0404:         object surface_,

     0405:         int kernel_size_=2

     0406: ):

     0407:     """

     0408:     SHADER MEDIAN FILTER (GRAYSCALE)

     0409:

     0410:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     0411:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     0412:     be adapted for a real time application.

     0413:

     0414:     In the state, this shader can be used for texture/surface transformation offline

     0415:

     0416:     The surface is compatible 24 - 32 bit with or without alpha layer

     0417:

     0418:     * The changes are automatically applied inplace to the surface you do not need to create a

     0419:       new surface.

     0420:

     0421:     :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer

     0422:     :param kernel_size_: integer; Kernel size (must be > 0), default value = 2

     0423:     :return: void

     0424:     """

    +0425:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 425, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0426:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 425, __pyx_L1_error)
        }
      }
      #endif

     0427:

    +0428:     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_kernel_size_ > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_kernel_size__cannot_be);
          __PYX_ERR(1, 428, __pyx_L1_error)
        }
      }
      #endif

     0429:

    +0430:     shader_median_grayscale_filter24_inplace_c(pixels3d(surface_), kernel_size_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 430, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 430, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_f_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0431:

     0432:

    +0433: cpdef inline void median_avg(

    static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_median_avg(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_median_avg *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_avg", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_12median_avg[] = "\n    SHADER MEDIAN FILTER (AVERAGE)\n    \n    This shader cannot be used for real time rendering as the performance of the algorithm are not\n    satisfactory. The code would have to be changed and improved with C or assembler in order to\n    be adapted for a real time application. \n\n    In the state, this shader can be used for texture/surface transformation offline\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer\n    :param kernel_size_: integer; Kernel size (must be > 0), default value = 2\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_13median_avg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_kernel_size_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_avg (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_kernel_size,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_kernel_size);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "median_avg") < 0)) __PYX_ERR(1, 433, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_kernel_size_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_kernel_size_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 435, __pyx_L3_error)
        } else {
          __pyx_v_kernel_size_ = ((int)2);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("median_avg", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 433, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_12median_avg(__pyx_self, __pyx_v_surface_, __pyx_v_kernel_size_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_12median_avg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_kernel_size_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("median_avg", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_f_12PygameShader_6shader_median_avg(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 433, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.median_avg", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0434:         object surface_,

     0435:         int kernel_size_=2

     0436: ):

     0437:     """

     0438:     SHADER MEDIAN FILTER (AVERAGE)

     0439:

     0440:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     0441:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     0442:     be adapted for a real time application.

     0443:

     0444:     In the state, this shader can be used for texture/surface transformation offline

     0445:

     0446:     The surface is compatible 24 - 32 bit with or without alpha layer

     0447:

     0448:     * The changes are automatically applied inplace to the surface you do not need to create a

     0449:       new surface.

     0450:

     0451:     :param surface_: pygame.Surface; compatible 24 - 32 bit with or without alpha layer

     0452:     :param kernel_size_: integer; Kernel size (must be > 0), default value = 2

     0453:     :return: void

     0454:     """

     0455:

    +0456:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 456, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 456, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 456, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0457:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 457, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 456, __pyx_L1_error)
        }
      }
      #endif

     0458:

    +0459:     assert kernel_size_ > 0, "\nArgument kernel_size_ cannot be <= 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_kernel_size_ > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_kernel_size__cannot_be);
          __PYX_ERR(1, 459, __pyx_L1_error)
        }
      }
      #endif

     0460:

    +0461:     shader_median_filter24_avg_inplace_c(pixels3d(surface_), kernel_size_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 461, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.kernel_size_ = __pyx_v_kernel_size_;
      __pyx_f_12PygameShader_6shader_shader_median_filter24_avg_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0462:

     0463:

     0464:

    +0465: cpdef inline void color_reduction(

    static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_color_reduction(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_color_reduction *__pyx_optional_args) {
      int __pyx_v_color_ = ((int)8);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("color_reduction", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_color_ = __pyx_optional_args->color_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_14color_reduction[] = "\n     COLOR REDUCTION SHADER\n\n    Decrease the amount of colors in the display or texture.\n    The method of color reduction is very simple: every color of the original picture is replaced\n    by an appropriate color from the limited palette that is accessible.\n    \n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface you do not need to create a \n      new surface.  \n      \n    e.g:\n    color_reduction(surface, 8)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param color_: integer must be > 0 default 8\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_15color_reduction(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_color_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("color_reduction (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_color,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "color_reduction") < 0)) __PYX_ERR(1, 465, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_color_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_color_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 467, __pyx_L3_error)
        } else {
          __pyx_v_color_ = ((int)8);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("color_reduction", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 465, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_14color_reduction(__pyx_self, __pyx_v_surface_, __pyx_v_color_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_14color_reduction(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_color_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("color_reduction", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.color_ = __pyx_v_color_;
      __pyx_f_12PygameShader_6shader_color_reduction(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.color_reduction", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0466:         object surface_,

     0467:         int color_=8

     0468: ):

     0469:     """

     0470:      COLOR REDUCTION SHADER

     0471:

     0472:     Decrease the amount of colors in the display or texture.

     0473:     The method of color reduction is very simple: every color of the original picture is replaced

     0474:     by an appropriate color from the limited palette that is accessible.

     0475:

     0476:     The surface is compatible 24 - 32 bit with or without alpha layer

     0477:

     0478:     * The changes are automatically applied inplace to the surface you do not need to create a

     0479:       new surface.

     0480:

     0481:     e.g:

     0482:     color_reduction(surface, 8)

     0483:

     0484:     :param surface_: pygame.Surface; compatible 24 - 32 bit

     0485:     :param color_: integer must be > 0 default 8

     0486:     :return: void

     0487:     """

    +0488:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 488, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 488, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0489:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 489, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 488, __pyx_L1_error)
        }
      }
      #endif

     0490:

    +0491:     assert color_ > 0, "Argument color_number must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_color_ > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_color_number_must_be_0);
          __PYX_ERR(1, 491, __pyx_L1_error)
        }
      }
      #endif

     0492:

    +0493:     shader_color_reduction24_inplace_c(pixels3d(surface_), color_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 493, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 493, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__pyx_t_5, __pyx_v_color_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0494:

     0495:

    +0496: cpdef inline void sobel(

    static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel *__pyx_optional_args) {
      int __pyx_v_threshold_ = ((int)64);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold_ = __pyx_optional_args->threshold_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_16sobel[] = "\n    SHADER SOBEL (EDGE DETECTION)\n\n    Transform the game display or a pygame surface into a sobel equivalent model\n    (surface edge detection)\n\n    The surface is compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    sobel(surface, 64)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param threshold_: integer; Value for detecting the edges default 64\n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_17sobel(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_threshold_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sobel") < 0)) __PYX_ERR(1, 496, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 498, __pyx_L3_error)
        } else {
          __pyx_v_threshold_ = ((int)64);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("sobel", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 496, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_16sobel(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_16sobel(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.threshold_ = __pyx_v_threshold_;
      __pyx_f_12PygameShader_6shader_sobel(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.sobel", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0497:         object surface_,

     0498:         int threshold_ = 64

     0499: ):

     0500:     """

     0501:     SHADER SOBEL (EDGE DETECTION)

     0502:

     0503:     Transform the game display or a pygame surface into a sobel equivalent model

     0504:     (surface edge detection)

     0505:

     0506:     The surface is compatible 24 - 32 bit with or without alpha layer

     0507:

     0508:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0509:       new surface.

     0510:

     0511:     e.g:

     0512:     sobel(surface, 64)

     0513:

     0514:     :param surface_: pygame.Surface; compatible 24 - 32 bit

     0515:     :param threshold_: integer; Value for detecting the edges default 64

     0516:     :return:

     0517:     """

    +0518:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 518, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 518, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0519:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 518, __pyx_L1_error)
        }
      }
      #endif

     0520:

    +0521:     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1L < __pyx_v_threshold_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_threshold_ < 0x100);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_an_i);
          __PYX_ERR(1, 521, __pyx_L1_error)
        }
      }
      #endif

     0522:

    +0523:     shader_sobel24_inplace_c(pixels3d(surface_), threshold_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 523, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.threshold = __pyx_v_threshold_;
      __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0524:

     0525:

    +0526: cpdef inline void sobel_fast(

    static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sobel_fast(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_sobel_fast *__pyx_optional_args) {
      int __pyx_v_threshold_ = ((int)64);
      unsigned short __pyx_v_factor_ = ((unsigned short)1);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel_fast", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold_ = __pyx_optional_args->threshold_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_factor_ = __pyx_optional_args->factor_;
          }
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_18sobel_fast[] = "\n    SHADER FAST SOBEL (EDGE DETECTION)\n\n    Transform the game display or a pygame surface into a sobel equivalent model\n    (surface edge detection).This version is slightly fastest than shader_sobel24_inplace_c as\n    it down-scale the array containing all the pixels and apply the sobel algorithm to a smaller\n    sample. When the processing is done, the array is re-scale to its original dimensions.\n    If this method is in theory faster than shader_sobel24_inplace_c, down-scaling and up-scaling\n    an array does have a side effect of decreasing the overall image definition\n    (jagged lines non-antialiasing)\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    sobel_fast(surface, 64, factor_=1)\n\n    :param surface_: pygame.surface compatible 24-32 bit \n    :param threshold_: integer; default value is 24 \n    :param factor_: integer; default value is 1 (div by 2)\n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_19sobel_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_threshold_;
      unsigned short __pyx_v_factor_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel_fast (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,&__pyx_n_s_factor,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sobel_fast") < 0)) __PYX_ERR(1, 526, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 528, __pyx_L3_error)
        } else {
          __pyx_v_threshold_ = ((int)64);
        }
        if (values[2]) {
          __pyx_v_factor_ = __Pyx_PyInt_As_unsigned_short(values[2]); if (unlikely((__pyx_v_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 529, __pyx_L3_error)
        } else {
          __pyx_v_factor_ = ((unsigned short)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("sobel_fast", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 526, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_18sobel_fast(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_, __pyx_v_factor_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_18sobel_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, unsigned short __pyx_v_factor_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sobel_fast", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 2;
      __pyx_t_1.threshold_ = __pyx_v_threshold_;
      __pyx_t_1.factor_ = __pyx_v_factor_;
      __pyx_f_12PygameShader_6shader_sobel_fast(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.sobel_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0527:         object surface_,

     0528:         int threshold_ = 64,

     0529:         unsigned short factor_ = 1

     0530: ):

     0531:     """

     0532:     SHADER FAST SOBEL (EDGE DETECTION)

     0533:

     0534:     Transform the game display or a pygame surface into a sobel equivalent model

     0535:     (surface edge detection).This version is slightly fastest than shader_sobel24_inplace_c as

     0536:     it down-scale the array containing all the pixels and apply the sobel algorithm to a smaller

     0537:     sample. When the processing is done, the array is re-scale to its original dimensions.

     0538:     If this method is in theory faster than shader_sobel24_inplace_c, down-scaling and up-scaling

     0539:     an array does have a side effect of decreasing the overall image definition

     0540:     (jagged lines non-antialiasing)

     0541:

     0542:     Compatible 24 - 32 bit with or without alpha layer

     0543:

     0544:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0545:       new surface.

     0546:

     0547:     e.g:

     0548:     sobel_fast(surface, 64, factor_=1)

     0549:

     0550:     :param surface_: pygame.surface compatible 24-32 bit

     0551:     :param threshold_: integer; default value is 24

     0552:     :param factor_: integer; default value is 1 (div by 2)

     0553:     :return:

     0554:     """

    +0555:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 555, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0556:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 556, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 555, __pyx_L1_error)
        }
      }
      #endif

     0557:

    +0558:     assert -1 < threshold_ < 256, "\nArgument threshold must be an integer in range [0 ... 255]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1L < __pyx_v_threshold_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_threshold_ < 0x100);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_an_i);
          __PYX_ERR(1, 558, __pyx_L1_error)
        }
      }
      #endif

    +0559:     assert 0 < factor_ < 9, "\nArgument factor_ must be in range [1 ... 8]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (0 < __pyx_v_factor_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_factor_ < 9);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_in_ran);
          __PYX_ERR(1, 559, __pyx_L1_error)
        }
      }
      #endif

     0560:

    +0561:     shader_sobel24_fast_inplace_c(surface_, threshold_, factor_)

      __pyx_t_4.__pyx_n = 2;
      __pyx_t_4.threshold_ = __pyx_v_threshold_;
      __pyx_t_4.factor_ = __pyx_v_factor_;
      __pyx_f_12PygameShader_6shader_shader_sobel24_fast_inplace_c(__pyx_v_surface_, &__pyx_t_4);

     0562:

     0563:

     0564:

     0565:

    +0566: cpdef inline void invert(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_invert(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("invert", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.invert", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_20invert[] = "\n    SHADER INVERT PIXELS\n    \n    Invert all pixels of the display or a given texture\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n    \n    e.g:\n    invert(surface)\n    \n    :param surface_: pygame.surface; compatible 24 - 32 bit surfaces\n    :return: void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_21invert(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("invert (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_20invert(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_20invert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("invert", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_invert(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.invert", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0567:     """

     0568:     SHADER INVERT PIXELS

     0569:

     0570:     Invert all pixels of the display or a given texture

     0571:

     0572:     Compatible 24 - 32 bit with or without alpha layer

     0573:

     0574:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0575:       new surface.

     0576:

     0577:     e.g:

     0578:     invert(surface)

     0579:

     0580:     :param surface_: pygame.surface; compatible 24 - 32 bit surfaces

     0581:     :return: void

     0582:     """

    +0583:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 583, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 583, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0584:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 584, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 583, __pyx_L1_error)
        }
      }
      #endif

     0585:

    +0586:     shader_invert_surface_24bit_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 586, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_invert_surface_24bit_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0587:

     0588:

     0589:

    +0590: cpdef inline void hsl_effect(object surface_, float shift_):

    static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_effect(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_effect", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_22hsl_effect[] = "\n    ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    hsl_effect(surface, 0.2)\n    \n    :param surface_: pygame.Surface; Compatible 24 - 32 bit surfaces\n    :param shift_: float; float value in range [-1.0 ... 1.0]\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_23hsl_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_effect (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("hsl_effect", 1, 2, 2, 1); __PYX_ERR(1, 590, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hsl_effect") < 0)) __PYX_ERR(1, 590, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 590, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("hsl_effect", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 590, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_22hsl_effect(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_22hsl_effect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_effect", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_hsl_effect(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.hsl_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0591:     """

     0592:     ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE

     0593:

     0594:     Compatible 24 - 32 bit with or without alpha layer

     0595:

     0596:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0597:       new surface.

     0598:

     0599:     e.g:

     0600:     hsl_effect(surface, 0.2)

     0601:

     0602:     :param surface_: pygame.Surface; Compatible 24 - 32 bit surfaces

     0603:     :param shift_: float; float value in range [-1.0 ... 1.0]

     0604:     :return: void

     0605:     """

    +0606:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 606, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 606, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0607:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 607, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 606, __pyx_L1_error)
        }
      }
      #endif

     0608:

    +0609:     assert -1.0 <= shift_ <= 1.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
          __PYX_ERR(1, 609, __pyx_L1_error)
        }
      }
      #endif

     0610:         "Argument shift must be in range[-1.0 ... 1.0]"

     0611:

    +0612:     shader_hsl_surface24bit_inplace_c(pixels3d(surface_), shift_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 612, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_inplace_c(__pyx_t_5, __pyx_v_shift_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0613:

     0614:

     0615: # todo wiki

    +0616: cpdef inline void hsl_fast(

    static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_hsl_fast(PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_fast", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_24hsl_fast[] = "    \n    ROTATE THE HUE OF AN IMAGE USING STORED HSL TO RGB AND RGB TO HSL VALUES\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    rgb2hsl_model = hsl_to_rgb_model()\n    hsl2rgb_model = rgb_to_hsl_model()\n    hsl_fast(\n                image,\n                0.1,\n                hsl_model_=hsl2rgb_model,\n                rgb_model_=rgb2hsl_model)\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces\n    :param shift_: float; value must be in range [ -1.0 ... + 1.0]\n    :param hsl_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see hsl_to_rgb_model function \n    :param rgb_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see rgb_to_hsl_model function\n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_25hsl_fast(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      __Pyx_memviewslice __pyx_v_hsl_model_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_rgb_model_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_fast (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_hsl_model,&__pyx_n_s_rgb_model,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 1); __PYX_ERR(1, 616, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hsl_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 2); __PYX_ERR(1, 616, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, 3); __PYX_ERR(1, 616, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hsl_fast") < 0)) __PYX_ERR(1, 616, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 618, __pyx_L3_error)
        __pyx_v_hsl_model_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_hsl_model_.memview)) __PYX_ERR(1, 619, __pyx_L3_error)
        __pyx_v_rgb_model_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rgb_model_.memview)) __PYX_ERR(1, 620, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("hsl_fast", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 616, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_24hsl_fast(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_24hsl_fast(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_fast", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_hsl_model_.memview)) { __Pyx_RaiseUnboundLocalError("hsl_model_"); __PYX_ERR(1, 616, __pyx_L1_error) }
      if (unlikely(!__pyx_v_rgb_model_.memview)) { __Pyx_RaiseUnboundLocalError("rgb_model_"); __PYX_ERR(1, 616, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_hsl_fast(__pyx_v_surface_, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.hsl_fast", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_hsl_model_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_model_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0617:         object surface_,

     0618:         float shift_,

     0619:         float [:, :, :, ::1] hsl_model_,

     0620:         unsigned char [:, :, :, ::1] rgb_model_

     0621: ):

     0622:     """

     0623:     ROTATE THE HUE OF AN IMAGE USING STORED HSL TO RGB AND RGB TO HSL VALUES

     0624:

     0625:     Compatible 24 - 32 bit with or without alpha layer

     0626:

     0627:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0628:       new surface.

     0629:

     0630:     e.g:

     0631:     rgb2hsl_model = hsl_to_rgb_model()

     0632:     hsl2rgb_model = rgb_to_hsl_model()

     0633:     hsl_fast(

     0634:                 image,

     0635:                 0.1,

     0636:                 hsl_model_=hsl2rgb_model,

     0637:                 rgb_model_=rgb2hsl_model)

     0638:

     0639:     :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces

     0640:     :param shift_: float; value must be in range [ -1.0 ... + 1.0]

     0641:     :param hsl_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see hsl_to_rgb_model function

     0642:     :param rgb_model_: 3d numpy.ndarray shape (256, 256, 256, 3) see rgb_to_hsl_model function

     0643:     :return:

     0644:     """

    +0645:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 645, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 645, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0646:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 646, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 645, __pyx_L1_error)
        }
      }
      #endif

    +0647:     assert -1.0 <= shift_ <= 1.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
          __PYX_ERR(1, 647, __pyx_L1_error)
        }
      }
      #endif

     0648:         "Argument shift must be in range[-1.0 ... 1.0]"

    +0649:     assert PyObject_IsInstance(hsl_model_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_hsl_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 649, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 649, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 649, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 649, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0650:         "\nArgument hsl_model_ must be a numpy.ndarray or memoryview type, got %s " % type(

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_hsl_model__must_be_a_n, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 650, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 649, __pyx_L1_error)
        }
      }
      #endif

    +0651:             hsl_model_)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_hsl_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 651, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);

    +0652:     assert PyObject_IsInstance(rgb_model_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rgb_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 652, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 652, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0653:         "\nArgument rgb_model_ must be a numpy.ndarray or memoryview type, got %s " % type(

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_rgb_model__must_be_a_n, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 652, __pyx_L1_error)
        }
      }
      #endif

    +0654:             rgb_model_)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_model_, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 654, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);

     0655:

    +0656:     shader_hsl_surface24bit_fast_inplace_c(pixels3d(surface_), shift_, hsl_model_, rgb_model_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 656, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 656, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_fast_inplace_c(__pyx_t_5, __pyx_v_shift_, __pyx_v_hsl_model_, __pyx_v_rgb_model_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0657:

     0658:

    +0659: cpdef inline void blur(object surface_, t_=1):

    static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_blur(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blur *__pyx_optional_args) {
      PyObject *__pyx_v_t_ = ((PyObject *)__pyx_int_1);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blur", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_t_ = __pyx_optional_args->t_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_26blur[] = "\n    APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)\n\n    # Gaussian kernel 5x5\n        # |1   4   6   4  1|\n        # |4  16  24  16  4|\n        # |6  24  36  24  6|  x 1/256\n        # |4  16  24  16  4|\n        # |1  4    6   4  1|\n    This method is using convolution property and process the image in two passes,\n    first the horizontal convolution and last the vertical convolution\n    pixels convoluted outside image edges will be set to adjacent edge value\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces\n    :param t_      : integer; number if times must be >0\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_27blur(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      PyObject *__pyx_v_t_ = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blur (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_t,0};
        PyObject* values[2] = {0,0};
        values[1] = ((PyObject *)__pyx_int_1);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blur") < 0)) __PYX_ERR(1, 659, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_t_ = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("blur", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 659, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_26blur(__pyx_self, __pyx_v_surface_, __pyx_v_t_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_26blur(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_t_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blur", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.t_ = __pyx_v_t_;
      __pyx_f_12PygameShader_6shader_blur(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.blur", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0660:     """

     0661:     APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)

     0662:

     0663:     # Gaussian kernel 5x5

     0664:         # |1   4   6   4  1|

     0665:         # |4  16  24  16  4|

     0666:         # |6  24  36  24  6|  x 1/256

     0667:         # |4  16  24  16  4|

     0668:         # |1  4    6   4  1|

     0669:     This method is using convolution property and process the image in two passes,

     0670:     first the horizontal convolution and last the vertical convolution

     0671:     pixels convoluted outside image edges will be set to adjacent edge value

     0672:

     0673:     Compatible 24 - 32 bit with or without alpha layer

     0674:

     0675:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0676:       new surface.

     0677:

     0678:     :param surface_: pygame.Surface; compatible 24 - 32 bit surfaces

     0679:     :param t_      : integer; number if times must be >0

     0680:     :return: void

     0681:     """

    +0682:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 682, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0683:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 683, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 682, __pyx_L1_error)
        }
      }
      #endif

    +0684:     assert t_ > 0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_t_, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 684, __pyx_L1_error)
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 684, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_3)) {

    +0685:         "\nArgument t_ must be > 0, got %s " % t_

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_t__must_be_0_got_s, __pyx_v_t_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 685, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 684, __pyx_L1_error)
        }
      }
      #endif

     0686:

    +0687:     shader_blur5x5_array24_inplace_c(pixels3d(surface_), None, t_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 687, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 687, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 2;
      __pyx_t_6.mask = Py_None;
      __pyx_t_6.t = __pyx_v_t_;
      __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0688:

     0689:

    +0690: cpdef inline void wave(object surface_, float rad, int size):

    static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_wave(PyObject *__pyx_v_surface_, float __pyx_v_rad, int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wave", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_28wave[] = "\n    CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    wave(surface, 8 * math.pi/180.0 + frame_number, 5)\n    \n    :param surface_: pygame.Surface; pygame surface compatible 24 - 32 bit  \n    :param rad     : float; angle in rad to rotate over time\n    :param size    : int; Number of sub-surfaces\n    :return        : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_29wave(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_rad;
      int __pyx_v_size;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wave (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rad,&__pyx_n_s_size,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rad)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, 1); __PYX_ERR(1, 690, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, 2); __PYX_ERR(1, 690, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wave") < 0)) __PYX_ERR(1, 690, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_rad = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_rad == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 690, __pyx_L3_error)
        __pyx_v_size = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 690, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("wave", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 690, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_28wave(__pyx_self, __pyx_v_surface_, __pyx_v_rad, __pyx_v_size);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_28wave(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad, int __pyx_v_size) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("wave", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_wave(__pyx_v_surface_, __pyx_v_rad, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.wave", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0691:     """

     0692:     CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE

     0693:

     0694:     Compatible 24 - 32 bit with or without alpha layer

     0695:

     0696:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0697:       new surface.

     0698:

     0699:     e.g:

     0700:     wave(surface, 8 * math.pi/180.0 + frame_number, 5)

     0701:

     0702:     :param surface_: pygame.Surface; pygame surface compatible 24 - 32 bit

     0703:     :param rad     : float; angle in rad to rotate over time

     0704:     :param size    : int; Number of sub-surfaces

     0705:     :return        : void

     0706:     """

    +0707:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 707, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 707, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 707, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0708:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 708, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 707, __pyx_L1_error)
        }
      }
      #endif

    +0709:     assert size > 0, "Argument size must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_size > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_size_must_be_0);
          __PYX_ERR(1, 709, __pyx_L1_error)
        }
      }
      #endif

     0710:

    +0711:     shader_wave24bit_inplace_c(pixels3d(surface_), rad, size)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 711, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_wave24bit_inplace_c(__pyx_t_5, __pyx_v_rad, __pyx_v_size);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0712:

     0713:

    +0714: cpdef inline void swirl(object surface_, float degrees):

    static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl(PyObject *__pyx_v_surface_, float __pyx_v_degrees, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_30swirl[] = "\n    SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)\n\n    This algorithm uses a table of cos and sin.\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    swirl(surface, 1.0)\n    \n    :param surface_: pygame.Surface, compatible 24 - 32 bit \n    :param degrees : float; angle in degrees \n    :return        : void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_31swirl(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_degrees;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_degrees,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_degrees)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("swirl", 1, 2, 2, 1); __PYX_ERR(1, 714, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "swirl") < 0)) __PYX_ERR(1, 714, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_degrees = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_degrees == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 714, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("swirl", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 714, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_30swirl(__pyx_self, __pyx_v_surface_, __pyx_v_degrees);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_30swirl(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_swirl(__pyx_v_surface_, __pyx_v_degrees, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 714, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.swirl", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0715:     """

     0716:     SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)

     0717:

     0718:     This algorithm uses a table of cos and sin.

     0719:

     0720:     Compatible 24 - 32 bit with or without alpha layer

     0721:

     0722:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0723:       new surface.

     0724:

     0725:     e.g:

     0726:     swirl(surface, 1.0)

     0727:

     0728:     :param surface_: pygame.Surface, compatible 24 - 32 bit

     0729:     :param degrees : float; angle in degrees

     0730:     :return        : void

     0731:     """

    +0732:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 732, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0733:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 733, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 732, __pyx_L1_error)
        }
      }
      #endif

     0734:

    +0735:     shader_swirl24bit_inplace_c(pixels3d(surface_), degrees)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 735, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 735, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 735, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c(__pyx_t_5, __pyx_v_degrees);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0736:

     0737:

     0738:

    +0739: cpdef inline void swirl2(object surface_, float degrees):

    static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_swirl2(PyObject *__pyx_v_surface_, float __pyx_v_degrees, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl2", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_32swirl2[] = "\n    SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    swirl(surface_, frame_number)\n    \n    :param surface_: pygame.Surface, compatible 24 - 32 bit \n    :param degrees : float; angle in degrees\n    :return        : void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_33swirl2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_degrees;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl2 (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_degrees,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_degrees)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("swirl2", 1, 2, 2, 1); __PYX_ERR(1, 739, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "swirl2") < 0)) __PYX_ERR(1, 739, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_degrees = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_degrees == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 739, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("swirl2", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 739, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_32swirl2(__pyx_self, __pyx_v_surface_, __pyx_v_degrees);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_32swirl2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_degrees) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("swirl2", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_swirl2(__pyx_v_surface_, __pyx_v_degrees, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.swirl2", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0740:     """

     0741:     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION

     0742:

     0743:     Compatible 24 - 32 bit with or without alpha layer

     0744:

     0745:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0746:       new surface.

     0747:

     0748:     e.g:

     0749:     swirl(surface_, frame_number)

     0750:

     0751:     :param surface_: pygame.Surface, compatible 24 - 32 bit

     0752:     :param degrees : float; angle in degrees

     0753:     :return        : void

     0754:     """

    +0755:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 755, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 755, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 755, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0756:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 756, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 755, __pyx_L1_error)
        }
      }
      #endif

     0757:

    +0758:     shader_swirl24bit_inplace_c1(pixels3d(surface_), degrees)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 758, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 758, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c1(__pyx_t_5, __pyx_v_degrees);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0759:

     0760:

     0761:

    +0762: cpdef inline void plasma_config(

    static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma_config(PyObject *__pyx_v_surface_, int __pyx_v_frame, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_plasma_config *__pyx_optional_args) {
      float __pyx_v_hue_ = __pyx_k__3;
      float __pyx_v_sat_ = __pyx_k__4;
      float __pyx_v_value_ = __pyx_k__5;
      float __pyx_v_a_ = __pyx_k__6;
      float __pyx_v_b_ = __pyx_k__7;
      float __pyx_v_c_ = __pyx_k__8;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma_config", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_hue_ = __pyx_optional_args->hue_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_sat_ = __pyx_optional_args->sat_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_value_ = __pyx_optional_args->value_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_a_ = __pyx_optional_args->a_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_b_ = __pyx_optional_args->b_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_c_ = __pyx_optional_args->c_;
                  }
                }
              }
            }
          }
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_34plasma_config[] = "\n\n    CREATE A BASIC PLASMA EFFECT ON THE TOP OF A PYGAME SURFACE\n\n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n\n    e.g:\n    plasma_config(surface, frame_number)\n\n    :param a_           : float; default value 1.0/255.0 control the plasma equation\n    :param b_           : float; default value 1.0/12.0 control the plasma equation\n    :param c_           : float; default value 1.0/12.0 control the plasma equation\n    :param value_       : float; default value 1.0/8.0 value factor\n    :param sat_         : float; default value 1.0/6.0 saturation value\n    :param hue_         : float; default value 1.0/6.0 hue value factor\n    :param surface_     : pygame.surface; compatible 24 - 32 bit\n    :param frame        : integer; Variable that need to change over time\n    :return             : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_35plasma_config(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_frame;
      float __pyx_v_hue_;
      float __pyx_v_sat_;
      float __pyx_v_value_;
      float __pyx_v_a_;
      float __pyx_v_b_;
      float __pyx_v_c_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma_config (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame,&__pyx_n_s_hue,&__pyx_n_s_sat,&__pyx_n_s_value,&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_c,0};
        PyObject* values[8] = {0,0,0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("plasma_config", 0, 2, 8, 1); __PYX_ERR(1, 762, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hue);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sat);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b);
              if (value) { values[6] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c);
              if (value) { values[7] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plasma_config") < 0)) __PYX_ERR(1, 762, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_frame = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_frame == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L3_error)
        if (values[2]) {
          __pyx_v_hue_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_hue_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 765, __pyx_L3_error)
        } else {
          __pyx_v_hue_ = __pyx_k__3;
        }
        if (values[3]) {
          __pyx_v_sat_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_sat_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 766, __pyx_L3_error)
        } else {
          __pyx_v_sat_ = __pyx_k__4;
        }
        if (values[4]) {
          __pyx_v_value_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_value_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 767, __pyx_L3_error)
        } else {
          __pyx_v_value_ = __pyx_k__5;
        }
        if (values[5]) {
          __pyx_v_a_ = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_a_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 768, __pyx_L3_error)
        } else {
          __pyx_v_a_ = __pyx_k__6;
        }
        if (values[6]) {
          __pyx_v_b_ = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_b_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 769, __pyx_L3_error)
        } else {
          __pyx_v_b_ = __pyx_k__7;
        }
        if (values[7]) {
          __pyx_v_c_ = __pyx_PyFloat_AsFloat(values[7]); if (unlikely((__pyx_v_c_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 770, __pyx_L3_error)
        } else {
          __pyx_v_c_ = __pyx_k__8;
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("plasma_config", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 762, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_34plasma_config(__pyx_self, __pyx_v_surface_, __pyx_v_frame, __pyx_v_hue_, __pyx_v_sat_, __pyx_v_value_, __pyx_v_a_, __pyx_v_b_, __pyx_v_c_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_34plasma_config(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame, float __pyx_v_hue_, float __pyx_v_sat_, float __pyx_v_value_, float __pyx_v_a_, float __pyx_v_b_, float __pyx_v_c_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma_config", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 6;
      __pyx_t_1.hue_ = __pyx_v_hue_;
      __pyx_t_1.sat_ = __pyx_v_sat_;
      __pyx_t_1.value_ = __pyx_v_value_;
      __pyx_t_1.a_ = __pyx_v_a_;
      __pyx_t_1.b_ = __pyx_v_b_;
      __pyx_t_1.c_ = __pyx_v_c_;
      __pyx_f_12PygameShader_6shader_plasma_config(__pyx_v_surface_, __pyx_v_frame, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 762, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.plasma_config", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0763:         object surface_,

     0764:         int frame,

    +0765:         float hue_=1.0/6.0,

      __pyx_k__3 = (1.0 / 6.0);
    /* … */
      __pyx_k__3 = (1.0 / 6.0);

    +0766:         float sat_=1.0/6.0,

      __pyx_k__4 = (1.0 / 6.0);
    /* … */
      __pyx_k__4 = (1.0 / 6.0);

    +0767:         float value_=1.0/8.0,

      __pyx_k__5 = (1.0 / 8.0);
    /* … */
      __pyx_k__5 = (1.0 / 8.0);

    +0768:         float a_=1.0/255.0,

      __pyx_k__6 = (1.0 / 255.0);
    /* … */
      __pyx_k__6 = (1.0 / 255.0);

    +0769:         float b_=1.0/12.0,

      __pyx_k__7 = (1.0 / 12.0);
    /* … */
      __pyx_k__7 = (1.0 / 12.0);

    +0770:         float c_=1.0/12.0

      __pyx_k__8 = (1.0 / 12.0);
    /* … */
      __pyx_k__8 = (1.0 / 12.0);

     0771: ):

     0772:     """

     0773:

     0774:     CREATE A BASIC PLASMA EFFECT ON THE TOP OF A PYGAME SURFACE

     0775:

     0776:     Compatible 24 - 32 bit with or without alpha layer

     0777:

     0778:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0779:       new surface.

     0780:

     0781:     e.g:

     0782:     plasma_config(surface, frame_number)

     0783:

     0784:     :param a_           : float; default value 1.0/255.0 control the plasma equation

     0785:     :param b_           : float; default value 1.0/12.0 control the plasma equation

     0786:     :param c_           : float; default value 1.0/12.0 control the plasma equation

     0787:     :param value_       : float; default value 1.0/8.0 value factor

     0788:     :param sat_         : float; default value 1.0/6.0 saturation value

     0789:     :param hue_         : float; default value 1.0/6.0 hue value factor

     0790:     :param surface_     : pygame.surface; compatible 24 - 32 bit

     0791:     :param frame        : integer; Variable that need to change over time

     0792:     :return             : void

     0793:     """

    +0794:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 794, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0795:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 795, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 794, __pyx_L1_error)
        }
      }
      #endif

     0796:

    +0797:     shader_plasma24bit_inplace_c(pixels3d(surface_), frame, hue_, sat_, value_, a_, b_, c_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 797, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 797, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 6;
      __pyx_t_6.hue_ = __pyx_v_hue_;
      __pyx_t_6.sat_ = __pyx_v_sat_;
      __pyx_t_6.value_ = __pyx_v_value_;
      __pyx_t_6.a_ = __pyx_v_a_;
      __pyx_t_6.b_ = __pyx_v_b_;
      __pyx_t_6.c_ = __pyx_v_c_;
      __pyx_f_12PygameShader_6shader_shader_plasma24bit_inplace_c(__pyx_t_5, __pyx_v_frame, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0798:

     0799:

    +0800: cpdef inline void plasma(surface_, float frame, unsigned int [::1] palette_):

    static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_plasma(PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_36plasma[] = "\n    CREATE A PLASMA EFFECT INPLACE\n\n    e.g:\n    plasma(surface, frame_number, palette_)\n    \n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param frame   : float; frame number\n    :param palette_: 1d array containing colors\n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_37plasma(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_frame;
      __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame,&__pyx_n_s_palette,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, 1); __PYX_ERR(1, 800, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, 2); __PYX_ERR(1, 800, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plasma") < 0)) __PYX_ERR(1, 800, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_frame = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_frame == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 800, __pyx_L3_error)
        __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 800, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("plasma", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 800, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_36plasma(__pyx_self, __pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_36plasma(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("plasma", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 800, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_plasma(__pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 800, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.plasma", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0801:     """

     0802:     CREATE A PLASMA EFFECT INPLACE

     0803:

     0804:     e.g:

     0805:     plasma(surface, frame_number, palette_)

     0806:

     0807:     :param surface_: pygame.Surface; compatible 24 - 32 bit

     0808:     :param frame   : float; frame number

     0809:     :param palette_: 1d array containing colors

     0810:     :return:

     0811:     """

    +0812:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 812, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 812, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 812, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0813:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 813, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 812, __pyx_L1_error)
        }
      }
      #endif

    +0814:     shader_plasma_c(surface_, frame, palette_)

      __pyx_f_12PygameShader_6shader_shader_plasma_c(__pyx_v_surface_, __pyx_v_frame, __pyx_v_palette_);

     0815:

     0816:

     0817: # todo wiki

    +0818: cpdef inline float [:, :, :, ::1] rgb_to_hsl_model():

    static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model(CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_hsl_model", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __pyx_r.data = NULL;
      __pyx_r.memview = NULL;
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      goto __pyx_L2;
      __pyx_L0:;
      if (unlikely(!__pyx_r.memview)) {
        PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
      }
      __pyx_L2:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_38rgb_to_hsl_model[] = "\n    Create an HSL model containing all the values\n    :return: Return a cython.view.memoryview shape (256, 256, 256, 3)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_39rgb_to_hsl_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_hsl_model (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_38rgb_to_hsl_model(__pyx_self);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_38rgb_to_hsl_model(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_hsl_model", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_to_hsl_model(0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 818, __pyx_L1_error)
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 818, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0819:     """

     0820:     Create an HSL model containing all the values

     0821:     :return: Return a cython.view.memoryview shape (256, 256, 256, 3)

     0822:     """

    +0823:     return rgb_to_hsl_model_c()

      __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_to_hsl_model_c(); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 823, __pyx_L1_error)
      __pyx_r = __pyx_t_1;
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;
      goto __pyx_L0;

     0824:

     0825:

     0826: # todo wiki

    +0827: cpdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model():

    static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model(CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_to_rgb_model", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __pyx_r.data = NULL;
      __pyx_r.memview = NULL;
      __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      goto __pyx_L2;
      __pyx_L0:;
      if (unlikely(!__pyx_r.memview)) {
        PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
      }
      __pyx_L2:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_40hsl_to_rgb_model[] = "\n    Create an RGB model containing all the values\n    :return: Return a cython.view.memoryview shape (256, 256, 256, 3)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_41hsl_to_rgb_model(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_to_rgb_model (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_40hsl_to_rgb_model(__pyx_self);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_40hsl_to_rgb_model(CYTHON_UNUSED PyObject *__pyx_self) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_to_rgb_model", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_hsl_to_rgb_model(0); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 827, __pyx_L1_error)
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0828:     """

     0829:     Create an RGB model containing all the values

     0830:     :return: Return a cython.view.memoryview shape (256, 256, 256, 3)

     0831:     """

    +0832:     return hsl_to_rgb_model_c()

      __pyx_t_1 = __pyx_f_12PygameShader_6shader_hsl_to_rgb_model_c(); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(1, 832, __pyx_L1_error)
      __pyx_r = __pyx_t_1;
      __pyx_t_1.memview = NULL;
      __pyx_t_1.data = NULL;
      goto __pyx_L0;

     0833:

     0834:

     0835:

    +0836: cpdef inline void brightness(object surface_, float shift_):

    static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_42brightness[] = "\n    SHADER BRIGHTNESS\n\n    This shader control the pygame display brightness level\n    It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb\n    \n    Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the \n    maximum brightness. A value of 0.0 will not perform any changes to the original \n    surface\n    \n    Compatible 24 - 32 bit with or without alpha layer\n    \n    * The changes are automatically applied inplace to the surface, you do not need to create a \n      new surface.  \n      \n    e.g:\n    brightness(surface, 0.2)\n    \n    :param surface_ : pygame.surface; \n    :param shift_   : float must be in range [ -1.0 ... 1.0 ]\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_43brightness(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("brightness", 1, 2, 2, 1); __PYX_ERR(1, 836, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness") < 0)) __PYX_ERR(1, 836, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 836, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("brightness", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 836, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_42brightness(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_42brightness(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_brightness(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 836, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.brightness", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0837:     """

     0838:     SHADER BRIGHTNESS

     0839:

     0840:     This shader control the pygame display brightness level

     0841:     It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb

     0842:

     0843:     Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the

     0844:     maximum brightness. A value of 0.0 will not perform any changes to the original

     0845:     surface

     0846:

     0847:     Compatible 24 - 32 bit with or without alpha layer

     0848:

     0849:     * The changes are automatically applied inplace to the surface, you do not need to create a

     0850:       new surface.

     0851:

     0852:     e.g:

     0853:     brightness(surface, 0.2)

     0854:

     0855:     :param surface_ : pygame.surface;

     0856:     :param shift_   : float must be in range [ -1.0 ... 1.0 ]

     0857:     :return         : void

     0858:     """

    +0859:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 859, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0860:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 860, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 859, __pyx_L1_error)
        }
      }
      #endif

     0861:

    +0862:     if shift_ == 0.0:

      __pyx_t_3 = ((__pyx_v_shift_ == 0.0) != 0);
      if (__pyx_t_3) {
    /* … */
      }

    +0863:         return

        goto __pyx_L0;

     0864:

    +0865:     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
          __PYX_ERR(1, 865, __pyx_L1_error)
        }
      }
      #endif

     0866:

    +0867:     shader_brightness24_inplace_c(pixels3d(surface_), shift_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 867, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 867, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 867, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.shift_ = __pyx_v_shift_;
      __pyx_f_12PygameShader_6shader_shader_brightness24_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0868:

     0869:

    +0870: cpdef inline void brightness_exclude(

    static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_exclude(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_exclude *__pyx_optional_args) {
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_44brightness_exclude[] = "\n\n    INCREASE/DECREASE A SURFACE BRIGHTNESS (OPTIONAL EXCLUDE COLOR)\n    \n    The optional setting (color_) allow you to select a color that will not \n    be included in the processing. This can be useful if you know the background \n    color RGB values and do not wish the background to undergo a change in brightness    \n    \n    Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the \n    maximum brightness. A value of 0.0 will not perform any changes to the original \n    surface\n   \n    Parameter color_ is a tuple of RGB colors e.g (1, 1, 1) \n\n    :param surface_ : pygame.surface; \n    :param shift_   : float must be in range [ -1.0 ... 1.0 ]\n    :param color_   : tuple RGB to be excluded from the process\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_45brightness_exclude(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      PyObject *__pyx_v_color_ = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_exclude (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_color,0};
        PyObject* values[3] = {0,0,0};
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_44brightness_exclude(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, PyObject *__pyx_v_color_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_exclude", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.color_ = __pyx_v_color_;
      __pyx_f_12PygameShader_6shader_brightness_exclude(__pyx_v_surface_, __pyx_v_shift_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 870, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0871:         object surface_,

     0872:         float shift_,

    +0873:         color_=(0, 0, 0)

      PyObject *__pyx_v_color_ = ((PyObject *)__pyx_tuple__9);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_exclude", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_color_ = __pyx_optional_args->color_;
        }
      }
    /* … */
        values[2] = ((PyObject *)__pyx_tuple__9);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("brightness_exclude", 0, 2, 3, 1); __PYX_ERR(1, 870, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_exclude") < 0)) __PYX_ERR(1, 870, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 872, __pyx_L3_error)
        __pyx_v_color_ = values[2];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("brightness_exclude", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 870, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.brightness_exclude", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_44brightness_exclude(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_color_);
    /* … */
      __pyx_tuple__9 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 873, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__9);
      __Pyx_GIVEREF(__pyx_tuple__9);

     0874: ):

     0875:     """

     0876:

     0877:     INCREASE/DECREASE A SURFACE BRIGHTNESS (OPTIONAL EXCLUDE COLOR)

     0878:

     0879:     The optional setting (color_) allow you to select a color that will not

     0880:     be included in the processing. This can be useful if you know the background

     0881:     color RGB values and do not wish the background to undergo a change in brightness

     0882:

     0883:     Parameter shift_ is a float value in range [ -1.0 ... 1.0]. with +1.0 for the

     0884:     maximum brightness. A value of 0.0 will not perform any changes to the original

     0885:     surface

     0886:

     0887:     Parameter color_ is a tuple of RGB colors e.g (1, 1, 1)

     0888:

     0889:     :param surface_ : pygame.surface;

     0890:     :param shift_   : float must be in range [ -1.0 ... 1.0 ]

     0891:     :param color_   : tuple RGB to be excluded from the process

     0892:     :return         : void

     0893:     """

    +0894:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 894, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0895:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 895, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 894, __pyx_L1_error)
        }
      }
      #endif

     0896:

    +0897:     if shift_ == 0.0:

      __pyx_t_3 = ((__pyx_v_shift_ == 0.0) != 0);
      if (__pyx_t_3) {
    /* … */
      }

    +0898:         return

        goto __pyx_L0;

     0899:

    +0900:     assert -1.0 <= shift_ <= 1.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_range);
          __PYX_ERR(1, 900, __pyx_L1_error)
        }
      }
      #endif

     0901:         "Argument shift_ must be in range[-1.0 ... 1.0]"

     0902:

    +0903:     shader_brightness24_exclude_inplace_c(pixels3d(surface_), shift_, color_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 903, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 903, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 2;
      __pyx_t_6.shift_ = __pyx_v_shift_;
      __pyx_t_6.color_ = __pyx_v_color_;
      __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0904:

     0905:

     0906:

    +0907: cpdef inline void brightness_bpf(

    static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_bpf(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_brightness_bpf *__pyx_optional_args) {
      unsigned char __pyx_v_bpf_threshold = ((unsigned char)64);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_bpf", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_bpf_threshold = __pyx_optional_args->bpf_threshold;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_46brightness_bpf[] = "\n\n    INCREASE/DECREASE SURFACE BRIGHTNESS \n\n    bpf_threshold is an integer value in range [0..255] that \n    determines the pixels threshold for the brightness algorithm. \n    The sum RGB below this threshold will not be included in the process  \n    R + G + B < Threshold \n\n\n    :param surface_: Pygame.Surface compatible 24 - 32 bit \n\n    :param shift_: float, must be in range [-1.00 ... +1.00]\n\n    :param bpf_threshold : integer value in range [0 ... 255].\n    threshold RGB. Values R+G+B < threshold will not be included in the process\n    :return: void \n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_47brightness_bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      unsigned char __pyx_v_bpf_threshold;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_bpf (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_bpf_threshold,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("brightness_bpf", 0, 2, 3, 1); __PYX_ERR(1, 907, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_bpf") < 0)) __PYX_ERR(1, 907, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 909, __pyx_L3_error)
        if (values[2]) {
          __pyx_v_bpf_threshold = __Pyx_PyInt_As_unsigned_char(values[2]); if (unlikely((__pyx_v_bpf_threshold == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 910, __pyx_L3_error)
        } else {
          __pyx_v_bpf_threshold = ((unsigned char)64);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("brightness_bpf", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 907, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_46brightness_bpf(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_bpf_threshold);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_46brightness_bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, unsigned char __pyx_v_bpf_threshold) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_bpf", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.bpf_threshold = __pyx_v_bpf_threshold;
      __pyx_f_12PygameShader_6shader_brightness_bpf(__pyx_v_surface_, __pyx_v_shift_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 907, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.brightness_bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0908:         object surface_,

     0909:         float shift_,

     0910:         unsigned char bpf_threshold = 64):

     0911:     """

     0912:

     0913:     INCREASE/DECREASE SURFACE BRIGHTNESS

     0914:

     0915:     bpf_threshold is an integer value in range [0..255] that

     0916:     determines the pixels threshold for the brightness algorithm.

     0917:     The sum RGB below this threshold will not be included in the process

     0918:     R + G + B < Threshold

     0919:

     0920:

     0921:     :param surface_: Pygame.Surface compatible 24 - 32 bit

     0922:

     0923:     :param shift_: float, must be in range [-1.00 ... +1.00]

     0924:

     0925:     :param bpf_threshold : integer value in range [0 ... 255].

     0926:     threshold RGB. Values R+G+B < threshold will not be included in the process

     0927:     :return: void

     0928:

     0929:     """

    +0930:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 930, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 930, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 930, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0931:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 931, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 930, __pyx_L1_error)
        }
      }
      #endif

     0932:

    +0933:     assert -1.0 <= shift_ <= 1.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
          __PYX_ERR(1, 933, __pyx_L1_error)
        }
      }
      #endif

     0934:         "Argument shift must be in range[-1.0 ... 1.0]"

     0935:

    +0936:     shader_brightness24_bpf_c(pixels3d(surface_), shift_, bpf_threshold)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 936, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 936, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 2;
      __pyx_t_6.shift_ = __pyx_v_shift_;
      __pyx_t_6.bpf_treshold_ = __pyx_v_bpf_threshold;
      __pyx_f_12PygameShader_6shader_shader_brightness24_bpf_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0937:

     0938:

    +0939: cpdef inline void brightness_model(

    static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_brightness_model(PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_model", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_48brightness_model[] = "\n    \n    SHADER BRIGHTNESS (EXCLUDE A SPECIFIC COLOR FROM THE PROCESS, DEFAULT BLACK COLOR)\n\n    This shader control the pygame display brightness level\n    It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb\n\n    e.g:\n    brightness_exclude(surface, 0.2)\n    \n    :param surface_ : pygame.surface; compatible 24 - 32 bit \n    :param shift_   : float in range [-1.0 ... 1.0 ]\n    :param rgb_to_hsl_model : numpy.ndarray shape (256, 256, 256, 3)\n    :return : void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_49brightness_model(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      __Pyx_memviewslice __pyx_v_rgb_to_hsl_model = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_model (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,&__pyx_n_s_rgb_to_hsl_model,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, 1); __PYX_ERR(1, 939, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb_to_hsl_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, 2); __PYX_ERR(1, 939, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "brightness_model") < 0)) __PYX_ERR(1, 939, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 941, __pyx_L3_error)
        __pyx_v_rgb_to_hsl_model = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rgb_to_hsl_model.memview)) __PYX_ERR(1, 942, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("brightness_model", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 939, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_48brightness_model(__pyx_self, __pyx_v_surface_, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_48brightness_model(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("brightness_model", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_rgb_to_hsl_model.memview)) { __Pyx_RaiseUnboundLocalError("rgb_to_hsl_model"); __PYX_ERR(1, 939, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_brightness_model(__pyx_v_surface_, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 939, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.brightness_model", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_to_hsl_model, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0940:         object surface_,

     0941:         float shift_,

     0942:         float [:, :, :, :] rgb_to_hsl_model

     0943: ):

     0944:     """

     0945:

     0946:     SHADER BRIGHTNESS (EXCLUDE A SPECIFIC COLOR FROM THE PROCESS, DEFAULT BLACK COLOR)

     0947:

     0948:     This shader control the pygame display brightness level

     0949:     It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb

     0950:

     0951:     e.g:

     0952:     brightness_exclude(surface, 0.2)

     0953:

     0954:     :param surface_ : pygame.surface; compatible 24 - 32 bit

     0955:     :param shift_   : float in range [-1.0 ... 1.0 ]

     0956:     :param rgb_to_hsl_model : numpy.ndarray shape (256, 256, 256, 3)

     0957:     :return : void

     0958:     """

    +0959:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 959, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0960:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 960, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 959, __pyx_L1_error)
        }
      }
      #endif

     0961:

    +0962:     warnings.warn("Deprecated version, use shader_brightness_24_inplace (fastest version)",

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_warnings); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warn); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    /* … */
      __pyx_tuple__10 = PyTuple_Pack(2, __pyx_kp_s_Deprecated_version_use_shader_br, __pyx_builtin_DeprecationWarning); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__10);
      __Pyx_GIVEREF(__pyx_tuple__10);

     0963:                   DeprecationWarning)

    +0964:     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
          __PYX_ERR(1, 964, __pyx_L1_error)
        }
      }
      #endif

     0965:

    +0966:     shader_brightness_24_inplace1_c(pixels3d(surface_), shift_, rgb_to_hsl_model)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 966, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 966, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_brightness_24_inplace1_c(__pyx_t_5, __pyx_v_shift_, __pyx_v_rgb_to_hsl_model);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0967:

     0968:

     0969:

     0970:

    +0971: cpdef inline void saturation(object surface_, float shift_):

    static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_saturation(PyObject *__pyx_v_surface_, float __pyx_v_shift_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("saturation", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_50saturation[] = "\n    SHADER SATURATION\n\n    This shader control the saturation level of the pygame display or surface/texture\n\n    e.g:\n    saturation(surface, 0.2)\n    \n    \n    :param surface_: pygame.Surface; compatible 24 - 32 bit\n    :param shift_  : float must be in range [ -1.0 ... 1.0] \n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_51saturation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_shift_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("saturation (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_shift,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shift)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("saturation", 1, 2, 2, 1); __PYX_ERR(1, 971, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "saturation") < 0)) __PYX_ERR(1, 971, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_shift_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_shift_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 971, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("saturation", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 971, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_50saturation(__pyx_self, __pyx_v_surface_, __pyx_v_shift_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_50saturation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_shift_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("saturation", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_saturation(__pyx_v_surface_, __pyx_v_shift_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 971, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.saturation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0972:     """

     0973:     SHADER SATURATION

     0974:

     0975:     This shader control the saturation level of the pygame display or surface/texture

     0976:

     0977:     e.g:

     0978:     saturation(surface, 0.2)

     0979:

     0980:

     0981:     :param surface_: pygame.Surface; compatible 24 - 32 bit

     0982:     :param shift_  : float must be in range [ -1.0 ... 1.0]

     0983:     :return:

     0984:     """

    +0985:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 985, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +0986:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 986, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 985, __pyx_L1_error)
        }
      }
      #endif

     0987:

    +0988:     assert -1.0 <= shift_ <= 1.0, "\nArgument shift_ must be in range [-1.0 ... 1.0]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_3) {
          __pyx_t_3 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_3 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift__must_be_in_rang);
          __PYX_ERR(1, 988, __pyx_L1_error)
        }
      }
      #endif

     0989:

    +0990:     shader_saturation_array24_inplace_c(pixels3d(surface_), shift_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 990, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_saturation_array24_inplace_c(__pyx_t_5, __pyx_v_shift_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     0991:

     0992:

     0993:

    +0994: cpdef inline void heatwave_vertical(

    static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatwave_vertical(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask, float __pyx_v_factor_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatwave_vertical", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_52heatwave_vertical[] = "\n\n    APPLY A GAUSSIAN TRANSFORMATION TO A SURFACE\n\n    This effect can be use to simulate air turbulence or heat flow/convection\n\n    :param surface_  : pygame.Surface; compatible 24 - 32 bit \n    :param mask      : numpy.ndarray shape (x, y) uint8, (values 255 or 0).\n                       Apply transformation to the original array\n                       if the value @(x, y) is 255 else remain unchanged.\n    :param factor_   : Control the maximum of the gaussian equation.\n                       No transformation if factor_ equal zero\n    :param center_   : Control the center of the gaussian equation (if center_ equal zero,\n                       the Gauss equation is centered\n                       at x=0 and maximum is 0.4 with amplitude_ = 1.0)\n    :param sigma_    : float; sigma value of the gauss equation\n    :param mu_       : float; mu value of the gauss equation\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_53heatwave_vertical(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      __Pyx_memviewslice __pyx_v_mask = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_factor_;
      float __pyx_v_center_;
      float __pyx_v_sigma_;
      float __pyx_v_mu_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatwave_vertical (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_mask,&__pyx_n_s_factor,&__pyx_n_s_center,&__pyx_n_s_sigma,&__pyx_n_s_mu,0};
        PyObject* values[6] = {0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 1); __PYX_ERR(1, 994, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 2); __PYX_ERR(1, 994, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_center)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 3); __PYX_ERR(1, 994, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 4); __PYX_ERR(1, 994, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mu)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, 5); __PYX_ERR(1, 994, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatwave_vertical") < 0)) __PYX_ERR(1, 994, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_mask = __Pyx_PyObject_to_MemoryviewSlice_dsds_unsigned_char(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mask.memview)) __PYX_ERR(1, 996, __pyx_L3_error)
        __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 997, __pyx_L3_error)
        __pyx_v_center_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_center_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 998, __pyx_L3_error)
        __pyx_v_sigma_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_sigma_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 999, __pyx_L3_error)
        __pyx_v_mu_ = __pyx_PyFloat_AsFloat(values[5]); if (unlikely((__pyx_v_mu_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1000, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("heatwave_vertical", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 994, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_52heatwave_vertical(__pyx_self, __pyx_v_surface_, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_52heatwave_vertical(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask, float __pyx_v_factor_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatwave_vertical", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_mask.memview)) { __Pyx_RaiseUnboundLocalError("mask"); __PYX_ERR(1, 994, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_heatwave_vertical(__pyx_v_surface_, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 994, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.heatwave_vertical", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_mask, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     0995:         object surface_,

     0996:         unsigned char [:, :] mask,

     0997:         float factor_,

     0998:         float center_,

     0999:         float sigma_,

     1000:         float mu_):

     1001:     """

     1002:

     1003:     APPLY A GAUSSIAN TRANSFORMATION TO A SURFACE

     1004:

     1005:     This effect can be use to simulate air turbulence or heat flow/convection

     1006:

     1007:     :param surface_  : pygame.Surface; compatible 24 - 32 bit

     1008:     :param mask      : numpy.ndarray shape (x, y) uint8, (values 255 or 0).

     1009:                        Apply transformation to the original array

     1010:                        if the value @(x, y) is 255 else remain unchanged.

     1011:     :param factor_   : Control the maximum of the gaussian equation.

     1012:                        No transformation if factor_ equal zero

     1013:     :param center_   : Control the center of the gaussian equation (if center_ equal zero,

     1014:                        the Gauss equation is centered

     1015:                        at x=0 and maximum is 0.4 with amplitude_ = 1.0)

     1016:     :param sigma_    : float; sigma value of the gauss equation

     1017:     :param mu_       : float; mu value of the gauss equation

     1018:     """

    +1019:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1019, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1019, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1019, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1020:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1020, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1019, __pyx_L1_error)
        }
      }
      #endif

     1021:

    +1022:     assert PyObject_IsInstance(mask, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_mask, 2, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1022, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1022, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1022, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1022, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1022, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1023:         "\nArgument mask must be a numpy.array or memoryview type, got %s " % type(mask)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_mask, 2, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1023, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_mask_must_be_a_numpy_a, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1023, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1022, __pyx_L1_error)
        }
      }
      #endif

     1024:

    +1025:     shader_heatwave24_vertical_inplace_c(pixels3d(surface_), mask, factor_, center_, sigma_, mu_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1025, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1025, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1025, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_heatwave24_vertical_inplace_c(__pyx_t_5, __pyx_v_mask, __pyx_v_factor_, __pyx_v_center_, __pyx_v_sigma_, __pyx_v_mu_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1026:

     1027:

     1028:

    +1029: cpdef inline void horizontal_glitch(

    static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_horizontal_glitch(PyObject *__pyx_v_surface_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("horizontal_glitch", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_54horizontal_glitch[] = "\n    SHADER GLITCH EFFECT\n\n    Deform the pygame display to create a glitch effect\n\n    :param surface_  : pygame.Surface; compatible 24 - 32 bit \n    :param rad1_     : float; Angle in radians, this value control the angle variation over the time\n    :param frequency_: float; signal frequency, factor that amplify the angle variation\n    :param amplitude_: float; cos amplitude value\n    :return: void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_55horizontal_glitch(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      float __pyx_v_rad1_;
      float __pyx_v_frequency_;
      float __pyx_v_amplitude_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("horizontal_glitch (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rad1,&__pyx_n_s_frequency,&__pyx_n_s_amplitude,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rad1)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 1); __PYX_ERR(1, 1029, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frequency)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 2); __PYX_ERR(1, 1029, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, 3); __PYX_ERR(1, 1029, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "horizontal_glitch") < 0)) __PYX_ERR(1, 1029, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_rad1_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_rad1_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1031, __pyx_L3_error)
        __pyx_v_frequency_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_frequency_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1032, __pyx_L3_error)
        __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1033, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("horizontal_glitch", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1029, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_54horizontal_glitch(__pyx_self, __pyx_v_surface_, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_54horizontal_glitch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("horizontal_glitch", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_horizontal_glitch(__pyx_v_surface_, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1029, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.horizontal_glitch", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1030:         object surface_,

     1031:         float rad1_,

     1032:         float frequency_,

     1033:         float amplitude_

     1034: ):

     1035:     """

     1036:     SHADER GLITCH EFFECT

     1037:

     1038:     Deform the pygame display to create a glitch effect

     1039:

     1040:     :param surface_  : pygame.Surface; compatible 24 - 32 bit

     1041:     :param rad1_     : float; Angle in radians, this value control the angle variation over the time

     1042:     :param frequency_: float; signal frequency, factor that amplify the angle variation

     1043:     :param amplitude_: float; cos amplitude value

     1044:     :return: void

     1045:     """

    +1046:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1046, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1046, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1047:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1047, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1046, __pyx_L1_error)
        }
      }
      #endif

     1048:

    +1049:     shader_horizontal_glitch24_inplace_c(pixels3d(surface_), rad1_, frequency_, amplitude_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1049, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_horizontal_glitch24_inplace_c(__pyx_t_5, __pyx_v_rad1_, __pyx_v_frequency_, __pyx_v_amplitude_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1050:

     1051:

     1052:

    +1053: cpdef inline void bpf(object surface_, int threshold = 128):

    static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bpf(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bpf *__pyx_optional_args) {
      int __pyx_v_threshold = ((int)0x80);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bpf", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold = __pyx_optional_args->threshold;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_56bpf[] = "\n    \n    SHADER BRIGHT PASS FILTER (INPLACE)\n\n    Conserve only the brightest pixels in a surface\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :param threshold: integer; Bright pass threshold default 128\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_57bpf(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_threshold;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bpf (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold_2,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold_2);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bpf") < 0)) __PYX_ERR(1, 1053, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_threshold = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1053, __pyx_L3_error)
        } else {
          __pyx_v_threshold = ((int)0x80);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("bpf", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1053, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_56bpf(__pyx_self, __pyx_v_surface_, __pyx_v_threshold);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_56bpf(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bpf", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.threshold = __pyx_v_threshold;
      __pyx_f_12PygameShader_6shader_bpf(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1053, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.bpf", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1054:     """

     1055:

     1056:     SHADER BRIGHT PASS FILTER (INPLACE)

     1057:

     1058:     Conserve only the brightest pixels in a surface

     1059:

     1060:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     1061:     :param threshold: integer; Bright pass threshold default 128

     1062:     :return: void

     1063:     """

    +1064:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1064, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1064, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1064, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1065:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1065, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1064, __pyx_L1_error)
        }
      }
      #endif

     1066:

    +1067:     shader_bpf24_inplace_c(pixels3d(surface_), threshold)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1067, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1067, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1067, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.threshold = __pyx_v_threshold;
      __pyx_f_12PygameShader_6shader_shader_bpf24_inplace_c(__pyx_t_5, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1068:

     1069:

     1070:

    +1071: cpdef inline void bloom(object surface_, int threshold_, bint fast_=False):

    static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bloom(PyObject *__pyx_v_surface_, int __pyx_v_threshold_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_bloom *__pyx_optional_args) {
      int __pyx_v_fast_ = ((int)0);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bloom", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_fast_ = __pyx_optional_args->fast_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_58bloom[] = "\n    \n    CREATE A BLOOM EFFECT\n\n    * Surface must be a pygame Surface 24-32 bit format\n\n    :param surface_     : pygame.Surface; Game display or texture\n    :param threshold_   : integer; Threshold value uint8 in range [0 ... 255].\n                          The threshold value is used by a bright\n                          pass filter to determine the bright pixels above the given threshold.\n                          Below 128 the bloom effect will be more\n                          noticeable and above 128 a bit less.\n    :param fast_        : bool; True | False; If True the bloom effect will be approximated\n                          and only the x16 subsurface\n                          will be processed to maximize the overall processing time, \n                          default is False).\n    :return             : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_59bloom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_threshold_;
      int __pyx_v_fast_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bloom (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_threshold,&__pyx_n_s_fast,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_threshold)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("bloom", 0, 2, 3, 1); __PYX_ERR(1, 1071, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bloom") < 0)) __PYX_ERR(1, 1071, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1071, __pyx_L3_error)
        if (values[2]) {
          __pyx_v_fast_ = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_fast_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1071, __pyx_L3_error)
        } else {
          __pyx_v_fast_ = ((int)0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("bloom", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1071, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_58bloom(__pyx_self, __pyx_v_surface_, __pyx_v_threshold_, __pyx_v_fast_);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_58bloom(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_threshold_, int __pyx_v_fast_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bloom", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.fast_ = __pyx_v_fast_;
      __pyx_f_12PygameShader_6shader_bloom(__pyx_v_surface_, __pyx_v_threshold_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.bloom", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1072:     """

     1073:

     1074:     CREATE A BLOOM EFFECT

     1075:

     1076:     * Surface must be a pygame Surface 24-32 bit format

     1077:

     1078:     :param surface_     : pygame.Surface; Game display or texture

     1079:     :param threshold_   : integer; Threshold value uint8 in range [0 ... 255].

     1080:                           The threshold value is used by a bright

     1081:                           pass filter to determine the bright pixels above the given threshold.

     1082:                           Below 128 the bloom effect will be more

     1083:                           noticeable and above 128 a bit less.

     1084:     :param fast_        : bool; True | False; If True the bloom effect will be approximated

     1085:                           and only the x16 subsurface

     1086:                           will be processed to maximize the overall processing time,

     1087:                           default is False).

     1088:     :return             : void

     1089:

     1090:     """

    +1091:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1091, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1091, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1091, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1092:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1092, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1091, __pyx_L1_error)
        }
      }
      #endif

     1093:

    +1094:     shader_bloom_effect_array24_c(surface_, threshold_, fast_)

      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.fast_ = __pyx_v_fast_;
      __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_surface_, __pyx_v_threshold_, &__pyx_t_4);

     1095:

     1096:

     1097:

    +1098: cpdef inline fisheye_footprint(int w, int h):

    static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fisheye_footprint(int __pyx_v_w, int __pyx_v_h, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye_footprint", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_60fisheye_footprint[] = "\n\n    :param w: integer; width of the fisheye model\n    :param h: integer; height of the fisheye model\n    :return: Return a numpy.ndarray type (w, h, 2) representing the fisheye model (coordinates\n    of all surface pixels passing through the fisheye lens model)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_61fisheye_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_w;
      int __pyx_v_h;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye_footprint (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_h,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fisheye_footprint", 1, 2, 2, 1); __PYX_ERR(1, 1098, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fisheye_footprint") < 0)) __PYX_ERR(1, 1098, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_w = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1098, __pyx_L3_error)
        __pyx_v_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1098, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("fisheye_footprint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1098, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_60fisheye_footprint(__pyx_self, __pyx_v_w, __pyx_v_h);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_60fisheye_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye_footprint", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_fisheye_footprint(__pyx_v_w, __pyx_v_h, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1098, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fisheye_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1099:     """

     1100:

     1101:     :param w: integer; width of the fisheye model

     1102:     :param h: integer; height of the fisheye model

     1103:     :return: Return a numpy.ndarray type (w, h, 2) representing the fisheye model (coordinates

     1104:     of all surface pixels passing through the fisheye lens model)

     1105:     """

    +1106:     return shader_fisheye24_footprint_c(w, h)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_fisheye24_footprint_c(__pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1106, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     1107:

     1108:

     1109:

     1110:

    +1111: cpdef inline void fisheye(

    static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_fisheye(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_fisheye_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_62fisheye[] = "\n    THIS SHADER CAN BE USE TO DISPLAY THE GAME THROUGH A LENS EFFECT\n\n    Display a fisheye effect in real time given a surface referencing the\n    pixels RGB. In order to accomplish a real time calculation, \n    this algorithm is using a pre-calculated transformation stored\n    in the array fisheye_model.\n    \n    The function shader_fisheye24_footprint_c has to be called prior\n    shader_fisheye24_inplace_c in order to store the transformation values.\n\n    This shader can be applied directly to the pygame display\n\n    :param fisheye_model    : numpy.ndarray shape (width, height, 2) int32, fisheye model\n    containing the pixels\n    coordinates after the fisheye transformation\n    :return                 : void\n    \n    :param surface_      : pygame.Surface; compatible 24 - 32 bit \n    :param fisheye_model : numpy.ndarray or cython memoryview shape (width, height, 2) int32, \n                           fisheye model containing the pixels\n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_63fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      __Pyx_memviewslice __pyx_v_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_fisheye_model,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fisheye_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fisheye", 1, 2, 2, 1); __PYX_ERR(1, 1111, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fisheye") < 0)) __PYX_ERR(1, 1111, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_fisheye_model = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fisheye_model.memview)) __PYX_ERR(1, 1112, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("fisheye", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1111, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_62fisheye(__pyx_self, __pyx_v_surface_, __pyx_v_fisheye_model);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_62fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_fisheye_model) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fisheye", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_fisheye_model.memview)) { __Pyx_RaiseUnboundLocalError("fisheye_model"); __PYX_ERR(1, 1111, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_fisheye(__pyx_v_surface_, __pyx_v_fisheye_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_fisheye_model, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1112:         object surface_, unsigned int [:, :, :] fisheye_model):

     1113:     """

     1114:     THIS SHADER CAN BE USE TO DISPLAY THE GAME THROUGH A LENS EFFECT

     1115:

     1116:     Display a fisheye effect in real time given a surface referencing the

     1117:     pixels RGB. In order to accomplish a real time calculation,

     1118:     this algorithm is using a pre-calculated transformation stored

     1119:     in the array fisheye_model.

     1120:

     1121:     The function shader_fisheye24_footprint_c has to be called prior

     1122:     shader_fisheye24_inplace_c in order to store the transformation values.

     1123:

     1124:     This shader can be applied directly to the pygame display

     1125:

     1126:     :param fisheye_model    : numpy.ndarray shape (width, height, 2) int32, fisheye model

     1127:     containing the pixels

     1128:     coordinates after the fisheye transformation

     1129:     :return                 : void

     1130:

     1131:     :param surface_      : pygame.Surface; compatible 24 - 32 bit

     1132:     :param fisheye_model : numpy.ndarray or cython memoryview shape (width, height, 2) int32,

     1133:                            fisheye model containing the pixels

     1134:     :return: void

     1135:     """

     1136:

     1137:     # TODO EXPERIMENT WITH ORDER = 'C'

    +1138:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1138, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1139:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1138, __pyx_L1_error)
        }
      }
      #endif

     1140:

    +1141:     assert PyObject_IsInstance(fisheye_model, (cython.view.memoryview, numpy.ndarray)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1141, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1141, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

     1142:         "\nArgument fisheye_model must be a numpy.ndarray or a cython.view.memoryview  type, " \

    +1143:         "got %s " % type(fisheye_model)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1143, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_fisheye_model_must_be, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1143, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1141, __pyx_L1_error)
        }
      }
      #endif

     1144:

    +1145:     shader_fisheye24_inplace_c(pixels3d(surface_), fisheye_model)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1145, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1145, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_fisheye24_inplace_c(__pyx_t_5, __pyx_v_fisheye_model);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1146:

     1147:

     1148:

     1149: # TODO DOC

    +1150: cpdef inline tuple rain_footprint(int w, int h):

    static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_rain_footprint(int __pyx_v_w, int __pyx_v_h, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_footprint", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_64rain_footprint[] = "\n    \n    CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE\n\n    * This function create a texture and its equivalent numpy.ndarray containing the coordinates\n      for each pixels after deformation.\n    * This method must be called once outside of your game main loop\n    * The model can be re-use to display your video game animation without being re-calculated for\n      each frame. This method allow a high FPS rate\n\n    :param w    : integer; Width of the fish eye effect\n    :param h    : integer; height of the fish eye effect\n    :return     : Pygame Surface representing the fish-eye effect and its\n                  equivalent numpy.ndarray\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_65rain_footprint(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_w;
      int __pyx_v_h;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_footprint (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_w,&__pyx_n_s_h,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rain_footprint", 1, 2, 2, 1); __PYX_ERR(1, 1150, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rain_footprint") < 0)) __PYX_ERR(1, 1150, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_w = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_w == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1150, __pyx_L3_error)
        __pyx_v_h = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_h == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1150, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rain_footprint", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1150, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_64rain_footprint(__pyx_self, __pyx_v_w, __pyx_v_h);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_64rain_footprint(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_w, int __pyx_v_h) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_footprint", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_rain_footprint(__pyx_v_w, __pyx_v_h, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1150, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rain_footprint", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1151:     """

     1152:

     1153:     CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE

     1154:

     1155:     * This function create a texture and its equivalent numpy.ndarray containing the coordinates

     1156:       for each pixels after deformation.

     1157:     * This method must be called once outside of your game main loop

     1158:     * The model can be re-use to display your video game animation without being re-calculated for

     1159:       each frame. This method allow a high FPS rate

     1160:

     1161:     :param w    : integer; Width of the fish eye effect

     1162:     :param h    : integer; height of the fish eye effect

     1163:     :return     : Pygame Surface representing the fish-eye effect and its

     1164:                   equivalent numpy.ndarray

     1165:     """

    +1166:     return shader_rain_footprint_inplace_c(w, h)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_rain_footprint_inplace_c(__pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;
      goto __pyx_L0;

     1167:

     1168:

     1169:

     1170:

     1171: # TODO DOC

    +1172: cpdef inline void rain_fisheye(

    static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rain_fisheye(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_rain_fisheye_model, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_fisheye", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_66rain_fisheye[] = "\n    THIS SHADER CAN BE USED TO SIMULATE RAIN DROPLET OR BUBBLE DISPLAYED ON THE TOP OF\n    THE SCREEN SURFACE.\n\n    Both surface and rain_fisheye_model must have the exact same size\n\n    1) Always call the method shader_rain_footprint_inplace_c before the main loop.\n       The transformation model doesn't have to be calculated every frames.\n       The above method will generate a pygame texture (24bit) containing the location\n       of each pixels after deformation. It does also return a numpy.ndarray equivalent\n       pixel format that can be used instead of the surface if needed.\n\n    It uses a fish eye lens deformation to reproduce the deformed background image onto\n    the final image. The operation apply inplace and the surface referenced by the rgb_array_\n    will be modified directly.\n    The fish-eye lens deformation will recreate you game scene into the rain droplet or bubble\n    and create the illusion of animation inside the bubble.\n\n    * This shader cannot be applied directly to the pygame display as the array passed to the\n    function is a scaled format of the pygame.display (copy not referencing directly the\n    surface pixels)\n\n    * This algorithm use a pre-calculated fish-eye lens deformation model to boost the overall\n    FPS performances, the texture pixel is then transformed with the model without any intensive\n    math calculation.\n\n    :param surface_             : pygame.Surface compatible 24 - 32 bit \n    :param rain_fisheye_model   : numpy.ndarray or memoryview type (w, h, 3) unsigned int \n                                  containing the the coordinate for each pixels\n    :return                     : void\n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_67rain_fisheye(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      __Pyx_memviewslice __pyx_v_rain_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_fisheye (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rain_fisheye_model,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rain_fisheye_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rain_fisheye", 1, 2, 2, 1); __PYX_ERR(1, 1172, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rain_fisheye") < 0)) __PYX_ERR(1, 1172, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_rain_fisheye_model = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rain_fisheye_model.memview)) __PYX_ERR(1, 1174, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rain_fisheye", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1172, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_66rain_fisheye(__pyx_self, __pyx_v_surface_, __pyx_v_rain_fisheye_model);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_66rain_fisheye(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_rain_fisheye_model) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rain_fisheye", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_rain_fisheye_model.memview)) { __Pyx_RaiseUnboundLocalError("rain_fisheye_model"); __PYX_ERR(1, 1172, __pyx_L1_error) }
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_rain_fisheye(__pyx_v_surface_, __pyx_v_rain_fisheye_model, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rain_fisheye", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rain_fisheye_model, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1173:         object surface_,

     1174:         unsigned int [:, :, ::1] rain_fisheye_model

     1175: ):

     1176:     """

     1177:     THIS SHADER CAN BE USED TO SIMULATE RAIN DROPLET OR BUBBLE DISPLAYED ON THE TOP OF

     1178:     THE SCREEN SURFACE.

     1179:

     1180:     Both surface and rain_fisheye_model must have the exact same size

     1181:

     1182:     1) Always call the method shader_rain_footprint_inplace_c before the main loop.

     1183:        The transformation model doesn't have to be calculated every frames.

     1184:        The above method will generate a pygame texture (24bit) containing the location

     1185:        of each pixels after deformation. It does also return a numpy.ndarray equivalent

     1186:        pixel format that can be used instead of the surface if needed.

     1187:

     1188:     It uses a fish eye lens deformation to reproduce the deformed background image onto

     1189:     the final image. The operation apply inplace and the surface referenced by the rgb_array_

     1190:     will be modified directly.

     1191:     The fish-eye lens deformation will recreate you game scene into the rain droplet or bubble

     1192:     and create the illusion of animation inside the bubble.

     1193:

     1194:     * This shader cannot be applied directly to the pygame display as the array passed to the

     1195:     function is a scaled format of the pygame.display (copy not referencing directly the

     1196:     surface pixels)

     1197:

     1198:     * This algorithm use a pre-calculated fish-eye lens deformation model to boost the overall

     1199:     FPS performances, the texture pixel is then transformed with the model without any intensive

     1200:     math calculation.

     1201:

     1202:     :param surface_             : pygame.Surface compatible 24 - 32 bit

     1203:     :param rain_fisheye_model   : numpy.ndarray or memoryview type (w, h, 3) unsigned int

     1204:                                   containing the the coordinate for each pixels

     1205:     :return                     : void

     1206:

     1207:     """

    +1208:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1208, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1208, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1208, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1209:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1209, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1208, __pyx_L1_error)
        }
      }
      #endif

     1210:

    +1211:     assert PyObject_IsInstance(rain_fisheye_model, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1211, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1211, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

     1212:         "\nArgument rain_fisheye_model must be a " \

    +1213:         "numpy.ndarray or a cython memoryview type, got %s " % type(rain_fisheye_model)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1213, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_rain_fisheye_model_mus, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1213, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1211, __pyx_L1_error)
        }
      }
      #endif

     1214:

    +1215:     shader_rain_fisheye24_inplace_c(pixels3d(surface_), rain_fisheye_model)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1215, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1215, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_rain_fisheye24_inplace_c(__pyx_t_5, __pyx_v_rain_fisheye_model);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1216:

     1217:

     1218:

     1219:

    +1220: cpdef inline void tv_scan(surface_, int space=5):

    static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_tv_scan(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_tv_scan *__pyx_optional_args) {
      int __pyx_v_space = ((int)5);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tv_scan", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_space = __pyx_optional_args->space;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_68tv_scan[] = "\n    \n    SHADER CREATING A TV SCANLINE EFFECT ON PYGAME SURFACE\n\n    The space between each scanline can by adjusted with the space value.\n    The scanline intensity/colors is lower that the original image\n\n    :param surface_     : pygame.Surface compatible 24-32 bit \n    :param space        : integer; space between the lines\n    :return             : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_69tv_scan(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_space;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tv_scan (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_space,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_space);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tv_scan") < 0)) __PYX_ERR(1, 1220, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_space = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_space == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1220, __pyx_L3_error)
        } else {
          __pyx_v_space = ((int)5);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("tv_scan", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1220, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_68tv_scan(__pyx_self, __pyx_v_surface_, __pyx_v_space);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_68tv_scan(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_space) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tv_scan", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.space = __pyx_v_space;
      __pyx_f_12PygameShader_6shader_tv_scan(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1220, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.tv_scan", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1221:     """

     1222:

     1223:     SHADER CREATING A TV SCANLINE EFFECT ON PYGAME SURFACE

     1224:

     1225:     The space between each scanline can by adjusted with the space value.

     1226:     The scanline intensity/colors is lower that the original image

     1227:

     1228:     :param surface_     : pygame.Surface compatible 24-32 bit

     1229:     :param space        : integer; space between the lines

     1230:     :return             : void

     1231:

     1232:     """

     1233:     # TODO SCANLINE VERTICAL | HORIZONTAL

     1234:

    +1235:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1235, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1235, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1235, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1236:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1236, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1235, __pyx_L1_error)
        }
      }
      #endif

     1237:

    +1238:     assert space > 0, "Argument space cannot be <=0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_space > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_space_cannot_be_0);
          __PYX_ERR(1, 1238, __pyx_L1_error)
        }
      }
      #endif

     1239:

    +1240:     shader_tv_scanline_inplace_c(pixels3d(surface_), space)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1240, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_tv_scanline_inplace_c(__pyx_t_5, __pyx_v_space);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1241:

     1242:

     1243:

     1244:

    +1245: cpdef inline void rgb_split(object surface_, int offset_=10):

    static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_rgb_split(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split *__pyx_optional_args) {
      int __pyx_v_offset_ = ((int)10);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_offset_ = __pyx_optional_args->offset_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_70rgb_split[] = "\n    \n    THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)\n    The transformation apply inplace\n\n    The original surface will be used and used for the subsurface blit operation.\n    Each channels will be blit sequentially in the following order RGB\n    Note that channel green and blue will be blit with an additional flag BLEND_RGB_ADD, to mix\n    the channel with the lower layers.\n\n    * FPS BOOST\n    In order to boost the fps frame rate the original surface to process can be downscale x2\n    and rescale after processing.\n\n\n    :param surface_ : pygame Surface to process (24bit format)\n    :param offset_  : integer; offset for (x, y) to add to each channels RGB\n    :return         : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_71rgb_split(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_offset_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_offset,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_split") < 0)) __PYX_ERR(1, 1245, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_offset_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1245, __pyx_L3_error)
        } else {
          __pyx_v_offset_ = ((int)10);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rgb_split", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1245, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_70rgb_split(__pyx_self, __pyx_v_surface_, __pyx_v_offset_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_70rgb_split(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.offset_ = __pyx_v_offset_;
      __pyx_f_12PygameShader_6shader_rgb_split(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.rgb_split", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1246:     """

     1247:

     1248:     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)

     1249:     The transformation apply inplace

     1250:

     1251:     The original surface will be used and used for the subsurface blit operation.

     1252:     Each channels will be blit sequentially in the following order RGB

     1253:     Note that channel green and blue will be blit with an additional flag BLEND_RGB_ADD, to mix

     1254:     the channel with the lower layers.

     1255:

     1256:     * FPS BOOST

     1257:     In order to boost the fps frame rate the original surface to process can be downscale x2

     1258:     and rescale after processing.

     1259:

     1260:

     1261:     :param surface_ : pygame Surface to process (24bit format)

     1262:     :param offset_  : integer; offset for (x, y) to add to each channels RGB

     1263:     :return         : void

     1264:

     1265:     """

    +1266:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1266, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1266, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1266, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1267:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1267, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1266, __pyx_L1_error)
        }
      }
      #endif

     1268:

    +1269:     shader_rgb_split_inplace_c(surface_, offset_)

      __pyx_f_12PygameShader_6shader_shader_rgb_split_inplace_c(__pyx_v_surface_, __pyx_v_offset_);

     1270:

     1271:

     1272:

    +1273: cpdef object rgb_split_clean(object surface_, int offset_=10):

    static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_rgb_split_clean(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_rgb_split_clean *__pyx_optional_args) {
      int __pyx_v_offset_ = ((int)10);
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split_clean", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_offset_ = __pyx_optional_args->offset_;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_72rgb_split_clean[] = "\n\n    THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)\n    The final image has a different width and height since the offset value is removed to keep only \n    the overlapping R, G, B channels \n    Setting the Offset_ to zero will have no effect to the original image.\n\n    :param surface_ : pygame Surface to process (24bit format)\n    :param offset_  : integer; offset for (x, y) to add to each channels RGB\n    :return         : void\n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_73rgb_split_clean(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_offset_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split_clean (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_offset,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_split_clean") < 0)) __PYX_ERR(1, 1273, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_offset_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1273, __pyx_L3_error)
        } else {
          __pyx_v_offset_ = ((int)10);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rgb_split_clean", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1273, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_72rgb_split_clean(__pyx_self, __pyx_v_surface_, __pyx_v_offset_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_72rgb_split_clean(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_split_clean", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.offset_ = __pyx_v_offset_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_rgb_split_clean(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rgb_split_clean", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1274:     """

     1275:

     1276:     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)

     1277:     The final image has a different width and height since the offset value is removed to keep only

     1278:     the overlapping R, G, B channels

     1279:     Setting the Offset_ to zero will have no effect to the original image.

     1280:

     1281:     :param surface_ : pygame Surface to process (24bit format)

     1282:     :param offset_  : integer; offset for (x, y) to add to each channels RGB

     1283:     :return         : void

     1284:

     1285:     """

    +1286:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1286, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1286, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1286, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1287:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1287, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1286, __pyx_L1_error)
        }
      }
      #endif

     1288:

    +1289:     assert isinstance(offset_, int), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1289, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_Check(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1290:         "\nArgument offset_ must be an int type, got %s" % type(offset_)

          __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1290, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_offset__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1290, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 1289, __pyx_L1_error)
        }
      }
      #endif

     1291:

    +1292:     if offset_==0:

      __pyx_t_3 = ((__pyx_v_offset_ == 0) != 0);
      if (__pyx_t_3) {
    /* … */
      }

    +1293:         return surface_

        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_surface_);
        __pyx_r = __pyx_v_surface_;
        goto __pyx_L0;

     1294:

    +1295:     return shader_rgb_split_c(surface_, offset_)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_shader_rgb_split_c(__pyx_v_surface_, __pyx_v_offset_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     1296:

     1297:

     1298:

     1299:

    +1300: cpdef inline tuple ripple(

    static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_ripple(int __pyx_v_rows_, int __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous_, __Pyx_memviewslice __pyx_v_current_, __Pyx_memviewslice __pyx_v_array_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      Py_ssize_t __pyx_v_prev_w;
      Py_ssize_t __pyx_v_prev_h;
      Py_ssize_t __pyx_v_curr_w;
      Py_ssize_t __pyx_v_curr_h;
      Py_ssize_t __pyx_v_arr_w;
      Py_ssize_t __pyx_v_arr_h;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ripple", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_74ripple[] = "\n    \n    THIS SHADER CREATE A WATER EFFECT ON A PYGAME SURFACE\n    This version does not include any background deformation to keep a reasonable FPS rate\n\n    * NOTE this shader cannot be apply to the screen directly (screen referencing\n    pygame.display.get_surface()),\n\n    :param rows_        : integer; Array width\n    :param cols_        : integer; Array height\n    :param previous_    : numpy.ndarray type (w, h) type float; array use for the transformation\n    :param current_     : numpy.ndarray type (w, h) type float; array use for the transformation\n    :param array_       : numpy.ndarray type (w, h, 3) type unsigned char\n    :return             : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_75ripple(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_rows_;
      int __pyx_v_cols_;
      __Pyx_memviewslice __pyx_v_previous_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_current_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ripple (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_previous,&__pyx_n_s_current,&__pyx_n_s_array,0};
        PyObject* values[5] = {0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rows)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 1); __PYX_ERR(1, 1300, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_previous)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 2); __PYX_ERR(1, 1300, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_current)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 3); __PYX_ERR(1, 1300, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_array)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, 4); __PYX_ERR(1, 1300, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ripple") < 0)) __PYX_ERR(1, 1300, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        }
        __pyx_v_rows_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_rows_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1301, __pyx_L3_error)
        __pyx_v_cols_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_cols_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1302, __pyx_L3_error)
        __pyx_v_previous_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_previous_.memview)) __PYX_ERR(1, 1303, __pyx_L3_error)
        __pyx_v_current_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_current_.memview)) __PYX_ERR(1, 1304, __pyx_L3_error)
        __pyx_v_array_ = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_array_.memview)) __PYX_ERR(1, 1305, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("ripple", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1300, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_74ripple(__pyx_self, __pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_74ripple(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_rows_, int __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous_, __Pyx_memviewslice __pyx_v_current_, __Pyx_memviewslice __pyx_v_array_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ripple", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_previous_.memview)) { __Pyx_RaiseUnboundLocalError("previous_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
      if (unlikely(!__pyx_v_current_.memview)) { __Pyx_RaiseUnboundLocalError("current_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
      if (unlikely(!__pyx_v_array_.memview)) { __Pyx_RaiseUnboundLocalError("array_"); __PYX_ERR(1, 1300, __pyx_L1_error) }
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_ripple(__pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.ripple", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_previous_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_current_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_array_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1301:         int rows_,

     1302:         int cols_,

     1303:         float [:, ::1] previous_,

     1304:         float [:, ::1] current_,

     1305:         unsigned char [:, :, ::1] array_

     1306: ):

     1307:     """

     1308:

     1309:     THIS SHADER CREATE A WATER EFFECT ON A PYGAME SURFACE

     1310:     This version does not include any background deformation to keep a reasonable FPS rate

     1311:

     1312:     * NOTE this shader cannot be apply to the screen directly (screen referencing

     1313:     pygame.display.get_surface()),

     1314:

     1315:     :param rows_        : integer; Array width

     1316:     :param cols_        : integer; Array height

     1317:     :param previous_    : numpy.ndarray type (w, h) type float; array use for the transformation

     1318:     :param current_     : numpy.ndarray type (w, h) type float; array use for the transformation

     1319:     :param array_       : numpy.ndarray type (w, h, 3) type unsigned char

     1320:     :return             : void

     1321:

     1322:     """

    +1323:     assert PyObject_IsInstance(previous_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_previous_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1323, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1323, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1323, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1323, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_3 = 0;
        __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1323, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_4 != 0))) {

    +1324:         "\nArgument previous must be a numpy.ndarray type got %s " % type(previous_)

          __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_previous_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_previous_must_be_a_num, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 1323, __pyx_L1_error)
        }
      }
      #endif

     1325:

    +1326:     assert PyObject_IsInstance(current_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_current_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_3 = 0;
        __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1326, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_4 != 0))) {

    +1327:         "\nArgument current must be a numpy.ndarray type got %s " % type(current_)

          __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_current_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1327, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_current_must_be_a_nump, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1327, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 1326, __pyx_L1_error)
        }
      }
      #endif

     1328:

    +1329:     assert PyObject_IsInstance(array_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_3 = 0;
        __pyx_t_4 = PyObject_IsInstance(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1329, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_4 != 0))) {

    +1330:         "\nArgument array must be a numpy.ndarray type got %s " % type(array_)

          __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1330, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_array_must_be_a_numpy, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1330, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 1329, __pyx_L1_error)
        }
      }
      #endif

     1331:

     1332:     cdef Py_ssize_t prev_w, prev_h

    +1333:     prev_w, prev_h = previous_.shape[:2]

      __pyx_t_5 = __pyx_v_previous_.shape;
      __pyx_t_6 = (__pyx_t_5[0]);
      __pyx_t_7 = (__pyx_t_5[1]);
      __pyx_v_prev_w = __pyx_t_6;
      __pyx_v_prev_h = __pyx_t_7;

     1334:

     1335:     cdef Py_ssize_t curr_w, curr_h

    +1336:     curr_w, curr_h = current_.shape[:2]

      __pyx_t_5 = __pyx_v_current_.shape;
      __pyx_t_7 = (__pyx_t_5[0]);
      __pyx_t_6 = (__pyx_t_5[1]);
      __pyx_v_curr_w = __pyx_t_7;
      __pyx_v_curr_h = __pyx_t_6;

     1337:

     1338:     cdef Py_ssize_t arr_w, arr_h

    +1339:     arr_w, arr_h = array_.shape[:2]

      __pyx_t_5 = __pyx_v_array_.shape;
      __pyx_t_6 = (__pyx_t_5[0]);
      __pyx_t_7 = (__pyx_t_5[1]);
      __pyx_v_arr_w = __pyx_t_6;
      __pyx_v_arr_h = __pyx_t_7;

     1340:

    +1341:     assert prev_w == curr_w and prev_w == arr_w \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_8 = ((__pyx_v_prev_w == __pyx_v_curr_w) != 0);
        if (__pyx_t_8) {
        } else {
          __pyx_t_4 = __pyx_t_8;
          goto __pyx_L3_bool_binop_done;
        }
    /* … */
        __pyx_t_8 = ((__pyx_v_prev_w == __pyx_v_arr_w) != 0);
        if (__pyx_t_8) {
        } else {
          __pyx_t_4 = __pyx_t_8;
          goto __pyx_L3_bool_binop_done;
        }

    +1342:            and prev_h == curr_h and prev_h == arr_h, \

        __pyx_t_8 = ((__pyx_v_prev_h == __pyx_v_curr_h) != 0);
        if (__pyx_t_8) {
        } else {
          __pyx_t_4 = __pyx_t_8;
          goto __pyx_L3_bool_binop_done;
        }
        __pyx_t_8 = ((__pyx_v_prev_h == __pyx_v_arr_h) != 0);
        __pyx_t_4 = __pyx_t_8;
        __pyx_L3_bool_binop_done:;
        if (unlikely(!__pyx_t_4)) {

     1343:         "\n Array sizes mismatch (previous w: %s, h: %s; " \

    +1344:         "current w: %s, h: %s; array_ w: %s, h: %s " % (prev_w, prev_h, curr_w, curr_h,

          __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_prev_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_prev_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_curr_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_curr_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
    /* … */
          __pyx_t_12 = PyTuple_New(6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_11);
          __pyx_t_1 = 0;
          __pyx_t_2 = 0;
          __pyx_t_3 = 0;
          __pyx_t_9 = 0;
          __pyx_t_10 = 0;
          __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Array_sizes_mismatch_previous_w, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1344, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_11);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __PYX_ERR(1, 1341, __pyx_L1_error)
        }
      }
      #endif

    +1345:         arr_w, arr_h)

          __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_arr_w); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1345, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_arr_h); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1345, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);

     1346:

    +1347:     return shader_ripple_c(rows_, cols_, previous_, current_, array_)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = __pyx_f_12PygameShader_6shader_shader_ripple_c(__pyx_v_rows_, __pyx_v_cols_, __pyx_v_previous_, __pyx_v_current_, __pyx_v_array_); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 1347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_r = ((PyObject*)__pyx_t_11);
      __pyx_t_11 = 0;
      goto __pyx_L0;

     1348:

     1349:

     1350:

     1351:

    +1352: cpdef inline void heatmap(object surface_, bint rgb_=True):

    static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap *__pyx_optional_args) {
      int __pyx_v_rgb_ = ((int)1);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_rgb_ = __pyx_optional_args->rgb_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_76heatmap[] = "\n    TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT\n\n    :param surface_ : pygame.Surface\n    :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_77heatmap(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_rgb_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rgb,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatmap") < 0)) __PYX_ERR(1, 1352, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_rgb_ = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_rgb_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1352, __pyx_L3_error)
        } else {
          __pyx_v_rgb_ = ((int)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("heatmap", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1352, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_76heatmap(__pyx_self, __pyx_v_surface_, __pyx_v_rgb_);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_76heatmap(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.rgb_ = __pyx_v_rgb_;
      __pyx_f_12PygameShader_6shader_heatmap(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.heatmap", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1353:     """

     1354:     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT

     1355:

     1356:     :param surface_ : pygame.Surface

     1357:     :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)

     1358:     :return         : void

     1359:     """

    +1360:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1360, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1360, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1361:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1361, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1360, __pyx_L1_error)
        }
      }
      #endif

     1362:

    +1363:     heatmap_convert(surface_, rgb_)

      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.rgb_ = __pyx_v_rgb_;
      __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_4);

     1364:

     1365:

     1366:

     1367:

     1368:

    +1369: cpdef inline predator_vision(

    static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_predator_vision(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_predator_vision *__pyx_optional_args) {
      unsigned int __pyx_v_sobel_threshold = ((unsigned int)12);
      unsigned int __pyx_v_bpf_threshold = ((unsigned int)50);
      unsigned int __pyx_v_bloom_threshold = ((unsigned int)50);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_surface_copy);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_78predator_vision[] = "\n    CONVERT A SURFACE OR DISPLAY TO AN EQUIVALENT PREDATOR MODE \n\n    :param surface_        : pygame.Surface; compatible 24 - 32 bit \n    :param sobel_threshold : integer; value for sobel edge detection, default is 12 \n    :param bpf_threshold   : integer; value for the bright pass filter pixel detection, \n                             default is 50\n    :param bloom_threshold : integer; Value for the bloom effect intensity default is 50\n    :param inv_colormap    : boolean True | False inverse the colormap aspect, default is False\n    :param fast            : boolean True | False for a fast process, default is False\n    :param blend           : boolean True | False; final blending mode (New in version 1.0.4)  \n    :return                : Return a pygame surface  \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_79predator_vision(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      unsigned int __pyx_v_sobel_threshold;
      unsigned int __pyx_v_bpf_threshold;
      unsigned int __pyx_v_bloom_threshold;
      int __pyx_v_inv_colormap;
      int __pyx_v_fast;
      int __pyx_v_blend;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("predator_vision (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_sobel_threshold,&__pyx_n_s_bpf_threshold,&__pyx_n_s_bloom_threshold,&__pyx_n_s_inv_colormap,&__pyx_n_s_fast_2,&__pyx_n_s_blend,0};
        PyObject* values[7] = {0,0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sobel_threshold);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom_threshold);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_inv_colormap);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_2);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blend);
              if (value) { values[6] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predator_vision") < 0)) __PYX_ERR(1, 1369, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_sobel_threshold = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_sobel_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1371, __pyx_L3_error)
        } else {
          __pyx_v_sobel_threshold = ((unsigned int)12);
        }
        if (values[2]) {
          __pyx_v_bpf_threshold = __Pyx_PyInt_As_unsigned_int(values[2]); if (unlikely((__pyx_v_bpf_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1372, __pyx_L3_error)
        } else {
          __pyx_v_bpf_threshold = ((unsigned int)50);
        }
        if (values[3]) {
          __pyx_v_bloom_threshold = __Pyx_PyInt_As_unsigned_int(values[3]); if (unlikely((__pyx_v_bloom_threshold == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1373, __pyx_L3_error)
        } else {
          __pyx_v_bloom_threshold = ((unsigned int)50);
        }
        if (values[4]) {
          __pyx_v_inv_colormap = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_inv_colormap == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1374, __pyx_L3_error)
        } else {
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_78predator_vision(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_sobel_threshold, unsigned int __pyx_v_bpf_threshold, unsigned int __pyx_v_bloom_threshold, int __pyx_v_inv_colormap, int __pyx_v_fast, int __pyx_v_blend) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("predator_vision", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 6;
      __pyx_t_2.sobel_threshold = __pyx_v_sobel_threshold;
      __pyx_t_2.bpf_threshold = __pyx_v_bpf_threshold;
      __pyx_t_2.bloom_threshold = __pyx_v_bloom_threshold;
      __pyx_t_2.inv_colormap = __pyx_v_inv_colormap;
      __pyx_t_2.fast = __pyx_v_fast;
      __pyx_t_2.blend = __pyx_v_blend;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_predator_vision(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1370:         object surface_,

     1371:         unsigned int sobel_threshold=12,

     1372:         unsigned int bpf_threshold=50,

     1373:         unsigned int bloom_threshold=50,

    +1374:         bint inv_colormap=False,

      int __pyx_v_inv_colormap = ((int)0);
    /* … */
          __pyx_v_inv_colormap = ((int)0);
        }
        if (values[5]) {
          __pyx_v_fast = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_fast == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1375, __pyx_L3_error)
        } else {

    +1375:         bint fast=False,

      int __pyx_v_fast = ((int)0);
      int __pyx_v_blend = __pyx_k__11;
      PyObject *__pyx_v_surface_copy = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("predator_vision", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_sobel_threshold = __pyx_optional_args->sobel_threshold;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_bpf_threshold = __pyx_optional_args->bpf_threshold;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_bloom_threshold = __pyx_optional_args->bloom_threshold;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_inv_colormap = __pyx_optional_args->inv_colormap;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_fast = __pyx_optional_args->fast;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_blend = __pyx_optional_args->blend;
                  }
                }
              }
            }
          }
        }
      }
    /* … */
          __pyx_v_fast = ((int)0);
        }
        if (values[6]) {
          __pyx_v_blend = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_blend == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L3_error)
        } else {
          __pyx_v_blend = __pyx_k__11;
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("predator_vision", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1369, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.predator_vision", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_78predator_vision(__pyx_self, __pyx_v_surface_, __pyx_v_sobel_threshold, __pyx_v_bpf_threshold, __pyx_v_bloom_threshold, __pyx_v_inv_colormap, __pyx_v_fast, __pyx_v_blend);

    +1376:         int blend=pygame.BLEND_RGB_ADD

      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_pygame); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_30); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_k__11 = __pyx_t_7;
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_pygame); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
    /* … */
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1376, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_k__11 = __pyx_t_7;

     1377: ):

     1378:     """

     1379:     CONVERT A SURFACE OR DISPLAY TO AN EQUIVALENT PREDATOR MODE

     1380:

     1381:     :param surface_        : pygame.Surface; compatible 24 - 32 bit

     1382:     :param sobel_threshold : integer; value for sobel edge detection, default is 12

     1383:     :param bpf_threshold   : integer; value for the bright pass filter pixel detection,

     1384:                              default is 50

     1385:     :param bloom_threshold : integer; Value for the bloom effect intensity default is 50

     1386:     :param inv_colormap    : boolean True | False inverse the colormap aspect, default is False

     1387:     :param fast            : boolean True | False for a fast process, default is False

     1388:     :param blend           : boolean True | False; final blending mode (New in version 1.0.4)

     1389:     :return                : Return a pygame surface

     1390:     """

     1391:

    +1392:     surface_copy = surface_.copy()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_surface_copy = __pyx_t_1;
      __pyx_t_1 = 0;

     1393:

    +1394:     if fast:

      __pyx_t_4 = (__pyx_v_fast != 0);
      if (__pyx_t_4) {
    /* … */
        goto __pyx_L3;
      }

    +1395:         sobel_fast(surface_copy, sobel_threshold, factor_=1)

        __pyx_t_5.__pyx_n = 2;
        __pyx_t_5.threshold_ = __pyx_v_sobel_threshold;
        __pyx_t_5.factor_ = 1;
        __pyx_f_12PygameShader_6shader_sobel_fast(__pyx_v_surface_copy, 0, &__pyx_t_5);

     1396:     else:

    +1397:         sobel(surface_copy, sobel_threshold)

      /*else*/ {
        __pyx_t_6.__pyx_n = 1;
        __pyx_t_6.threshold_ = __pyx_v_sobel_threshold;
        __pyx_f_12PygameShader_6shader_sobel(__pyx_v_surface_copy, 0, &__pyx_t_6);
      }
      __pyx_L3:;

     1398:

    +1399:     bpf(surface_, bpf_threshold)

      __pyx_t_7.__pyx_n = 1;
      __pyx_t_7.threshold = __pyx_v_bpf_threshold;
      __pyx_f_12PygameShader_6shader_bpf(__pyx_v_surface_, 0, &__pyx_t_7);

    +1400:     shader_bloom_effect_array24_c(surface_, bloom_threshold, fast_=True)

      __pyx_t_8.__pyx_n = 1;
      __pyx_t_8.fast_ = 1;
      __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_surface_, __pyx_v_bloom_threshold, &__pyx_t_8);

    +1401:     heatmap_convert(surface_, inv_colormap)

      __pyx_t_9.__pyx_n = 1;
      __pyx_t_9.rgb_ = __pyx_v_inv_colormap;
      __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_9);

    +1402:     surface_.blit(surface_copy, (0, 0), special_flags=blend)

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_surface_copy);
      __Pyx_GIVEREF(__pyx_v_surface_copy);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_surface_copy);
      __Pyx_INCREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_tuple__12);
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_blend); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_10) < 0) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    /* … */
      __pyx_tuple__12 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 1402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);

     1403:

    +1404:     return surface_.convert()

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_convert); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_10 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 1404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_10;
      __pyx_t_10 = 0;
      goto __pyx_L0;

     1405:

     1406:

     1407:

     1408:

    +1409: cpdef inline blood(object surface_, float [:, :] mask_, float perc_):

    static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_blood(PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      Py_ssize_t __pyx_v_mask_w;
      Py_ssize_t __pyx_v_mask_h;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blood", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_80blood[] = "\n    SHADER 2D GAME \"HURT EFFECT\"\n    \n    This effect is used in 2D game when the player is being hurt\n    THE MASK DETERMINE THE CONTOUR USED FOR THE BLOOD EFFECT.\n\n    :param surface_ : pygame.Surface; compatible surface 24 - 32 bit\n    :param mask_    : numpy.ndarray shape (w, h) of float values in range [0.0...1.0]\n    :param perc_    : Percentage value in range [0.0 ... 1.0] with 1.0 being 100%\n    :return         : void\n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_81blood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      __Pyx_memviewslice __pyx_v_mask_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_perc_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blood (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_mask_2,&__pyx_n_s_perc,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mask_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, 1); __PYX_ERR(1, 1409, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_perc)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, 2); __PYX_ERR(1, 1409, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blood") < 0)) __PYX_ERR(1, 1409, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_mask_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_mask_.memview)) __PYX_ERR(1, 1409, __pyx_L3_error)
        __pyx_v_perc_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_perc_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1409, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("blood", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1409, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_80blood(__pyx_self, __pyx_v_surface_, __pyx_v_mask_, __pyx_v_perc_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_80blood(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blood", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_mask_.memview)) { __Pyx_RaiseUnboundLocalError("mask_"); __PYX_ERR(1, 1409, __pyx_L1_error) }
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_blood(__pyx_v_surface_, __pyx_v_mask_, __pyx_v_perc_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1409, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.blood", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_mask_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1410:     """

     1411:     SHADER 2D GAME "HURT EFFECT"

     1412:

     1413:     This effect is used in 2D game when the player is being hurt

     1414:     THE MASK DETERMINE THE CONTOUR USED FOR THE BLOOD EFFECT.

     1415:

     1416:     :param surface_ : pygame.Surface; compatible surface 24 - 32 bit

     1417:     :param mask_    : numpy.ndarray shape (w, h) of float values in range [0.0...1.0]

     1418:     :param perc_    : Percentage value in range [0.0 ... 1.0] with 1.0 being 100%

     1419:     :return         : void

     1420:

     1421:     """

    +1422:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1422, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1423:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1422, __pyx_L1_error)
        }
      }
      #endif

     1424:

    +1425:     assert PyObject_IsInstance(mask_, (numpy.ndarray, cython.view.memoryview)), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_mask_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1425, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
        __Pyx_INCREF(((PyObject *)__pyx_memoryview_type));
        __Pyx_GIVEREF(((PyObject *)__pyx_memoryview_type));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_memoryview_type));
        __pyx_t_4 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1425, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1426:         "\nArgument mask_ must be a numpy.ndarray or cython memoryview types got %s " % type(mask_)

          __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_mask_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_mask__must_be_a_numpy, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1425, __pyx_L1_error)
        }
      }
      #endif

     1427:

     1428:     cdef Py_ssize_t w, h

    +1429:     w, h = surface_.get_size()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1429, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 1429, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 1429, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 1429, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1429, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1429, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_w = __pyx_t_7;
      __pyx_v_h = __pyx_t_8;

     1430:

     1431:     cdef Py_ssize_t mask_w, mask_h

    +1432:     mask_w, mask_h = mask_.shape[:2]

      __pyx_t_9 = __pyx_v_mask_.shape;
      __pyx_t_8 = (__pyx_t_9[0]);
      __pyx_t_7 = (__pyx_t_9[1]);
      __pyx_v_mask_w = __pyx_t_8;
      __pyx_v_mask_h = __pyx_t_7;

     1433:

    +1434:     assert w == mask_w and h == mask_h, "\nSurface size and mask size mismatch"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_10 = ((__pyx_v_w == __pyx_v_mask_w) != 0);
        if (__pyx_t_10) {
        } else {
          __pyx_t_3 = __pyx_t_10;
          goto __pyx_L5_bool_binop_done;
        }
        __pyx_t_10 = ((__pyx_v_h == __pyx_v_mask_h) != 0);
        __pyx_t_3 = __pyx_t_10;
        __pyx_L5_bool_binop_done:;
        if (unlikely(!__pyx_t_3)) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Surface_size_and_mask_size_mism);
          __PYX_ERR(1, 1434, __pyx_L1_error)
        }
      }
      #endif

     1435:

    +1436:     shader_blood_inplace_c(pixels3d(surface_), mask_, perc_)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1436, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 1436, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_blood_inplace_c(__pyx_t_11, __pyx_v_mask_, __pyx_v_perc_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     1437:

     1438:

     1439: # TODO DOC

    +1440: cpdef inline object make_palette(int width, float fh, float fs, float fl):

    static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette(int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("make_palette", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_82make_palette[] = "\n    \n    CREATE A PALETTE OF RGB COLORS\n\n    e.g:\n        # below: palette of 256 colors & surface (width=256, height=50).\n        # hue * 6, saturation = 255.0, lightness * 2.0\n        palette, surf = make_palette(256, 50, 6, 255, 2)\n        palette, surf = make_palette(256, 50, 4, 255, 2)\n\n    :param width  : integer, Palette width\n    :param fh     : float, hue factor\n    :param fs     : float, saturation factor\n    :param fl     : float, lightness factor\n    :return       : Return a 1D array palette\n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_83make_palette(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_width;
      float __pyx_v_fh;
      float __pyx_v_fs;
      float __pyx_v_fl;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("make_palette (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_fh,&__pyx_n_s_fs,&__pyx_n_s_fl,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fh)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 1); __PYX_ERR(1, 1440, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fs)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 2); __PYX_ERR(1, 1440, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fl)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, 3); __PYX_ERR(1, 1440, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "make_palette") < 0)) __PYX_ERR(1, 1440, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        }
        __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
        __pyx_v_fh = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_fh == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
        __pyx_v_fs = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_fs == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
        __pyx_v_fl = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_fl == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1440, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("make_palette", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1440, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_82make_palette(__pyx_self, __pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_82make_palette(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("make_palette", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_make_palette(__pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.make_palette", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1441:     """

     1442:

     1443:     CREATE A PALETTE OF RGB COLORS

     1444:

     1445:     e.g:

     1446:         # below: palette of 256 colors & surface (width=256, height=50).

     1447:         # hue * 6, saturation = 255.0, lightness * 2.0

     1448:         palette, surf = make_palette(256, 50, 6, 255, 2)

     1449:         palette, surf = make_palette(256, 50, 4, 255, 2)

     1450:

     1451:     :param width  : integer, Palette width

     1452:     :param fh     : float, hue factor

     1453:     :param fs     : float, saturation factor

     1454:     :param fl     : float, lightness factor

     1455:     :return       : Return a 1D array palette

     1456:

     1457:     """

     1458:

    +1459:     return make_palette_c(width, fh, fs, fl)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_make_palette_c(__pyx_v_width, __pyx_v_fh, __pyx_v_fs, __pyx_v_fl); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1459, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     1460:

     1461:

     1462: # todo develop DOC

    +1463: cpdef inline fire_sub(

    static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_sub(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_sub", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_84fire_sub[] = "\n\n    CREATE A FIRE EFFECT\n\n    :param width    : integer; max width of the effect\n    :param height   : integer; max height of the effect\n    :param factor   : float; factor to reduce the flame effect\n    :param palette  : ndarray; Color palette 1d numpy array (colors buffer unsigned int values)\n    :param fire     : ndarray; 2d array (x, y) (contiguous) containing float values\n    :return         : Return a numpy array containing the fire effect array shape\n     (w, h, 3) of RGB pixels\n     \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_85fire_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_width;
      int __pyx_v_height;
      float __pyx_v_factor;
      __Pyx_memviewslice __pyx_v_palette = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_fire = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_sub (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_factor_2,&__pyx_n_s_palette_2,&__pyx_n_s_fire,0};
        PyObject* values[5] = {0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 1); __PYX_ERR(1, 1463, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 2); __PYX_ERR(1, 1463, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 3); __PYX_ERR(1, 1463, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, 4); __PYX_ERR(1, 1463, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fire_sub") < 0)) __PYX_ERR(1, 1463, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        }
        __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1464, __pyx_L3_error)
        __pyx_v_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1465, __pyx_L3_error)
        __pyx_v_factor = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1466, __pyx_L3_error)
        __pyx_v_palette = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette.memview)) __PYX_ERR(1, 1467, __pyx_L3_error)
        __pyx_v_fire = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fire.memview)) __PYX_ERR(1, 1468, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("fire_sub", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1463, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_84fire_sub(__pyx_self, __pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_84fire_sub(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_sub", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_palette.memview)) { __Pyx_RaiseUnboundLocalError("palette"); __PYX_ERR(1, 1463, __pyx_L1_error) }
      if (unlikely(!__pyx_v_fire.memview)) { __Pyx_RaiseUnboundLocalError("fire"); __PYX_ERR(1, 1463, __pyx_L1_error) }
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_sub(__pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1463, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fire_sub", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_fire, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1464:         int width,

     1465:         int height,

     1466:         float factor,

     1467:         unsigned int [::1] palette,

     1468:         float [:, ::1] fire

     1469: ):

     1470:     """

     1471:

     1472:     CREATE A FIRE EFFECT

     1473:

     1474:     :param width    : integer; max width of the effect

     1475:     :param height   : integer; max height of the effect

     1476:     :param factor   : float; factor to reduce the flame effect

     1477:     :param palette  : ndarray; Color palette 1d numpy array (colors buffer unsigned int values)

     1478:     :param fire     : ndarray; 2d array (x, y) (contiguous) containing float values

     1479:     :return         : Return a numpy array containing the fire effect array shape

     1480:      (w, h, 3) of RGB pixels

     1481:

     1482:     """

     1483:

    +1484:     return fire_surface24_c(width, height, factor, palette, fire)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_surface24_c(__pyx_v_width, __pyx_v_height, __pyx_v_factor, __pyx_v_palette, __pyx_v_fire, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     1485:

     1486:

     1487:

     1488:

    +1489: cpdef inline fire_effect(

    static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_fire_effect(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_fire_effect *__pyx_optional_args) {
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)3);
      unsigned short __pyx_v_fire_intensity_ = ((unsigned short)32);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_86fire_effect[] = "\n    FIRE SHADER EFFECT \n\n    * FIRE TEXTURE SIZES \n    \n    input width_  : integer,  \n    input height_ : integer\n    \n    width_ and height_ values define the size of the texture e.g Surface(width x height)\n\n    * FIRE ASPECT (CONTROL OVER THE WIDTH): \n    \n    inputs low_ : integer  \n    input high_ : integer \n    \n    Optional arguments low_ & high_ (integer values) define the width 's limits of the fire effect. \n    low_ for the starting point and high_ for the ending of the effect.\n    e.g low_ = 10 and high_ = 200. The fire effect will be contain within width = 10 and 200\n    low_ & high_ values must be in range [0 ... width_]  \n        \n    * FIRE HEIGHT:\n    \n    input factor_ : float\n    \n    The fire maximum height can be adjust with the variable factor_ (float value)\n    value > 3.95 will contain the effect within the display \n    value < 3.95 will enlarge the effect over the display height  \n    Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually \n    to contain the fire effect within the display\n        \n    * SPEED CONSIDERATION\n    \n    input reduce_factor_ : integer\n    \n    The argument reduce_factor_ control the size of the texture to be processed \n    e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)\n    Smaller texture improve the overall performances but will slightly degrade the fire aspect, \n    especially if the blur and smooth option are not enabled.\n    Recommended value for reduce_factor_ is 3 (fast process)   \n    reduce_factor_ values must be an integer in range [ 0 ... 4] \n    The reduce_factor_ value will have a significant impact on the fire effect maximum height, \n    adjust the argument factor_ accordingly\n\n    * FIRE INTENSITY AT THE SOURCE\n    \n    input fire_intensity_: integer\n    \n    Set the fire intensity with the variable fire_intensity_, 0 low flame,\n    32 maximum flame effect\n    Values must be an ""int in range [0 ... 32] \n\n    * SMOOTHING THE EFFECT\n    \n    input smooth_: True | False\n    \n    When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear \n    filtering) or False the final texture will be adjust with the scale function.\n    Set this variable to False if you need the best performance for the effect or if you require\n    a pixelated fire effect. Otherwise set the variable to True for a more realistic effect. \n\n    \n    * BLOOM EFFECT \n    \n    input bloom_         : True | False\n    input fast_bloom_    : True | False\n    input bpf_threshold_ : integer\n       \n    Fire effect produce a bright and smooth light effect to the background texture where the fire \n    intensity is at its maximum.\n    Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances\n    The flag fast_bloom_ define a very fast bloom algo using only the smallest texture \n    to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect \n    project for more details.\n    When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will \n    produce a more realistic fire effect (this will slightly degrade the overall performances). \n    If the fire effect is too bright, you can always adjust the bright pass filter value\n    bpf_threshold_(this will adjust the bloom intensity)\n    bpf_threshold_ value must be in range [ 0 ... 255]   \n    Below 128 the bloom effect will be more noticeable and above 128 only the brightest\n    area will be enhanced.\n\n    * LIGHT EFFECT INTENSITY\n\n    input brightness_            : True | False\n    input brightness_intensity_  : float\n\n    When the flag is set to True, the algorithm will use an external function, \n    <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture\n    A custom color can be passed to the function defining the pixels to be ignored during t""he \n    process (default is black color).\n    the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness \n    of the flame effect and positive values will increase the brightness of the effect (causing\n    bright white patches on the fire texture). \n    Values below -0.4 will cause the fire effect to be translucent and this effect can also be \n    used for simulating ascending heat convection effects on a background texture.\n    \n    \n    * OPTIONAL SURFACE\n      \n    input surface_ : pygame.Surface\n      \n    This is an optional surface that can be passed to the shader to improve the performances \n    and to avoid a new surface to be generated every iterations. The surface size must match \n    exactly the reduce texture dimensions otherwise an exception will be raise. \n    see reduce_factor_ option to determine the fire texture size that will be processed.\n    \n    * COLOR PALETTE ADJUSTMENT  \n    \n    input adjust_palette_ : True | False\n    input hsl_            : (10, 80, 1.8)\n\n    Set this flag to True to modify the color palette of the fire texture. \n    This allow the HSL color model to be apply to the palette values\n    You can redefine the palette when the flag is True and by customizing a tuple of 3 float \n    values, default is (10, 80, 1.8). \n    The first value control the palette hue value, the second is for the saturation and last, \n    the palette color lightness. \n    With the variable hsl_ you can rotate the palette colors and define a new flame\n    aspect/color/intensity\n    If adjust_palette_ is True the original palette define by the argument palette_, will \n    be disregarded.Instead a new palette will be created with the hsl values\n\n    * FLAME ORIENTATION / DIRECTION & BORDER FLAME EFFECT\n     \n    input transpose_ = True | False,\n    input border_    = True | False,\n    \n    transpose_ = True, this will transpose the final array \n    for e.g :  \n    If the final fire tex""ture is (w, h) after setting the transpose flag, the final \n    fire texture will become (h, w). As a result the fire effect will be transversal (starting \n    from the right of the display to the left side). \n    You can always transpose / flip the texture to get the right flame orientation  \n    BORDER FLAME EFFECT \n    border_ = True to create a flame effect burning the edge of the display. This version is only\n    compatible with symmetrical display or textures (same width & height). If the display \n    is asymmetric, the final border fire effect will be shown within the display and not neccessary \n    on the frame border \n    \n    * FINAL TOUCH\n    \n    input blur_ : True | False\n    \n    This will will blur the fire effect for a more realistic appearance, remove all the jagged \n    edge when and pixelated effect\n    \n    \n    :param width_           : integer; Size (width) of the surface or display in pixels\n    :param height_          : integer; size (height) of the surface or display in pixels\n    :param factor_          : float; Value controlling the fire height value\n                              must be in range [3.95 ... 4.2].\n                              The value 3.95 gives the highest flame effect\n    :param palette_         : numpy.ndarray, buffer containing mapped RGB colors (uint values)\n    :param fire_            : numpy.ndarray shape (w, h) containing float values (fire intensity).\n                              For better performance it is advised to set the array to the size \n                              of the texture after applying the reduction_factor_.\n                              For example if the reduction_factor_ is 2, the texture would have \n                              width >> 1 and height >> 1 and the fire_array should be set to \n                              numpy.empty((height >> 1, width >> 1), float32)\n    :param reduce_factor_   : unsigned short int ; Can be either 0, 1, 2, 3, 4. \n            ""                  2 and 3 provide the best performance and the best looking effect.\n    :param fire_intensity_  : Integer; Control the original amount of energy at the\n                              bottom of the fire, must be in range of [0 ... 32]. \n                              32 being the maximum value and the maximum fire intensity\n    :param smooth_          : boolean; True smoothscale (bi-linear filtering) or\n                              scale algorithm jagged edges (mush faster)\n    :param bloom_           : boolean; True or False, True apply a bloom effect to the fire effect\n    :param fast_bloom_      : boolean; Fastest bloom. This reduce the amount of calculation\n    :param bpf_threshold_   : integer; control the bright pass filter threshold\n                              value, must be in range [0 ... 255].\n                              Maximum brightness amplification with threshold = 0, \n                              when bpf_threshold_ = 255, no change.\n    :param low_             : integer; Starting position x for the fire effect\n    :param high_            : integer; Ending position x for the fire effect\n    :param brightness_      : boolean; True apply a bright filter shader to the array.\n                              Increase overall brightness of the effect\n    :param brightness_intensity_: float; must be in range [-1.0 ... 1.0] control\n                              the brightness intensity\n                              of the effect\n    :param surface_         : pygame.Surface. Pass a surface to the shader for\n                              better performance, otherwise a new surface will be created each \n                              calls.\n    :param adjust_palette_  : boolean; True adjust the palette setting HSL\n                              (hue, saturation, luminescence).\n                              Be aware that if adjust_palette is True, the optional palette \n                              passed to the Shader wil""l be disregarded\n    :param hsl_             : tuple; float values of hue, saturation and luminescence.\n                              Hue in range [0.0 ... 100],  saturation [0...100], \n                              luminescence [0.0 ... 2.0]\n    :param transpose_       : boolean; Transpose the array (w, h) become (h, w).\n                              The fire effect will start from the left and move to the right\n    :param border_          : boolean; Flame effect affect the border of the texture\n    :param blur_            : boolean; Blur the fire effect\n    :return                 : Return a pygame surface that can be blit directly to the game display\n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_87fire_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_width_;
      int __pyx_v_height_;
      float __pyx_v_factor_;
      __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_fire_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned short __pyx_v_reduce_factor_;
      unsigned short __pyx_v_fire_intensity_;
      int __pyx_v_smooth_;
      int __pyx_v_bloom_;
      int __pyx_v_fast_bloom_;
      unsigned char __pyx_v_bpf_threshold_;
      unsigned int __pyx_v_low_;
      unsigned int __pyx_v_high_;
      int __pyx_v_brightness_;
      float __pyx_v_brightness_intensity_;
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_adjust_palette_;
      PyObject *__pyx_v_hsl_ = 0;
      int __pyx_v_transpose_;
      int __pyx_v_border_;
      int __pyx_v_blur_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_effect (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width_2,&__pyx_n_s_height_2,&__pyx_n_s_factor,&__pyx_n_s_palette,&__pyx_n_s_fire_2,&__pyx_n_s_reduce_factor,&__pyx_n_s_fire_intensity,&__pyx_n_s_smooth,&__pyx_n_s_bloom,&__pyx_n_s_fast_bloom,&__pyx_n_s_bpf_threshold_2,&__pyx_n_s_low,&__pyx_n_s_high,&__pyx_n_s_brightness,&__pyx_n_s_brightness_intensity,&__pyx_n_s_surface,&__pyx_n_s_adjust_palette,&__pyx_n_s_hsl,&__pyx_n_s_transpose,&__pyx_n_s_border,&__pyx_n_s_blur,0};
        PyObject* values[21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_86fire_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_fire_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_adjust_palette_, PyObject *__pyx_v_hsl_, int __pyx_v_transpose_, int __pyx_v_border_, int __pyx_v_blur_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_effect", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 1489, __pyx_L1_error) }
      if (unlikely(!__pyx_v_fire_.memview)) { __Pyx_RaiseUnboundLocalError("fire_"); __PYX_ERR(1, 1489, __pyx_L1_error) }
      __pyx_t_2.__pyx_n = 16;
      __pyx_t_2.reduce_factor_ = __pyx_v_reduce_factor_;
      __pyx_t_2.fire_intensity_ = __pyx_v_fire_intensity_;
      __pyx_t_2.smooth_ = __pyx_v_smooth_;
      __pyx_t_2.bloom_ = __pyx_v_bloom_;
      __pyx_t_2.fast_bloom_ = __pyx_v_fast_bloom_;
      __pyx_t_2.bpf_threshold_ = __pyx_v_bpf_threshold_;
      __pyx_t_2.low_ = __pyx_v_low_;
      __pyx_t_2.high_ = __pyx_v_high_;
      __pyx_t_2.brightness_ = __pyx_v_brightness_;
      __pyx_t_2.brightness_intensity_ = __pyx_v_brightness_intensity_;
      __pyx_t_2.surface_ = __pyx_v_surface_;
      __pyx_t_2.adjust_palette_ = __pyx_v_adjust_palette_;
      __pyx_t_2.hsl_ = __pyx_v_hsl_;
      __pyx_t_2.transpose_ = __pyx_v_transpose_;
      __pyx_t_2.border_ = __pyx_v_border_;
      __pyx_t_2.blur_ = __pyx_v_blur_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_fire_effect(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1489, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_fire_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1490:         int width_,

     1491:         int height_,

     1492:         float factor_,

     1493:         unsigned int [::1] palette_,

     1494:         float [:, ::1] fire_,

     1495:

     1496:         # OPTIONAL

     1497:         unsigned short int reduce_factor_ = 3,

     1498:         unsigned short int fire_intensity_= 32,

    +1499:         bint smooth_                      = True,

      int __pyx_v_smooth_ = ((int)1);
    /* … */
          __pyx_v_smooth_ = ((int)1);
        }
        if (values[8]) {
          __pyx_v_bloom_ = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1500, __pyx_L3_error)
        } else {

    +1500:         bint bloom_                       = True,

      int __pyx_v_bloom_ = ((int)1);
    /* … */
          __pyx_v_bloom_ = ((int)1);
        }
        if (values[9]) {
          __pyx_v_fast_bloom_ = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_fast_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1501, __pyx_L3_error)
        } else {

    +1501:         bint fast_bloom_                  = True,

      int __pyx_v_fast_bloom_ = ((int)1);
      unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0);
      unsigned int __pyx_v_low_ = ((unsigned int)0);
      unsigned int __pyx_v_high_ = ((unsigned int)0x258);
    /* … */
          __pyx_v_fast_bloom_ = ((int)1);
        }
        if (values[10]) {
          __pyx_v_bpf_threshold_ = __Pyx_PyInt_As_unsigned_char(values[10]); if (unlikely((__pyx_v_bpf_threshold_ == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 1502, __pyx_L3_error)
        } else {
          __pyx_v_bpf_threshold_ = ((unsigned char)0);
        }
        if (values[11]) {
          __pyx_v_low_ = __Pyx_PyInt_As_unsigned_int(values[11]); if (unlikely((__pyx_v_low_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1503, __pyx_L3_error)
        } else {
          __pyx_v_low_ = ((unsigned int)0);
        }
        if (values[12]) {
          __pyx_v_high_ = __Pyx_PyInt_As_unsigned_int(values[12]); if (unlikely((__pyx_v_high_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1504, __pyx_L3_error)
        } else {
          __pyx_v_high_ = ((unsigned int)0x258);
        }
        if (values[13]) {
          __pyx_v_brightness_ = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_brightness_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1505, __pyx_L3_error)
        } else {

     1502:         unsigned char bpf_threshold_      = 0,

     1503:         unsigned int low_                 = 0,

     1504:         unsigned int high_                = 600,

    +1505:         bint brightness_                  = True,

      int __pyx_v_brightness_ = ((int)1);
      float __pyx_v_brightness_intensity_ = ((float)0.15);
    /* … */
          __pyx_v_brightness_ = ((int)1);
        }
        if (values[14]) {
          __pyx_v_brightness_intensity_ = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_brightness_intensity_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1506, __pyx_L3_error)
        } else {
          __pyx_v_brightness_intensity_ = ((float)0.15);
        }
        __pyx_v_surface_ = values[15];
        if (values[16]) {
          __pyx_v_adjust_palette_ = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_adjust_palette_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1508, __pyx_L3_error)
        } else {

     1506:         float brightness_intensity_       = 0.15,

    +1507:         object surface_                   = None,

      PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);
    /* … */
        values[15] = ((PyObject *)Py_None);

    +1508:         bint adjust_palette_              = False,

      int __pyx_v_adjust_palette_ = ((int)0);
    /* … */
          __pyx_v_adjust_palette_ = ((int)0);
        }
        __pyx_v_hsl_ = ((PyObject*)values[17]);
        if (values[18]) {
          __pyx_v_transpose_ = __Pyx_PyObject_IsTrue(values[18]); if (unlikely((__pyx_v_transpose_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1510, __pyx_L3_error)
        } else {

    +1509:         tuple hsl_                        = (10, 80, 1.8),

      PyObject *__pyx_v_hsl_ = ((PyObject*)__pyx_tuple__13);
    /* … */
      __pyx_tuple__13 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 1509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__13);
      __Pyx_GIVEREF(__pyx_tuple__13);
    /* … */
        values[17] = ((PyObject*)__pyx_tuple__14);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
            CYTHON_FALLTHROUGH;
            case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
            CYTHON_FALLTHROUGH;
            case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
            CYTHON_FALLTHROUGH;
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width_2)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 1); __PYX_ERR(1, 1489, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 2); __PYX_ERR(1, 1489, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 3); __PYX_ERR(1, 1489, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, 4); __PYX_ERR(1, 1489, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fire_intensity);
              if (value) { values[6] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth);
              if (value) { values[7] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom);
              if (value) { values[8] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_bloom);
              if (value) { values[9] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 10:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold_2);
              if (value) { values[10] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 11:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_low);
              if (value) { values[11] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 12:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_high);
              if (value) { values[12] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 13:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness);
              if (value) { values[13] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 14:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness_intensity);
              if (value) { values[14] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 15:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface);
              if (value) { values[15] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 16:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adjust_palette);
              if (value) { values[16] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 17:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hsl);
              if (value) { values[17] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 18:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transpose);
              if (value) { values[18] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 19:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_border);
              if (value) { values[19] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 20:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blur);
              if (value) { values[20] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fire_effect") < 0)) __PYX_ERR(1, 1489, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
            CYTHON_FALLTHROUGH;
            case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
            CYTHON_FALLTHROUGH;
            case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
            CYTHON_FALLTHROUGH;
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_width_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1490, __pyx_L3_error)
        __pyx_v_height_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1491, __pyx_L3_error)
        __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1492, __pyx_L3_error)
        __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 1493, __pyx_L3_error)
        __pyx_v_fire_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fire_.memview)) __PYX_ERR(1, 1494, __pyx_L3_error)
        if (values[5]) {
          __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[5]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1497, __pyx_L3_error)
        } else {
          __pyx_v_reduce_factor_ = ((unsigned short)3);
        }
        if (values[6]) {
          __pyx_v_fire_intensity_ = __Pyx_PyInt_As_unsigned_short(values[6]); if (unlikely((__pyx_v_fire_intensity_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1498, __pyx_L3_error)
        } else {
          __pyx_v_fire_intensity_ = ((unsigned short)32);
        }
        if (values[7]) {
          __pyx_v_smooth_ = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smooth_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1499, __pyx_L3_error)
        } else {
      __pyx_tuple__14 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 1509, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__14);
      __Pyx_GIVEREF(__pyx_tuple__14);

    +1510:         bint transpose_                   = False,

      int __pyx_v_transpose_ = ((int)0);
    /* … */
          __pyx_v_transpose_ = ((int)0);
        }
        if (values[19]) {
          __pyx_v_border_ = __Pyx_PyObject_IsTrue(values[19]); if (unlikely((__pyx_v_border_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1511, __pyx_L3_error)
        } else {

    +1511:         bint border_                      = False,

      int __pyx_v_border_ = ((int)0);
    /* … */
          __pyx_v_border_ = ((int)0);
        }
        if (values[20]) {
          __pyx_v_blur_ = __Pyx_PyObject_IsTrue(values[20]); if (unlikely((__pyx_v_blur_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1512, __pyx_L3_error)
        } else {

    +1512:         bint blur_                        = True

      int __pyx_v_blur_ = ((int)1);
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_effect", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_fire_intensity_ = __pyx_optional_args->fire_intensity_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_smooth_ = __pyx_optional_args->smooth_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_bloom_ = __pyx_optional_args->bloom_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                    if (__pyx_optional_args->__pyx_n > 6) {
                      __pyx_v_low_ = __pyx_optional_args->low_;
                      if (__pyx_optional_args->__pyx_n > 7) {
                        __pyx_v_high_ = __pyx_optional_args->high_;
                        if (__pyx_optional_args->__pyx_n > 8) {
                          __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                          if (__pyx_optional_args->__pyx_n > 9) {
                            __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                            if (__pyx_optional_args->__pyx_n > 10) {
                              __pyx_v_surface_ = __pyx_optional_args->surface_;
                              if (__pyx_optional_args->__pyx_n > 11) {
                                __pyx_v_adjust_palette_ = __pyx_optional_args->adjust_palette_;
                                if (__pyx_optional_args->__pyx_n > 12) {
                                  __pyx_v_hsl_ = __pyx_optional_args->hsl_;
                                  if (__pyx_optional_args->__pyx_n > 13) {
                                    __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                    if (__pyx_optional_args->__pyx_n > 14) {
                                      __pyx_v_border_ = __pyx_optional_args->border_;
                                      if (__pyx_optional_args->__pyx_n > 15) {
                                        __pyx_v_blur_ = __pyx_optional_args->blur_;
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    /* … */
          __pyx_v_blur_ = ((int)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("fire_effect", 0, 5, 21, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1489, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.fire_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hsl_), (&PyTuple_Type), 1, "hsl_", 1))) __PYX_ERR(1, 1509, __pyx_L1_error)
      __pyx_r = __pyx_pf_12PygameShader_6shader_86fire_effect(__pyx_self, __pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, __pyx_v_reduce_factor_, __pyx_v_fire_intensity_, __pyx_v_smooth_, __pyx_v_bloom_, __pyx_v_fast_bloom_, __pyx_v_bpf_threshold_, __pyx_v_low_, __pyx_v_high_, __pyx_v_brightness_, __pyx_v_brightness_intensity_, __pyx_v_surface_, __pyx_v_adjust_palette_, __pyx_v_hsl_, __pyx_v_transpose_, __pyx_v_border_, __pyx_v_blur_);

     1513:         ):

     1514:     """

     1515:     FIRE SHADER EFFECT

     1516:

     1517:     * FIRE TEXTURE SIZES

     1518:

     1519:     input width_  : integer,

     1520:     input height_ : integer

     1521:

     1522:     width_ and height_ values define the size of the texture e.g Surface(width x height)

     1523:

     1524:     * FIRE ASPECT (CONTROL OVER THE WIDTH):

     1525:

     1526:     inputs low_ : integer

     1527:     input high_ : integer

     1528:

     1529:     Optional arguments low_ & high_ (integer values) define the width 's limits of the fire effect.

     1530:     low_ for the starting point and high_ for the ending of the effect.

     1531:     e.g low_ = 10 and high_ = 200. The fire effect will be contain within width = 10 and 200

     1532:     low_ & high_ values must be in range [0 ... width_]

     1533:

     1534:     * FIRE HEIGHT:

     1535:

     1536:     input factor_ : float

     1537:

     1538:     The fire maximum height can be adjust with the variable factor_ (float value)

     1539:     value > 3.95 will contain the effect within the display

     1540:     value < 3.95 will enlarge the effect over the display height

     1541:     Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually

     1542:     to contain the fire effect within the display

     1543:

     1544:     * SPEED CONSIDERATION

     1545:

     1546:     input reduce_factor_ : integer

     1547:

     1548:     The argument reduce_factor_ control the size of the texture to be processed

     1549:     e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)

     1550:     Smaller texture improve the overall performances but will slightly degrade the fire aspect,

     1551:     especially if the blur and smooth option are not enabled.

     1552:     Recommended value for reduce_factor_ is 3 (fast process)

     1553:     reduce_factor_ values must be an integer in range [ 0 ... 4]

     1554:     The reduce_factor_ value will have a significant impact on the fire effect maximum height,

     1555:     adjust the argument factor_ accordingly

     1556:

     1557:     * FIRE INTENSITY AT THE SOURCE

     1558:

     1559:     input fire_intensity_: integer

     1560:

     1561:     Set the fire intensity with the variable fire_intensity_, 0 low flame,

     1562:     32 maximum flame effect

     1563:     Values must be an int in range [0 ... 32]

     1564:

     1565:     * SMOOTHING THE EFFECT

     1566:

     1567:     input smooth_: True | False

     1568:

     1569:     When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear

     1570:     filtering) or False the final texture will be adjust with the scale function.

     1571:     Set this variable to False if you need the best performance for the effect or if you require

     1572:     a pixelated fire effect. Otherwise set the variable to True for a more realistic effect.

     1573:

     1574:

     1575:     * BLOOM EFFECT

     1576:

     1577:     input bloom_         : True | False

     1578:     input fast_bloom_    : True | False

     1579:     input bpf_threshold_ : integer

     1580:

     1581:     Fire effect produce a bright and smooth light effect to the background texture where the fire

     1582:     intensity is at its maximum.

     1583:     Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances

     1584:     The flag fast_bloom_ define a very fast bloom algo using only the smallest texture

     1585:     to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect

     1586:     project for more details.

     1587:     When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will

     1588:     produce a more realistic fire effect (this will slightly degrade the overall performances).

     1589:     If the fire effect is too bright, you can always adjust the bright pass filter value

     1590:     bpf_threshold_(this will adjust the bloom intensity)

     1591:     bpf_threshold_ value must be in range [ 0 ... 255]

     1592:     Below 128 the bloom effect will be more noticeable and above 128 only the brightest

     1593:     area will be enhanced.

     1594:

     1595:     * LIGHT EFFECT INTENSITY

     1596:

     1597:     input brightness_            : True | False

     1598:     input brightness_intensity_  : float

     1599:

     1600:     When the flag is set to True, the algorithm will use an external function,

     1601:     <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture

     1602:     A custom color can be passed to the function defining the pixels to be ignored during the

     1603:     process (default is black color).

     1604:     the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness

     1605:     of the flame effect and positive values will increase the brightness of the effect (causing

     1606:     bright white patches on the fire texture).

     1607:     Values below -0.4 will cause the fire effect to be translucent and this effect can also be

     1608:     used for simulating ascending heat convection effects on a background texture.

     1609:

     1610:

     1611:     * OPTIONAL SURFACE

     1612:

     1613:     input surface_ : pygame.Surface

     1614:

     1615:     This is an optional surface that can be passed to the shader to improve the performances

     1616:     and to avoid a new surface to be generated every iterations. The surface size must match

     1617:     exactly the reduce texture dimensions otherwise an exception will be raise.

     1618:     see reduce_factor_ option to determine the fire texture size that will be processed.

     1619:

     1620:     * COLOR PALETTE ADJUSTMENT

     1621:

     1622:     input adjust_palette_ : True | False

     1623:     input hsl_            : (10, 80, 1.8)

     1624:

     1625:     Set this flag to True to modify the color palette of the fire texture.

     1626:     This allow the HSL color model to be apply to the palette values

     1627:     You can redefine the palette when the flag is True and by customizing a tuple of 3 float

     1628:     values, default is (10, 80, 1.8).

     1629:     The first value control the palette hue value, the second is for the saturation and last,

     1630:     the palette color lightness.

     1631:     With the variable hsl_ you can rotate the palette colors and define a new flame

     1632:     aspect/color/intensity

     1633:     If adjust_palette_ is True the original palette define by the argument palette_, will

     1634:     be disregarded.Instead a new palette will be created with the hsl values

     1635:

     1636:     * FLAME ORIENTATION / DIRECTION & BORDER FLAME EFFECT

     1637:

     1638:     input transpose_ = True | False,

     1639:     input border_    = True | False,

     1640:

     1641:     transpose_ = True, this will transpose the final array

     1642:     for e.g :

     1643:     If the final fire texture is (w, h) after setting the transpose flag, the final

     1644:     fire texture will become (h, w). As a result the fire effect will be transversal (starting

     1645:     from the right of the display to the left side).

     1646:     You can always transpose / flip the texture to get the right flame orientation

     1647:     BORDER FLAME EFFECT

     1648:     border_ = True to create a flame effect burning the edge of the display. This version is only

     1649:     compatible with symmetrical display or textures (same width & height). If the display

     1650:     is asymmetric, the final border fire effect will be shown within the display and not neccessary

     1651:     on the frame border

     1652:

     1653:     * FINAL TOUCH

     1654:

     1655:     input blur_ : True | False

     1656:

     1657:     This will will blur the fire effect for a more realistic appearance, remove all the jagged

     1658:     edge when and pixelated effect

     1659:

     1660:

     1661:     :param width_           : integer; Size (width) of the surface or display in pixels

     1662:     :param height_          : integer; size (height) of the surface or display in pixels

     1663:     :param factor_          : float; Value controlling the fire height value

     1664:                               must be in range [3.95 ... 4.2].

     1665:                               The value 3.95 gives the highest flame effect

     1666:     :param palette_         : numpy.ndarray, buffer containing mapped RGB colors (uint values)

     1667:     :param fire_            : numpy.ndarray shape (w, h) containing float values (fire intensity).

     1668:                               For better performance it is advised to set the array to the size

     1669:                               of the texture after applying the reduction_factor_.

     1670:                               For example if the reduction_factor_ is 2, the texture would have

     1671:                               width >> 1 and height >> 1 and the fire_array should be set to

     1672:                               numpy.empty((height >> 1, width >> 1), float32)

     1673:     :param reduce_factor_   : unsigned short int ; Can be either 0, 1, 2, 3, 4.

     1674:                               2 and 3 provide the best performance and the best looking effect.

     1675:     :param fire_intensity_  : Integer; Control the original amount of energy at the

     1676:                               bottom of the fire, must be in range of [0 ... 32].

     1677:                               32 being the maximum value and the maximum fire intensity

     1678:     :param smooth_          : boolean; True smoothscale (bi-linear filtering) or

     1679:                               scale algorithm jagged edges (mush faster)

     1680:     :param bloom_           : boolean; True or False, True apply a bloom effect to the fire effect

     1681:     :param fast_bloom_      : boolean; Fastest bloom. This reduce the amount of calculation

     1682:     :param bpf_threshold_   : integer; control the bright pass filter threshold

     1683:                               value, must be in range [0 ... 255].

     1684:                               Maximum brightness amplification with threshold = 0,

     1685:                               when bpf_threshold_ = 255, no change.

     1686:     :param low_             : integer; Starting position x for the fire effect

     1687:     :param high_            : integer; Ending position x for the fire effect

     1688:     :param brightness_      : boolean; True apply a bright filter shader to the array.

     1689:                               Increase overall brightness of the effect

     1690:     :param brightness_intensity_: float; must be in range [-1.0 ... 1.0] control

     1691:                               the brightness intensity

     1692:                               of the effect

     1693:     :param surface_         : pygame.Surface. Pass a surface to the shader for

     1694:                               better performance, otherwise a new surface will be created each

     1695:                               calls.

     1696:     :param adjust_palette_  : boolean; True adjust the palette setting HSL

     1697:                               (hue, saturation, luminescence).

     1698:                               Be aware that if adjust_palette is True, the optional palette

     1699:                               passed to the Shader will be disregarded

     1700:     :param hsl_             : tuple; float values of hue, saturation and luminescence.

     1701:                               Hue in range [0.0 ... 100],  saturation [0...100],

     1702:                               luminescence [0.0 ... 2.0]

     1703:     :param transpose_       : boolean; Transpose the array (w, h) become (h, w).

     1704:                               The fire effect will start from the left and move to the right

     1705:     :param border_          : boolean; Flame effect affect the border of the texture

     1706:     :param blur_            : boolean; Blur the fire effect

     1707:     :return                 : Return a pygame surface that can be blit directly to the game display

     1708:

     1709:     """

     1710:     # todo reduce_factor=0 and border = True crash

     1711:

    +1712:     assert reduce_factor_ in (0, 1, 2, 3, 4), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        switch (__pyx_v_reduce_factor_) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          __pyx_t_1 = 1;
          break;
          default:
          __pyx_t_1 = 0;
          break;
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_reduce_factor_must_be_i);
          __PYX_ERR(1, 1712, __pyx_L1_error)
        }
      }
      #endif

     1713:         "Argument reduce factor must be in range 0 ... 4 " \

     1714:         "\n reduce_factor_ = 1 correspond to dividing the image size by 2" \

     1715:         "\n reduce_factor_ = 2 correspond to dividing the image size by 4"

    +1716:     assert 0 <= fire_intensity_ < 33, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (0 <= __pyx_v_fire_intensity_);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_fire_intensity_ < 33);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {

    +1717:         "Argument fire_intensity_ must be in range [0 ... 32] got %s" % fire_intensity_

          __pyx_t_2 = __Pyx_PyInt_From_unsigned_short(__pyx_v_fire_intensity_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1717, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Argument_fire_intensity__must_be, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1717, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 1716, __pyx_L1_error)
        }
      }
      #endif

     1718:

    +1719:     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_4 = ((__pyx_v_width_ > 0) != 0);
        if (__pyx_t_4) {
        } else {
          __pyx_t_1 = __pyx_t_4;
          goto __pyx_L3_bool_binop_done;
        }
        __pyx_t_4 = ((__pyx_v_height_ > 0) != 0);
        __pyx_t_1 = __pyx_t_4;
        __pyx_L3_bool_binop_done:;
        if (unlikely(!__pyx_t_1)) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_width_or_height_cannot);
          __PYX_ERR(1, 1719, __pyx_L1_error)
        }
      }
      #endif

    +1720:     assert factor_ > 0, "Argument factor_ cannot be null or < 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_factor_ > 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__cannot_be_null);
          __PYX_ERR(1, 1720, __pyx_L1_error)
        }
      }
      #endif

     1721:

    +1722:     return shader_fire_effect_c(

      __Pyx_XDECREF(__pyx_r);
    /* … */
      __pyx_t_5.__pyx_n = 16;
      __pyx_t_5.reduce_factor_ = __pyx_v_reduce_factor_;
      __pyx_t_5.fire_intensity_ = __pyx_v_fire_intensity_;
      __pyx_t_5.smooth_ = __pyx_v_smooth_;
      __pyx_t_5.bloom_ = __pyx_v_bloom_;
      __pyx_t_5.fast_bloom_ = __pyx_v_fast_bloom_;
      __pyx_t_5.bpf_threshold_ = __pyx_v_bpf_threshold_;
      __pyx_t_5.low_ = __pyx_v_low_;
      __pyx_t_5.high_ = __pyx_v_high_;
      __pyx_t_5.brightness_ = __pyx_v_brightness_;
      __pyx_t_5.brightness_intensity_ = __pyx_v_brightness_intensity_;
      __pyx_t_5.surface_ = __pyx_v_surface_;
      __pyx_t_5.adjust_palette_ = __pyx_v_adjust_palette_;
      __pyx_t_5.hsl_ = __pyx_v_hsl_;
      __pyx_t_5.transpose_ = __pyx_v_transpose_;
      __pyx_t_5.border_ = __pyx_v_border_;
      __pyx_t_5.blur_ = __pyx_v_blur_;
      __pyx_t_3 = __pyx_f_12PygameShader_6shader_shader_fire_effect_c(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1722, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     1723:         width_, height_, factor_, palette_, fire_,

     1724:         reduce_factor_, fire_intensity_, smooth_,

     1725:         bloom_, fast_bloom_, bpf_threshold_, low_, high_, brightness_,

     1726:         brightness_intensity_, surface_, adjust_palette_,

     1727:         hsl_, transpose_, border_, blur_

     1728:     )

     1729:

     1730:

     1731:

    +1732: cpdef inline cloud_effect(

    static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_cloud_effect(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cloud_effect *__pyx_optional_args) {
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)2);
      unsigned short __pyx_v_cloud_intensity_ = ((unsigned short)16);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_88cloud_effect[] = "\n    GENERATE CLOUD /SMOKE ON THE GAME DISPLAY \n    \n    * CLOUD TEXTURE SIZES \n    \n    input width_  : integer,  \n    input height_ : integer\n    \n    width_ and height_ values define the size of the texture e.g Surface(width x height)\n\n    * CLOUD ASPECT (CONTROL OVER THE WIDTH): \n    \n    inputs low_ : integer  \n    input high_ : integer \n    \n    Optional arguments low_ & high_ (integer values) define the width 's limits of the cloud \n    effect. low_ for the starting point and high_ for the ending of the effect.\n    e.g low_ = 10 and high_ = 200. The cloud effect will be contain within width = 10 and 200\n    low_ & high_ values must be in range [0 ... width_]  \n        \n    * CLOUD HEIGHT:\n    \n    input factor_ : float\n    \n    The cloud maximum height can be adjust with the variable factor_ (float value)\n    value > 3.95 will contain the effect within the display \n    value < 3.95 will enlarge the effect over the display height  \n    Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually \n    to contain the cloud effect within the display\n        \n    * SPEED CONSIDERATION\n    \n    input reduce_factor_ : integer\n    \n    The argument reduce_factor_ control the size of the texture to be processed \n    e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)\n    Smaller texture improve the overall performances but will slightly degrade the cloud aspect, \n    especially if the blur and smooth option are not enabled.\n    Recommended value for reduce_factor_ is 3 (fast process)   \n    reduce_factor_ values must be an integer in range [ 0 ... 4] \n    The reduce_factor_ value will have a significant impact on the cloud effect maximum height, \n    adjust the argument factor_ accordingly\n\n    * CLOUD INTENSITY AT THE SOURCE\n    \n    input cloud_intensity_: integer\n    \n    Set the cloud intensity with the variable cloud_intensity_, 0 low flame,\n    32 maxi""mum flame effect\n    Values must be an int in range [0 ... 32] \n\n    * SMOOTHING THE EFFECT\n    \n    input smooth_: True | False\n    \n    When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear \n    filtering) or False the final texture will be adjust with the scale function.\n    Set this variable to False if you need the best performance for the effect or if you require\n    a pixelated cloud effect. Otherwise set the variable to True for a more realistic effect. \n   \n    * BLOOM EFFECT \n    \n    input bloom_         : True | False\n    input fast_bloom_    : True | False\n    input bpf_threshold_ : integer\n       \n    Bloom effect produce a bright and smooth light effect to the background texture where the cloud \n    intensity is at its maximum.\n    Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances\n    The flag fast_bloom_ define a very fast bloom algo using only the smallest texture \n    to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect \n    project for more details.\n    When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will \n    produce a more realistic cloud effect (this will slightly degrade the overall performances). \n    If the cloud effect is too bright, you can always adjust the bright pass filter value\n    bpf_threshold_(this will adjust the bloom intensity)\n    bpf_threshold_ value must be in range [ 0 ... 255]   \n    Below 128 the bloom effect will be more noticeable and above 128 only the brightest\n    area will be enhanced.\n\n    * LIGHT EFFECT INTENSITY\n\n    input brightness_            : True | False\n    input brightness_intensity_  : float\n\n    When the flag is set to True, the algorithm will use an external function, \n    <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture\n    A custom color can be passed to the function ""defining the pixels to be ignored during the \n    process (default is black color).\n    the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness \n    of the cloud effect and positive values will increase the brightness of the effect (causing\n    bright white patches on the cloud texture). \n    Values below -0.4 will cause the cloud effect to be translucent \n    \n    \n    * OPTIONAL SURFACE\n      \n    input surface_ : pygame.Surface\n      \n    This is an optional surface that can be passed to the shader to improve the performances \n    and to avoid a new surface to be generated every iterations. The surface size must match \n    exactly the reduce texture dimensions otherwise an exception will be raise. \n    see reduce_factor_ option to determine the cloud texture size that will be processed.\n    \n\n    * CLOUD ORIENTATION / DIRECTION \n     \n    input transpose_ = True | False,\n    \n    transpose_ = True, this will transpose the final array \n    for e.g :  \n    If the final cloud texture is (w, h) after setting the transpose flag, the final \n    cloud texture will become (h, w). As a result the cloud effect will be transversal (starting \n    from the right of the display to the left side). \n    You can always transpose / flip the texture to get the right cloud orientation  \n    \n    * FINAL TOUCH\n    \n    input blur_ : True | False\n    \n    This will will blur the cloud effect for a more realistic appearance, remove all the jagged \n    edge when and pixelated effect\n    \n    :param width_               : integer; Texture size (width) \n    :param height_              : integer; Texture size (height)\n    :param factor_              : float; Floating value used to control the size of the cloud\n                                  effect. Value must be in range [3.95 ... 4.2]. Value > 3.95 \n                                  will contain the smoke/ cloud effect within the display. \n                      ""            Values < 3.95 will enlarge the smoke effect.                              \n    :param palette_             : numpy.ndarray or cython memoryview containing the color for the \n                                  cloud effect (buffer containing mapped RGB colors (uint values))\n    :param cloud_               : numpy.ndarray shape (w, h) containing float values \n                                  (cloud intensity). For better performance it is advised to set the\n                                  array to the size of the texture after applying the \n                                  reduction_factor_. For example if the reduction_factor_ is 2, \n                                  the texture would have to be width >> 1 and height >> 1 and the \n                                  cloud_ array should be equivalent to numpy.empty((height >> 1, \n                                  width >> 1), float32)\n    :param reduce_factor_       : integer; unsigned short int ; Can be either 0, 1, 2, 3, 4. \n                                  2 and 3 provide the best performance and the best looking effect.\n    :param cloud_intensity_     : integer; Determine the amount of smoke the cloud\n                                  effect will generate at the base of the effect (value must be in \n                                  range [0 .. 260]). If you provide zero a random value between \n                                  0 ... 260 will be assigned. If you provide 250, a random value \n                                  between 250 and 260 will be set for the amount of smoke. \n                                  The highest the value, the more dense the cloud effect will be\n    :param smooth_              : boolean; True use a smoothscale (bi-linear filtering) or\n                                  False -> scale algorithm jagged edges (mush faster)\n    :param bloom_               : True | False, Add a bloom effect when the flag is set to True\n                                  Th""e bloom effect will smooth the cloud and create a dense smoke \n                                  areas where the cloud is the brightest.  \n    :param fast_bloom_          : True | False; This set a fast algorithm for the bloom effect (the \n                                  bloom effect will use the smallest texture)\n    :param bpf_threshold_       : integer; Bright pass filter value must be in range [ 0 ... 255]\n                                  0 produce the maximum bloom effect\n    :param low_                 : integer; must be in range [ 0 ... width_], left position of the \n                                  cloud effect \n    :param high_                : integer; must be in range [ 0 ... height_], right position of the\n                                  cloud effect\n    :param brightness_          : True | False; Increase the brightness of the cloud effect when \n                                  True\n    :param brightness_intensity_: float; Set the brightness intensity of the cloud. The value must \n                                  be in range [-1.0 ... +1.0]. Changing the value overtime will \n                                  generate a realistic cloud effect. Negative value will generate \n                                  translucent patch of smoke on the background image\n    :param surface_             : Pygame.Surface; Pass a surface to the shader for\n                                  better performance, otherwise a new surface will be created each \n                                  calls.\n    :param transpose_           : boolean; Transpose the array (w, h) become (h, w).\n                                  The cloud effect will start from the left and move to the right\n    :param blur_                : boolean; Blur the cloud effect\n    :return                     : Return a pygame surface that can be blit directly to the game \n                                  display\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_89cloud_effect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_width_;
      int __pyx_v_height_;
      float __pyx_v_factor_;
      __Pyx_memviewslice __pyx_v_palette_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_cloud_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned short __pyx_v_reduce_factor_;
      unsigned short __pyx_v_cloud_intensity_;
      int __pyx_v_smooth_;
      int __pyx_v_bloom_;
      int __pyx_v_fast_bloom_;
      unsigned char __pyx_v_bpf_threshold_;
      unsigned int __pyx_v_low_;
      unsigned int __pyx_v_high_;
      int __pyx_v_brightness_;
      float __pyx_v_brightness_intensity_;
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_transpose_;
      int __pyx_v_blur_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cloud_effect (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width_2,&__pyx_n_s_height_2,&__pyx_n_s_factor,&__pyx_n_s_palette,&__pyx_n_s_cloud,&__pyx_n_s_reduce_factor,&__pyx_n_s_cloud_intensity,&__pyx_n_s_smooth,&__pyx_n_s_bloom,&__pyx_n_s_fast_bloom,&__pyx_n_s_bpf_threshold_2,&__pyx_n_s_low,&__pyx_n_s_high,&__pyx_n_s_brightness,&__pyx_n_s_brightness_intensity,&__pyx_n_s_surface,&__pyx_n_s_transpose,&__pyx_n_s_blur,0};
        PyObject* values[18] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_88cloud_effect(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, unsigned short __pyx_v_reduce_factor_, unsigned short __pyx_v_cloud_intensity_, int __pyx_v_smooth_, int __pyx_v_bloom_, int __pyx_v_fast_bloom_, unsigned char __pyx_v_bpf_threshold_, unsigned int __pyx_v_low_, unsigned int __pyx_v_high_, int __pyx_v_brightness_, float __pyx_v_brightness_intensity_, PyObject *__pyx_v_surface_, int __pyx_v_transpose_, int __pyx_v_blur_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cloud_effect", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_palette_.memview)) { __Pyx_RaiseUnboundLocalError("palette_"); __PYX_ERR(1, 1732, __pyx_L1_error) }
      if (unlikely(!__pyx_v_cloud_.memview)) { __Pyx_RaiseUnboundLocalError("cloud_"); __PYX_ERR(1, 1732, __pyx_L1_error) }
      __pyx_t_2.__pyx_n = 13;
      __pyx_t_2.reduce_factor_ = __pyx_v_reduce_factor_;
      __pyx_t_2.cloud_intensity_ = __pyx_v_cloud_intensity_;
      __pyx_t_2.smooth_ = __pyx_v_smooth_;
      __pyx_t_2.bloom_ = __pyx_v_bloom_;
      __pyx_t_2.fast_bloom_ = __pyx_v_fast_bloom_;
      __pyx_t_2.bpf_threshold_ = __pyx_v_bpf_threshold_;
      __pyx_t_2.low_ = __pyx_v_low_;
      __pyx_t_2.high_ = __pyx_v_high_;
      __pyx_t_2.brightness_ = __pyx_v_brightness_;
      __pyx_t_2.brightness_intensity_ = __pyx_v_brightness_intensity_;
      __pyx_t_2.surface_ = __pyx_v_surface_;
      __pyx_t_2.transpose_ = __pyx_v_transpose_;
      __pyx_t_2.blur_ = __pyx_v_blur_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_cloud_effect(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1732, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_cloud_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1733:         int width_,

     1734:         int height_,

     1735:         float factor_,

     1736:         unsigned int [::1] palette_,

     1737:         float [:, ::1] cloud_,

     1738:

     1739:         # OPTIONAL

     1740:         unsigned short int reduce_factor_   = 2,

     1741:         unsigned short int cloud_intensity_ = 16,

    +1742:         bint smooth_                        = True,

      int __pyx_v_smooth_ = ((int)1);
    /* … */
          __pyx_v_smooth_ = ((int)1);
        }
        if (values[8]) {
          __pyx_v_bloom_ = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1743, __pyx_L3_error)
        } else {

    +1743:         bint bloom_                         = False,

      int __pyx_v_bloom_ = ((int)0);
    /* … */
          __pyx_v_bloom_ = ((int)0);
        }
        if (values[9]) {
          __pyx_v_fast_bloom_ = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_fast_bloom_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1744, __pyx_L3_error)
        } else {

    +1744:         bint fast_bloom_                    = True,

      int __pyx_v_fast_bloom_ = ((int)1);
      unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0x80);
      unsigned int __pyx_v_low_ = ((unsigned int)0);
      unsigned int __pyx_v_high_ = ((unsigned int)0);
    /* … */
          __pyx_v_fast_bloom_ = ((int)1);
        }
        if (values[10]) {
          __pyx_v_bpf_threshold_ = __Pyx_PyInt_As_unsigned_char(values[10]); if (unlikely((__pyx_v_bpf_threshold_ == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 1745, __pyx_L3_error)
        } else {
          __pyx_v_bpf_threshold_ = ((unsigned char)0x80);
        }
        if (values[11]) {
          __pyx_v_low_ = __Pyx_PyInt_As_unsigned_int(values[11]); if (unlikely((__pyx_v_low_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1746, __pyx_L3_error)
        } else {
          __pyx_v_low_ = ((unsigned int)0);
        }
        if (values[12]) {
          __pyx_v_high_ = __Pyx_PyInt_As_unsigned_int(values[12]); if (unlikely((__pyx_v_high_ == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1747, __pyx_L3_error)
        } else {
          __pyx_v_high_ = ((unsigned int)0);
        }
        if (values[13]) {
          __pyx_v_brightness_ = __Pyx_PyObject_IsTrue(values[13]); if (unlikely((__pyx_v_brightness_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1748, __pyx_L3_error)
        } else {

     1745:         unsigned char bpf_threshold_        = 128,

     1746:         unsigned int low_                   = 0,

     1747:         unsigned int high_                  = 0,

    +1748:         bint brightness_                    = False,

      int __pyx_v_brightness_ = ((int)0);
      float __pyx_v_brightness_intensity_ = ((float)0.0);
    /* … */
          __pyx_v_brightness_ = ((int)0);
        }
        if (values[14]) {
          __pyx_v_brightness_intensity_ = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_brightness_intensity_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1749, __pyx_L3_error)
        } else {
          __pyx_v_brightness_intensity_ = ((float)0.0);
        }
        __pyx_v_surface_ = values[15];
        if (values[16]) {
          __pyx_v_transpose_ = __Pyx_PyObject_IsTrue(values[16]); if (unlikely((__pyx_v_transpose_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1751, __pyx_L3_error)
        } else {

     1749:         float brightness_intensity_         = 0.0,

    +1750:         object surface_                     = None,

      PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);
    /* … */
        values[15] = ((PyObject *)Py_None);
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width_2)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 1); __PYX_ERR(1, 1732, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 2); __PYX_ERR(1, 1732, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 3); __PYX_ERR(1, 1732, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cloud)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, 4); __PYX_ERR(1, 1732, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reduce_factor);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cloud_intensity);
              if (value) { values[6] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smooth);
              if (value) { values[7] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bloom);
              if (value) { values[8] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fast_bloom);
              if (value) { values[9] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 10:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bpf_threshold_2);
              if (value) { values[10] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 11:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_low);
              if (value) { values[11] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 12:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_high);
              if (value) { values[12] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 13:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness);
              if (value) { values[13] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 14:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_brightness_intensity);
              if (value) { values[14] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 15:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface);
              if (value) { values[15] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 16:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transpose);
              if (value) { values[16] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case 17:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blur);
              if (value) { values[17] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cloud_effect") < 0)) __PYX_ERR(1, 1732, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
            CYTHON_FALLTHROUGH;
            case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
            CYTHON_FALLTHROUGH;
            case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
            CYTHON_FALLTHROUGH;
            case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
            CYTHON_FALLTHROUGH;
            case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
            CYTHON_FALLTHROUGH;
            case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
            CYTHON_FALLTHROUGH;
            case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
            CYTHON_FALLTHROUGH;
            case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
            CYTHON_FALLTHROUGH;
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_width_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1733, __pyx_L3_error)
        __pyx_v_height_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1734, __pyx_L3_error)
        __pyx_v_factor_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_factor_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 1735, __pyx_L3_error)
        __pyx_v_palette_ = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_palette_.memview)) __PYX_ERR(1, 1736, __pyx_L3_error)
        __pyx_v_cloud_ = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_cloud_.memview)) __PYX_ERR(1, 1737, __pyx_L3_error)
        if (values[5]) {
          __pyx_v_reduce_factor_ = __Pyx_PyInt_As_unsigned_short(values[5]); if (unlikely((__pyx_v_reduce_factor_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1740, __pyx_L3_error)
        } else {
          __pyx_v_reduce_factor_ = ((unsigned short)2);
        }
        if (values[6]) {
          __pyx_v_cloud_intensity_ = __Pyx_PyInt_As_unsigned_short(values[6]); if (unlikely((__pyx_v_cloud_intensity_ == (unsigned short)-1) && PyErr_Occurred())) __PYX_ERR(1, 1741, __pyx_L3_error)
        } else {
          __pyx_v_cloud_intensity_ = ((unsigned short)16);
        }
        if (values[7]) {
          __pyx_v_smooth_ = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smooth_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1742, __pyx_L3_error)
        } else {

    +1751:         bint transpose_                     = False,

      int __pyx_v_transpose_ = ((int)0);
    /* … */
          __pyx_v_transpose_ = ((int)0);
        }
        if (values[17]) {
          __pyx_v_blur_ = __Pyx_PyObject_IsTrue(values[17]); if (unlikely((__pyx_v_blur_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 1752, __pyx_L3_error)
        } else {

    +1752:         bint blur_                          = True

      int __pyx_v_blur_ = ((int)1);
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cloud_effect", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_cloud_intensity_ = __pyx_optional_args->cloud_intensity_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_smooth_ = __pyx_optional_args->smooth_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_bloom_ = __pyx_optional_args->bloom_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                    if (__pyx_optional_args->__pyx_n > 6) {
                      __pyx_v_low_ = __pyx_optional_args->low_;
                      if (__pyx_optional_args->__pyx_n > 7) {
                        __pyx_v_high_ = __pyx_optional_args->high_;
                        if (__pyx_optional_args->__pyx_n > 8) {
                          __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                          if (__pyx_optional_args->__pyx_n > 9) {
                            __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                            if (__pyx_optional_args->__pyx_n > 10) {
                              __pyx_v_surface_ = __pyx_optional_args->surface_;
                              if (__pyx_optional_args->__pyx_n > 11) {
                                __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                if (__pyx_optional_args->__pyx_n > 12) {
                                  __pyx_v_blur_ = __pyx_optional_args->blur_;
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    /* … */
          __pyx_v_blur_ = ((int)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("cloud_effect", 0, 5, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1732, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.cloud_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_88cloud_effect(__pyx_self, __pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, __pyx_v_reduce_factor_, __pyx_v_cloud_intensity_, __pyx_v_smooth_, __pyx_v_bloom_, __pyx_v_fast_bloom_, __pyx_v_bpf_threshold_, __pyx_v_low_, __pyx_v_high_, __pyx_v_brightness_, __pyx_v_brightness_intensity_, __pyx_v_surface_, __pyx_v_transpose_, __pyx_v_blur_);

     1753:         ):

     1754:     """

     1755:     GENERATE CLOUD /SMOKE ON THE GAME DISPLAY

     1756:

     1757:     * CLOUD TEXTURE SIZES

     1758:

     1759:     input width_  : integer,

     1760:     input height_ : integer

     1761:

     1762:     width_ and height_ values define the size of the texture e.g Surface(width x height)

     1763:

     1764:     * CLOUD ASPECT (CONTROL OVER THE WIDTH):

     1765:

     1766:     inputs low_ : integer

     1767:     input high_ : integer

     1768:

     1769:     Optional arguments low_ & high_ (integer values) define the width 's limits of the cloud

     1770:     effect. low_ for the starting point and high_ for the ending of the effect.

     1771:     e.g low_ = 10 and high_ = 200. The cloud effect will be contain within width = 10 and 200

     1772:     low_ & high_ values must be in range [0 ... width_]

     1773:

     1774:     * CLOUD HEIGHT:

     1775:

     1776:     input factor_ : float

     1777:

     1778:     The cloud maximum height can be adjust with the variable factor_ (float value)

     1779:     value > 3.95 will contain the effect within the display

     1780:     value < 3.95 will enlarge the effect over the display height

     1781:     Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually

     1782:     to contain the cloud effect within the display

     1783:

     1784:     * SPEED CONSIDERATION

     1785:

     1786:     input reduce_factor_ : integer

     1787:

     1788:     The argument reduce_factor_ control the size of the texture to be processed

     1789:     e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)

     1790:     Smaller texture improve the overall performances but will slightly degrade the cloud aspect,

     1791:     especially if the blur and smooth option are not enabled.

     1792:     Recommended value for reduce_factor_ is 3 (fast process)

     1793:     reduce_factor_ values must be an integer in range [ 0 ... 4]

     1794:     The reduce_factor_ value will have a significant impact on the cloud effect maximum height,

     1795:     adjust the argument factor_ accordingly

     1796:

     1797:     * CLOUD INTENSITY AT THE SOURCE

     1798:

     1799:     input cloud_intensity_: integer

     1800:

     1801:     Set the cloud intensity with the variable cloud_intensity_, 0 low flame,

     1802:     32 maximum flame effect

     1803:     Values must be an int in range [0 ... 32]

     1804:

     1805:     * SMOOTHING THE EFFECT

     1806:

     1807:     input smooth_: True | False

     1808:

     1809:     When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear

     1810:     filtering) or False the final texture will be adjust with the scale function.

     1811:     Set this variable to False if you need the best performance for the effect or if you require

     1812:     a pixelated cloud effect. Otherwise set the variable to True for a more realistic effect.

     1813:

     1814:     * BLOOM EFFECT

     1815:

     1816:     input bloom_         : True | False

     1817:     input fast_bloom_    : True | False

     1818:     input bpf_threshold_ : integer

     1819:

     1820:     Bloom effect produce a bright and smooth light effect to the background texture where the cloud

     1821:     intensity is at its maximum.

     1822:     Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances

     1823:     The flag fast_bloom_ define a very fast bloom algo using only the smallest texture

     1824:     to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect

     1825:     project for more details.

     1826:     When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will

     1827:     produce a more realistic cloud effect (this will slightly degrade the overall performances).

     1828:     If the cloud effect is too bright, you can always adjust the bright pass filter value

     1829:     bpf_threshold_(this will adjust the bloom intensity)

     1830:     bpf_threshold_ value must be in range [ 0 ... 255]

     1831:     Below 128 the bloom effect will be more noticeable and above 128 only the brightest

     1832:     area will be enhanced.

     1833:

     1834:     * LIGHT EFFECT INTENSITY

     1835:

     1836:     input brightness_            : True | False

     1837:     input brightness_intensity_  : float

     1838:

     1839:     When the flag is set to True, the algorithm will use an external function,

     1840:     <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture

     1841:     A custom color can be passed to the function defining the pixels to be ignored during the

     1842:     process (default is black color).

     1843:     the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness

     1844:     of the cloud effect and positive values will increase the brightness of the effect (causing

     1845:     bright white patches on the cloud texture).

     1846:     Values below -0.4 will cause the cloud effect to be translucent

     1847:

     1848:

     1849:     * OPTIONAL SURFACE

     1850:

     1851:     input surface_ : pygame.Surface

     1852:

     1853:     This is an optional surface that can be passed to the shader to improve the performances

     1854:     and to avoid a new surface to be generated every iterations. The surface size must match

     1855:     exactly the reduce texture dimensions otherwise an exception will be raise.

     1856:     see reduce_factor_ option to determine the cloud texture size that will be processed.

     1857:

     1858:

     1859:     * CLOUD ORIENTATION / DIRECTION

     1860:

     1861:     input transpose_ = True | False,

     1862:

     1863:     transpose_ = True, this will transpose the final array

     1864:     for e.g :

     1865:     If the final cloud texture is (w, h) after setting the transpose flag, the final

     1866:     cloud texture will become (h, w). As a result the cloud effect will be transversal (starting

     1867:     from the right of the display to the left side).

     1868:     You can always transpose / flip the texture to get the right cloud orientation

     1869:

     1870:     * FINAL TOUCH

     1871:

     1872:     input blur_ : True | False

     1873:

     1874:     This will will blur the cloud effect for a more realistic appearance, remove all the jagged

     1875:     edge when and pixelated effect

     1876:

     1877:     :param width_               : integer; Texture size (width)

     1878:     :param height_              : integer; Texture size (height)

     1879:     :param factor_              : float; Floating value used to control the size of the cloud

     1880:                                   effect. Value must be in range [3.95 ... 4.2]. Value > 3.95

     1881:                                   will contain the smoke/ cloud effect within the display.

     1882:                                   Values < 3.95 will enlarge the smoke effect.

     1883:     :param palette_             : numpy.ndarray or cython memoryview containing the color for the

     1884:                                   cloud effect (buffer containing mapped RGB colors (uint values))

     1885:     :param cloud_               : numpy.ndarray shape (w, h) containing float values

     1886:                                   (cloud intensity). For better performance it is advised to set the

     1887:                                   array to the size of the texture after applying the

     1888:                                   reduction_factor_. For example if the reduction_factor_ is 2,

     1889:                                   the texture would have to be width >> 1 and height >> 1 and the

     1890:                                   cloud_ array should be equivalent to numpy.empty((height >> 1,

     1891:                                   width >> 1), float32)

     1892:     :param reduce_factor_       : integer; unsigned short int ; Can be either 0, 1, 2, 3, 4.

     1893:                                   2 and 3 provide the best performance and the best looking effect.

     1894:     :param cloud_intensity_     : integer; Determine the amount of smoke the cloud

     1895:                                   effect will generate at the base of the effect (value must be in

     1896:                                   range [0 .. 260]). If you provide zero a random value between

     1897:                                   0 ... 260 will be assigned. If you provide 250, a random value

     1898:                                   between 250 and 260 will be set for the amount of smoke.

     1899:                                   The highest the value, the more dense the cloud effect will be

     1900:     :param smooth_              : boolean; True use a smoothscale (bi-linear filtering) or

     1901:                                   False -> scale algorithm jagged edges (mush faster)

     1902:     :param bloom_               : True | False, Add a bloom effect when the flag is set to True

     1903:                                   The bloom effect will smooth the cloud and create a dense smoke

     1904:                                   areas where the cloud is the brightest.

     1905:     :param fast_bloom_          : True | False; This set a fast algorithm for the bloom effect (the

     1906:                                   bloom effect will use the smallest texture)

     1907:     :param bpf_threshold_       : integer; Bright pass filter value must be in range [ 0 ... 255]

     1908:                                   0 produce the maximum bloom effect

     1909:     :param low_                 : integer; must be in range [ 0 ... width_], left position of the

     1910:                                   cloud effect

     1911:     :param high_                : integer; must be in range [ 0 ... height_], right position of the

     1912:                                   cloud effect

     1913:     :param brightness_          : True | False; Increase the brightness of the cloud effect when

     1914:                                   True

     1915:     :param brightness_intensity_: float; Set the brightness intensity of the cloud. The value must

     1916:                                   be in range [-1.0 ... +1.0]. Changing the value overtime will

     1917:                                   generate a realistic cloud effect. Negative value will generate

     1918:                                   translucent patch of smoke on the background image

     1919:     :param surface_             : Pygame.Surface; Pass a surface to the shader for

     1920:                                   better performance, otherwise a new surface will be created each

     1921:                                   calls.

     1922:     :param transpose_           : boolean; Transpose the array (w, h) become (h, w).

     1923:                                   The cloud effect will start from the left and move to the right

     1924:     :param blur_                : boolean; Blur the cloud effect

     1925:     :return                     : Return a pygame surface that can be blit directly to the game

     1926:                                   display

     1927:     """

     1928:

    +1929:     assert reduce_factor_ in (0, 1, 2, 3, 4), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        switch (__pyx_v_reduce_factor_) {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          __pyx_t_1 = 1;
          break;
          default:
          __pyx_t_1 = 0;
          break;
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_reduce_factor_must_be_i);
          __PYX_ERR(1, 1929, __pyx_L1_error)
        }
      }
      #endif

     1930:         "Argument reduce factor must be in range 0 ... 4 " \

     1931:         "\n reduce_factor_ = 1 correspond to dividing the image size by 2" \

     1932:         "\n reduce_factor_ = 2 correspond to dividing the image size by 4"

     1933:

    +1934:     assert width_ > 0 and height_ > 0, "Argument width or height cannot be null or < 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = ((__pyx_v_width_ > 0) != 0);
        if (__pyx_t_2) {
        } else {
          __pyx_t_1 = __pyx_t_2;
          goto __pyx_L3_bool_binop_done;
        }
        __pyx_t_2 = ((__pyx_v_height_ > 0) != 0);
        __pyx_t_1 = __pyx_t_2;
        __pyx_L3_bool_binop_done:;
        if (unlikely(!__pyx_t_1)) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_width_or_height_cannot);
          __PYX_ERR(1, 1934, __pyx_L1_error)
        }
      }
      #endif

    +1935:     assert factor_ > 0, "Argument factor_ cannot be null or < 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_factor_ > 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__cannot_be_null);
          __PYX_ERR(1, 1935, __pyx_L1_error)
        }
      }
      #endif

     1936:

    +1937:     return shader_cloud_effect_c(

      __Pyx_XDECREF(__pyx_r);
    /* … */
      __pyx_t_4.__pyx_n = 13;
      __pyx_t_4.reduce_factor_ = __pyx_v_reduce_factor_;
      __pyx_t_4.cloud_intensity_ = __pyx_v_cloud_intensity_;
      __pyx_t_4.smooth_ = __pyx_v_smooth_;
      __pyx_t_4.bloom_ = __pyx_v_bloom_;
      __pyx_t_4.fast_bloom_ = __pyx_v_fast_bloom_;
      __pyx_t_4.bpf_threshold_ = __pyx_v_bpf_threshold_;
      __pyx_t_4.low_ = __pyx_v_low_;
      __pyx_t_4.high_ = __pyx_v_high_;
      __pyx_t_4.brightness_ = __pyx_v_brightness_;
      __pyx_t_4.brightness_intensity_ = __pyx_v_brightness_intensity_;
      __pyx_t_4.surface_ = __pyx_v_surface_;
      __pyx_t_4.transpose_ = __pyx_v_transpose_;
      __pyx_t_4.blur_ = __pyx_v_blur_;
      __pyx_t_3 = __pyx_f_12PygameShader_6shader_shader_cloud_effect_c(__pyx_v_width_, __pyx_v_height_, __pyx_v_factor_, __pyx_v_palette_, __pyx_v_cloud_, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1937, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     1938:         width_, height_, factor_, palette_, cloud_,

     1939:         reduce_factor_, cloud_intensity_, smooth_,

     1940:         bloom_, fast_bloom_, bpf_threshold_, low_, high_, brightness_,

     1941:         brightness_intensity_, surface_, transpose_, blur_

     1942:     )

     1943:

     1944:

     1945:

    +1946: cpdef inline mirroring_array(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_array(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring_array", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_AddTraceback("PygameShader.shader.mirroring_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_90mirroring_array[] = "\n    \n    SHADER MIRRORING\n\n    This method create a mirror image \n    \n    Compatible 24 - 32 bit image / surface\n    \n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return         : returns a numpy ndarray shape (w, h, 3) \n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_91mirroring_array(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring_array (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_90mirroring_array(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_90mirroring_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring_array", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_mirroring_array(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1946, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.mirroring_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1947:     """

     1948:

     1949:     SHADER MIRRORING

     1950:

     1951:     This method create a mirror image

     1952:

     1953:     Compatible 24 - 32 bit image / surface

     1954:

     1955:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     1956:     :return         : returns a numpy ndarray shape (w, h, 3)

     1957:

     1958:     """

    +1959:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1959, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1960:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1960, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1959, __pyx_L1_error)
        }
      }
      #endif

     1961:

    +1962:     return mirroring_c(pixels3d(surface_))

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1962, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_f_12PygameShader_6shader_mirroring_c(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     1963:

     1964:

     1965:

     1966:

    +1967: cpdef inline void mirroring(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_mirroring(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.mirroring", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_92mirroring[] = "\n    SHADER MIRRORING (INPLACE)\n\n    This method create a mirror image \n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_93mirroring(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_92mirroring(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_92mirroring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_mirroring(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1967, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.mirroring", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1968:     """

     1969:     SHADER MIRRORING (INPLACE)

     1970:

     1971:     This method create a mirror image

     1972:

     1973:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     1974:     :return : void

     1975:     """

    +1976:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1976, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1977:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1977, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1976, __pyx_L1_error)
        }
      }
      #endif

     1978:

    +1979:     mirroring_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1979, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_f_12PygameShader_6shader_mirroring_inplace_c(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     1980:

     1981: # cpdef inline transpose_inplace(object surface_):

     1982: #     return tranpose_c(pixels3d(surface_))

     1983:

     1984:

     1985:

     1986:

    +1987: cpdef inline void sharpen(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_sharpen(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sharpen", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.sharpen", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_94sharpen[] = "\n    \n    SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return         : void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_95sharpen(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sharpen (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_94sharpen(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_94sharpen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("sharpen", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_sharpen(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.sharpen", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     1988:     """

     1989:

     1990:     SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.

     1991:

     1992:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     1993:     :return         : void

     1994:     """

    +1995:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1995, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +1996:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1996, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 1995, __pyx_L1_error)
        }
      }
      #endif

     1997:

    +1998:     shader_sharpen_filter_inplace_c(pixels3d(surface_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1998, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1998, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 1998, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_f_12PygameShader_6shader_shader_sharpen_filter_inplace_c(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     1999:

     2000:

    +2001: cpdef inline void dirt_lens(

    static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens(PyObject *__pyx_v_surface_, PyObject *__pyx_v_lens_model_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens *__pyx_optional_args) {
      int __pyx_v_flag_ = __pyx_k__15;
      float __pyx_v_light_ = ((float)0.0);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dirt_lens", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_flag_ = __pyx_optional_args->flag_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_light_ = __pyx_optional_args->light_;
          }
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_96dirt_lens[] = "\n    DIRT LENS EFFECT \n    \n    This function display a dirt lens texture on the top of your game display to \n    simulate a camera artefact or realistic camera effect when the light from the\n    scene is oriented directly toward the camera. \n    \n    Choose a lens texture from the Assets directory (free textures provided in Assets directory \n    of this project). All textures are sizes 5184x3456 and would have to be re-sized to  \n    your game display and used by function `dirt_lens`. \n    The function dirt_lens will not resize the texture for you.\n    \n    The setting light_ is a float values cap between -1.0 to 0.2 and allow you to increase the \n    light source oriented toward the camera. Values <0.0 will decrease the lens dirt \n    effect and values >0.0 will increase the brightness of the display and increase the \n    amount of dirt on the camera lens (your display).\n    \n    Optionally the setting flag_ can be changed from BLEND_RGB_ADD to any other pygame optional \n    flags value. BLEND_RGB_ADD is the default setting and allow the pixels from the dirt lens \n    texture to be blended (added) to the display and provide the brightest and better looking \n    effect. \n    \n    This effect can be used for real time rendering for surfaces resolution 1024x768  \n    \n    Assets/Bokeh__Lens_Dirt_9.jpg\n    Assets/Bokeh__Lens_Dirt_38.jpg\n    Assets/Bokeh__Lens_Dirt_46.jpg\n    Assets/Bokeh__Lens_Dirt_50.jpg\n    Assets/Bokeh__Lens_Dirt_54.jpg\n    Assets/Bokeh__Lens_Dirt_67.jpg\n    \n    :param surface_   : Surface 24 - 32 bit represent the surface or the display \n    \n    :param lens_model_: Surface The Lens model is a pygame Surface. PygameShader provide a 6 \n     different surfaces that can be used as a layer to generate a dirt lens effect on your game \n     display. See above for the name of the free dirt lens textures. \n     The texture has to be loaded prior calling this effect and passed as an argument. By default \n     the textu""res sizes are 5184x3456 (width & height). The texture would have also to be re-scale \n     once to the game display dimensions (e.g 1027x768) or to the size of your texture.\n     \n    :param flag_      : integer; pygame flags such as BLEND_RGB_ADD, BLEND_RGB_MAX etc. These flags \n     will change the overall appearance of the effect blending the dirt lens\n     image with a different mathematical expression. BLEND_RGB_ADD is the \n     default flag and blend together the dirt_lens and the game display \n     providing a very bright aspect and vivid effect.\n    \n    :param light_     : float; Float value cap between [-1.0 ... 0.2] to increase or decrease \n     the overall brightness of the dirt lens texture. Tis setting can be used to simulate a \n     texture transition when sweeping the values from -1.0 toward 0.2 by a small increment.\n     Values < 0 will tend to diminish the effect and values > 0 will increase the brightness \n     and the dirt lens effect. \n     \n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_97dirt_lens(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      PyObject *__pyx_v_lens_model_ = 0;
      int __pyx_v_flag_;
      float __pyx_v_light_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dirt_lens (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_lens_model,&__pyx_n_s_flag,&__pyx_n_s_light,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lens_model)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("dirt_lens", 0, 2, 4, 1); __PYX_ERR(1, 2001, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_light);
              if (value) { values[3] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dirt_lens") < 0)) __PYX_ERR(1, 2001, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_lens_model_ = values[1];
        if (values[2]) {
          __pyx_v_flag_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_flag_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L3_error)
        } else {
          __pyx_v_flag_ = __pyx_k__15;
        }
        if (values[3]) {
          __pyx_v_light_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_light_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2005, __pyx_L3_error)
        } else {
          __pyx_v_light_ = ((float)0.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("dirt_lens", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2001, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_96dirt_lens(__pyx_self, __pyx_v_surface_, __pyx_v_lens_model_, __pyx_v_flag_, __pyx_v_light_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_96dirt_lens(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_lens_model_, int __pyx_v_flag_, float __pyx_v_light_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dirt_lens", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 2;
      __pyx_t_1.flag_ = __pyx_v_flag_;
      __pyx_t_1.light_ = __pyx_v_light_;
      __pyx_f_12PygameShader_6shader_dirt_lens(__pyx_v_surface_, __pyx_v_lens_model_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2001, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.dirt_lens", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2002:         object surface_,

     2003:         object lens_model_,

    +2004:         int flag_=BLEND_RGB_ADD,

      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2004, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_k__15 = __pyx_t_7;
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2004, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
    /* … */
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2004, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_k__15 = __pyx_t_7;

     2005:         float light_ = 0.0

     2006: ):

     2007:     """

     2008:     DIRT LENS EFFECT

     2009:

     2010:     This function display a dirt lens texture on the top of your game display to

     2011:     simulate a camera artefact or realistic camera effect when the light from the

     2012:     scene is oriented directly toward the camera.

     2013:

     2014:     Choose a lens texture from the Assets directory (free textures provided in Assets directory

     2015:     of this project). All textures are sizes 5184x3456 and would have to be re-sized to

     2016:     your game display and used by function `dirt_lens`.

     2017:     The function dirt_lens will not resize the texture for you.

     2018:

     2019:     The setting light_ is a float values cap between -1.0 to 0.2 and allow you to increase the

     2020:     light source oriented toward the camera. Values <0.0 will decrease the lens dirt

     2021:     effect and values >0.0 will increase the brightness of the display and increase the

     2022:     amount of dirt on the camera lens (your display).

     2023:

     2024:     Optionally the setting flag_ can be changed from BLEND_RGB_ADD to any other pygame optional

     2025:     flags value. BLEND_RGB_ADD is the default setting and allow the pixels from the dirt lens

     2026:     texture to be blended (added) to the display and provide the brightest and better looking

     2027:     effect.

     2028:

     2029:     This effect can be used for real time rendering for surfaces resolution 1024x768

     2030:

     2031:     Assets/Bokeh__Lens_Dirt_9.jpg

     2032:     Assets/Bokeh__Lens_Dirt_38.jpg

     2033:     Assets/Bokeh__Lens_Dirt_46.jpg

     2034:     Assets/Bokeh__Lens_Dirt_50.jpg

     2035:     Assets/Bokeh__Lens_Dirt_54.jpg

     2036:     Assets/Bokeh__Lens_Dirt_67.jpg

     2037:

     2038:     :param surface_   : Surface 24 - 32 bit represent the surface or the display

     2039:

     2040:     :param lens_model_: Surface The Lens model is a pygame Surface. PygameShader provide a 6

     2041:      different surfaces that can be used as a layer to generate a dirt lens effect on your game

     2042:      display. See above for the name of the free dirt lens textures.

     2043:      The texture has to be loaded prior calling this effect and passed as an argument. By default

     2044:      the textures sizes are 5184x3456 (width & height). The texture would have also to be re-scale

     2045:      once to the game display dimensions (e.g 1027x768) or to the size of your texture.

     2046:

     2047:     :param flag_      : integer; pygame flags such as BLEND_RGB_ADD, BLEND_RGB_MAX etc. These flags

     2048:      will change the overall appearance of the effect blending the dirt lens

     2049:      image with a different mathematical expression. BLEND_RGB_ADD is the

     2050:      default flag and blend together the dirt_lens and the game display

     2051:      providing a very bright aspect and vivid effect.

     2052:

     2053:     :param light_     : float; Float value cap between [-1.0 ... 0.2] to increase or decrease

     2054:      the overall brightness of the dirt lens texture. Tis setting can be used to simulate a

     2055:      texture transition when sweeping the values from -1.0 toward 0.2 by a small increment.

     2056:      Values < 0 will tend to diminish the effect and values > 0 will increase the brightness

     2057:      and the dirt lens effect.

     2058:

     2059:     :return: void

     2060:     """

    +2061:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2061, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2061, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2061, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2062:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2062, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2061, __pyx_L1_error)
        }
      }
      #endif

     2063:

    +2064:     assert PyObject_IsInstance(lens_model_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2064, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2064, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_lens_model_, __pyx_t_1); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2064, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2065:         "\nArgument lens_model_ must be a pygame.Surface type, got %s " % type(lens_model_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_lens_model__must_be_a, ((PyObject *)Py_TYPE(__pyx_v_lens_model_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2065, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2064, __pyx_L1_error)
        }
      }
      #endif

     2066:

    +2067:     assert PyObject_IsInstance(light_, float), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_light_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2067, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyFloat_Type))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2067, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2068:         "\nArgument light_ must be a float type, got %s " % type(light_)

          __pyx_t_1 = PyFloat_FromDouble(__pyx_v_light_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2068, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_light__must_be_a_float, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2068, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2067, __pyx_L1_error)
        }
      }
      #endif

     2069:

    +2070:     if light_ > 0.2:

      __pyx_t_3 = ((__pyx_v_light_ > 0.2) != 0);
      if (__pyx_t_3) {
    /* … */
        goto __pyx_L3;
      }

    +2071:         light_ = 0.2

        __pyx_v_light_ = 0.2;

    +2072:     elif light_ < -1.0:

      __pyx_t_3 = ((__pyx_v_light_ < -1.0) != 0);
      if (__pyx_t_3) {
    /* … */
      }
      __pyx_L3:;

    +2073:         light_ = 1.0

        __pyx_v_light_ = 1.0;

     2074:

    +2075:     assert PyObject_IsInstance(flag_, int), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2075, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyObject_IsInstance(__pyx_t_2, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2075, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2076:         "\nArgument flag_ must be a int type, got %s " % type(flag_)

          __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2076, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_flag__must_be_a_int_ty, ((PyObject *)Py_TYPE(__pyx_t_2))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2076, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2075, __pyx_L1_error)
        }
      }
      #endif

     2077:

    +2078:     dirt_lens_c(surface_, lens_model_, flag_, light_)

      __pyx_t_4.__pyx_n = 1;
      __pyx_t_4.light_ = __pyx_v_light_;
      __pyx_f_12PygameShader_6shader_dirt_lens_c(__pyx_v_surface_, __pyx_v_lens_model_, __pyx_v_flag_, &__pyx_t_4);

     2079:

     2080:

     2081: # *******************************************************************

     2082:

     2083: @cython.binding(False)

     2084: @cython.boundscheck(False)

     2085: @cython.wraparound(False)

     2086: @cython.nonecheck(False)

     2087: @cython.cdivision(True)

    +2088: cpdef inline void end_game(object surface):

    static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_end_game(CYTHON_UNUSED PyObject *__pyx_v_surface, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("end_game", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_WriteUnraisable("PygameShader.shader.end_game", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_98end_game[] = "\n    \n    :param surface: \n    :return: \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_99end_game(PyObject *__pyx_self, PyObject *__pyx_v_surface) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("end_game (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_98end_game(__pyx_self, ((PyObject *)__pyx_v_surface));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_98end_game(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("end_game", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_end_game(__pyx_v_surface, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.end_game", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2089:     """

     2090:

     2091:     :param surface:

     2092:     :return:

     2093:     """

    +2094:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2094, __pyx_L1_error)

     2095:

     2096: @cython.binding(False)

     2097: @cython.boundscheck(False)

     2098: @cython.wraparound(False)

     2099: @cython.nonecheck(False)

     2100: @cython.cdivision(True)

    +2101: cpdef inline void level_clear(object surface):

    static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_level_clear(CYTHON_UNUSED PyObject *__pyx_v_surface, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("level_clear", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_WriteUnraisable("PygameShader.shader.level_clear", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_100level_clear[] = "\n    \n    :param surface: \n    :return: \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_101level_clear(PyObject *__pyx_self, PyObject *__pyx_v_surface) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("level_clear (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_100level_clear(__pyx_self, ((PyObject *)__pyx_v_surface));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_100level_clear(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("level_clear", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_level_clear(__pyx_v_surface, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.level_clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2102:     """

     2103:

     2104:     :param surface:

     2105:     :return:

     2106:     """

    +2107:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2107, __pyx_L1_error)

     2108:

     2109: @cython.binding(False)

     2110: @cython.boundscheck(False)

     2111: @cython.wraparound(False)

     2112: @cython.nonecheck(False)

     2113: @cython.cdivision(True)

    +2114: cpdef object dithering(object surface_, int factor_=2):

    static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_dithering(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering *__pyx_optional_args) {
      int __pyx_v_factor_ = ((int)2);
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_factor_ = __pyx_optional_args->factor_;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_102dithering[] = "\n    Dithering is used in computer graphics to create the illusion of \"color depth\" in images with\n    a limited color palette - a technique also known as color quantization. In a dithered image,\n    colors that are not available in the palette are approximated by a diffusion of colored pixels\n    from within the available palette. The human eye perceives the diffusion as a mixture of \n    the colors within it (see color vision). Dithered images, particularly those with relatively\n     few colors, can often be distinguished by a characteristic graininess or speckled appearance\n    \n    Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format \n    (w, h, 3) type float (float32, single precision). \n    As the image is converted to a different data type format (uint8 to float32), \n    the transformation cannot be applied inplace. The image returned by the method dithering \n    is a copy of the original image.   \n    \n    :param surface_: Pygame surface format 24-32 bit \n    :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown \n    :return        : Surface; \n    \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_103dithering(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_factor_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_factor,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dithering") < 0)) __PYX_ERR(1, 2114, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_factor_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_factor_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2114, __pyx_L3_error)
        } else {
          __pyx_v_factor_ = ((int)2);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("dithering", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2114, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_102dithering(__pyx_self, __pyx_v_surface_, __pyx_v_factor_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_102dithering(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.factor_ = __pyx_v_factor_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_dithering(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.dithering", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2115:

     2116:     """

     2117:     Dithering is used in computer graphics to create the illusion of "color depth" in images with

     2118:     a limited color palette - a technique also known as color quantization. In a dithered image,

     2119:     colors that are not available in the palette are approximated by a diffusion of colored pixels

     2120:     from within the available palette. The human eye perceives the diffusion as a mixture of

     2121:     the colors within it (see color vision). Dithered images, particularly those with relatively

     2122:      few colors, can often be distinguished by a characteristic graininess or speckled appearance

     2123:

     2124:     Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format

     2125:     (w, h, 3) type float (float32, single precision).

     2126:     As the image is converted to a different data type format (uint8 to float32),

     2127:     the transformation cannot be applied inplace. The image returned by the method dithering

     2128:     is a copy of the original image.

     2129:

     2130:     :param surface_: Pygame surface format 24-32 bit

     2131:     :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown

     2132:     :return        : Surface;

     2133:

     2134:     """

    +2135:     assert PyObject_IsInstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2135, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2135, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2136:         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2135, __pyx_L1_error)
        }
      }
      #endif

     2137:

    +2138:     assert PyObject_IsInstance(factor_, int), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2138, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2138, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2139:         'Argument factor_ must be an int got %s ' % type(factor_)

          __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_factor__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2139, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 2138, __pyx_L1_error)
        }
      }
      #endif

     2140:

    +2141:     assert factor_ > 1, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_factor_ > 1) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_1);
          __PYX_ERR(1, 2141, __pyx_L1_error)
        }
      }
      #endif

     2142:         "Argument factor_ must be > 1"

     2143:

    +2144:     return dithering_c(numpy.divide(pixels3d(surface_), 255.0).astype(float32), factor_)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_divide); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_float_255_0};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_4, __pyx_float_255_0};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2144, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_4);
        __Pyx_INCREF(__pyx_float_255_0);
        __Pyx_GIVEREF(__pyx_float_255_0);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_float_255_0);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_float(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_f_12PygameShader_6shader_dithering_c(__pyx_t_9, __pyx_v_factor_); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     2145:

     2146: @cython.binding(False)

     2147: @cython.boundscheck(False)

     2148: @cython.wraparound(False)

     2149: @cython.nonecheck(False)

     2150: @cython.cdivision(True)

    +2151: cpdef inline void dithering_int(object surface_, int factor_=2):

    static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dithering_int *__pyx_optional_args) {
      int __pyx_v_factor_ = ((int)2);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering_int", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_factor_ = __pyx_optional_args->factor_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_104dithering_int[] = "\n    Dithering is used in computer graphics to create the illusion of \"color depth\" in images with\n    a limited color palette - a technique also known as color quantization. In a dithered image,\n    colors that are not available in the palette are approximated by a diffusion of colored pixels\n    from within the available palette. The human eye perceives the diffusion as a mixture of \n    the colors within it (see color vision). Dithered images, particularly those with relatively\n     few colors, can often be distinguished by a characteristic graininess or speckled appearance\n\n    Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format \n    (w, h, 3) type float (float32, single precision). \n    As the image is converted to a different data type format (uint8 to float32), \n    the transformation cannot be applied inplace. The image returned by the method dithering \n    is a copy of the original image.   \n\n    :param surface_: Pygame surface format 24-32 bit \n    :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown \n    :return        : Surface; \n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_105dithering_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_factor_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering_int (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_factor,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_factor);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dithering_int") < 0)) __PYX_ERR(1, 2151, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_factor_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_factor_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2151, __pyx_L3_error)
        } else {
          __pyx_v_factor_ = ((int)2);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("dithering_int", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2151, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_104dithering_int(__pyx_self, __pyx_v_surface_, __pyx_v_factor_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_104dithering_int(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_factor_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering_int", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.factor_ = __pyx_v_factor_;
      __pyx_f_12PygameShader_6shader_dithering_int(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.dithering_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2152:     """

     2153:     Dithering is used in computer graphics to create the illusion of "color depth" in images with

     2154:     a limited color palette - a technique also known as color quantization. In a dithered image,

     2155:     colors that are not available in the palette are approximated by a diffusion of colored pixels

     2156:     from within the available palette. The human eye perceives the diffusion as a mixture of

     2157:     the colors within it (see color vision). Dithered images, particularly those with relatively

     2158:      few colors, can often be distinguished by a characteristic graininess or speckled appearance

     2159:

     2160:     Take a pygame surface as argument format 24-32 bit and convert it to a 3d array format

     2161:     (w, h, 3) type float (float32, single precision).

     2162:     As the image is converted to a different data type format (uint8 to float32),

     2163:     the transformation cannot be applied inplace. The image returned by the method dithering

     2164:     is a copy of the original image.

     2165:

     2166:     :param surface_: Pygame surface format 24-32 bit

     2167:     :param factor_ : integer; Value must be > 1 otherwise an exception will be thrown

     2168:     :return        : Surface;

     2169:

     2170:     """

    +2171:     assert PyObject_IsInstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2171, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2172:         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2172, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2171, __pyx_L1_error)
        }
      }
      #endif

     2173:

    +2174:     assert PyObject_IsInstance(factor_, int), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2174, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_t_1, ((PyObject *)(&PyInt_Type))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2174, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2175:         'Argument factor_ must be an int got %s ' % type(factor_)

          __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_factor_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2175, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_factor__must_be_an_int, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2175, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 2174, __pyx_L1_error)
        }
      }
      #endif

     2176:

    +2177:     assert factor_ > 1, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_factor_ > 1) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_factor__must_be_1);
          __PYX_ERR(1, 2177, __pyx_L1_error)
        }
      }
      #endif

     2178:         "Argument factor_ must be > 1"

     2179:

    +2180:     dithering_int_c(pixels3d(surface_), factor_)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 2180, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_f_12PygameShader_6shader_dithering_int_c(__pyx_t_5, __pyx_v_factor_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

     2181:

     2182: @cython.binding(False)

     2183: @cython.boundscheck(False)

     2184: @cython.wraparound(False)

     2185: @cython.nonecheck(False)

     2186: @cython.cdivision(True)

    +2187: cpdef object pixelation(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_pixelation(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      PyObject *__pyx_v_small = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("pixelation", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_AddTraceback("PygameShader.shader.pixelation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_small);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_106pixelation[] = "\n    Pixelate a pygame.Surface \n    \n    This method cannot be used for the game display as the change \n    is applied in a new Surface\n    \n    :param surface_: pygame.Surface; \n    :return: pixelated surface\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_107pixelation(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("pixelation (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_106pixelation(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_106pixelation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("pixelation", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_pixelation(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.pixelation", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2188:     """

     2189:     Pixelate a pygame.Surface

     2190:

     2191:     This method cannot be used for the game display as the change

     2192:     is applied in a new Surface

     2193:

     2194:     :param surface_: pygame.Surface;

     2195:     :return: pixelated surface

     2196:     """

    +2197:     assert PyObject_IsInstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2197, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2197, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2198:         'Argument surface_ must be a pygame.Surface got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyga, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2198, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2197, __pyx_L1_error)
        }
      }
      #endif

     2199:

     2200:     cdef Py_ssize_t w, h

     2201:     # todo percentage of pixelation

    +2202:     w, h = surface_.get_size()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 2202, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 2202, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 2202, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 2202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 2202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_w = __pyx_t_7;
      __pyx_v_h = __pyx_t_8;

    +2203:     cdef object small = smoothscale(surface_, (32, 32))

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surface_, __pyx_tuple__16};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_surface_, __pyx_tuple__16};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface_);
        __Pyx_GIVEREF(__pyx_v_surface_);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_surface_);
        __Pyx_INCREF(__pyx_tuple__16);
        __Pyx_GIVEREF(__pyx_tuple__16);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_tuple__16);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_small = __pyx_t_1;
      __pyx_t_1 = 0;
    /* … */
      __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_32, __pyx_int_32); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 2203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__16);
      __Pyx_GIVEREF(__pyx_tuple__16);

    +2204:     return scale(small, (w, h))

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 2204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_small, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_small, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_small);
        __Pyx_GIVEREF(__pyx_v_small);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_9, __pyx_v_small);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_9, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     2205:

     2206: @cython.binding(False)

     2207: @cython.boundscheck(False)

     2208: @cython.wraparound(False)

     2209: @cython.nonecheck(False)

     2210: @cython.cdivision(True)

    +2211: cpdef inline zoom_in(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_zoom_in(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("zoom_in", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.zoom_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_108zoom_in[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_109zoom_in(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("zoom_in (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_108zoom_in(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_108zoom_in(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("zoom_in", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_zoom_in(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.zoom_in", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2212:     """

     2213:

     2214:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     2215:     :return:

     2216:     """

    +2217:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2217, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2217, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2218:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2218, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2217, __pyx_L1_error)
        }
      }
      #endif

     2219:

    +2220:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2220, __pyx_L1_error)

     2221:

     2222:

     2223: @cython.binding(False)

     2224: @cython.boundscheck(False)

     2225: @cython.wraparound(False)

     2226: @cython.nonecheck(False)

     2227: @cython.cdivision(True)

    +2228: cpdef inline electric(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_electric(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("electric", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.electric", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_110electric[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_111electric(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("electric (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_110electric(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_110electric(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("electric", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_electric(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.electric", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2229:     """

     2230:

     2231:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     2232:     :return:

     2233:     """

    +2234:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2234, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2235:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2235, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2234, __pyx_L1_error)
        }
      }
      #endif

     2236:

    +2237:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2237, __pyx_L1_error)

     2238:

     2239:

     2240: @cython.binding(False)

     2241: @cython.boundscheck(False)

     2242: @cython.wraparound(False)

     2243: @cython.nonecheck(False)

     2244: @cython.cdivision(True)

    +2245: cpdef inline filmstrips(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_filmstrips(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("filmstrips", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.filmstrips", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_112filmstrips[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_113filmstrips(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("filmstrips (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_112filmstrips(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_112filmstrips(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("filmstrips", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_filmstrips(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2245, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.filmstrips", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2246:     """

     2247:

     2248:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     2249:     :return:

     2250:     """

    +2251:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2251, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2251, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2252:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2252, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2251, __pyx_L1_error)
        }
      }
      #endif

     2253:

    +2254:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2254, __pyx_L1_error)

     2255:

     2256:

     2257: @cython.binding(False)

     2258: @cython.boundscheck(False)

     2259: @cython.wraparound(False)

     2260: @cython.nonecheck(False)

     2261: @cython.cdivision(True)

    +2262: cpdef cubism(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_cubism(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cubism", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.cubism", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_114cubism[] = "\n\n    :param surface_ : pygame.Surface; compatible 24 - 32 bit \n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_115cubism(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cubism (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_114cubism(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_114cubism(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cubism", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_cubism(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.cubism", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2263:     """

     2264:

     2265:     :param surface_ : pygame.Surface; compatible 24 - 32 bit

     2266:     :return:

     2267:     """

    +2268:     assert isinstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2268, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2269:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2269, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2268, __pyx_L1_error)
        }
      }
      #endif

    +2270:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2270, __pyx_L1_error)

     2271:

     2272:

     2273: @cython.binding(False)

     2274: @cython.boundscheck(False)

     2275: @cython.wraparound(False)

     2276: @cython.nonecheck(False)

     2277: @cython.cdivision(True)

    +2278: cpdef code_listing(object surface_, size_):

    static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_code_listing(PyObject *__pyx_v_surface_, CYTHON_UNUSED PyObject *__pyx_v_size_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("code_listing", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_116code_listing[] = "\n\n    :param surface_: pygame.Surface; compatible 24 - 32 bit \n    :param size_:\n    :return:\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_117code_listing(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      PyObject *__pyx_v_size_ = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("code_listing (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_size_2,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_size_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("code_listing", 1, 2, 2, 1); __PYX_ERR(1, 2278, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "code_listing") < 0)) __PYX_ERR(1, 2278, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_size_ = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("code_listing", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2278, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_116code_listing(__pyx_self, __pyx_v_surface_, __pyx_v_size_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_116code_listing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_size_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("code_listing", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_code_listing(__pyx_v_surface_, __pyx_v_size_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2278, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.code_listing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2279:     """

     2280:

     2281:     :param surface_: pygame.Surface; compatible 24 - 32 bit

     2282:     :param size_:

     2283:     :return:

     2284:     """

    +2285:     assert PyObject_IsInstance(surface_, pygame.Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2285, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_2); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 2285, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!(__pyx_t_3 != 0))) {

    +2286:         "\nArgument surface_ must be a pygame.Surface type, got %s " % type(surface_)

          __pyx_t_2 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_pyg, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 2286, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 2285, __pyx_L1_error)
        }
      }
      #endif

     2287:

    +2288:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2288, __pyx_L1_error)

     2289:

     2290: @cython.binding(False)

     2291: @cython.boundscheck(False)

     2292: @cython.wraparound(False)

     2293: @cython.nonecheck(False)

     2294: @cython.cdivision(True)

    +2295: cpdef ascii_char(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_ascii_char(CYTHON_UNUSED PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ascii_char", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_AddTraceback("PygameShader.shader.ascii_char", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_118ascii_char[] = "\n    \n    :param surface_: \n    :return: \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_119ascii_char(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ascii_char (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_118ascii_char(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_118ascii_char(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("ascii_char", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_ascii_char(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.ascii_char", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2296:     """

     2297:

     2298:     :param surface_:

     2299:     :return:

     2300:     """

    +2301:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2301, __pyx_L1_error)

     2302:

     2303: @cython.binding(False)

     2304: @cython.boundscheck(False)

     2305: @cython.wraparound(False)

     2306: @cython.nonecheck(False)

     2307: @cython.cdivision(True)

    +2308: cpdef object blend(object source_, object destination_, float percentage_):

    static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_blend(PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blend", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_120blend[] = "\n    BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE \n    \n    The shader create a new image from both source_ and destination_\n\n    * Video system must be initialised \n    * source_ & destination_ Textures must be same sizes\n    * Compatible with 24 - 32 bit surface\n    * Output create a new surface\n    * Image returned is converted for fast blit (convert())\n\n    :param source_     : pygame.Surface (Source)\n    :param destination_: pygame.Surface (Destination)\n    :param percentage_ : float; Percentage value between [0.0 ... 100.0]\n    :return: return    : Return a 24 bit pygame.Surface and blended with a percentage\n                         of the destination texture.\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_121blend(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_source_ = 0;
      PyObject *__pyx_v_destination_ = 0;
      float __pyx_v_percentage_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blend (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_destination,&__pyx_n_s_percentage,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_destination)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, 1); __PYX_ERR(1, 2308, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_percentage)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, 2); __PYX_ERR(1, 2308, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blend") < 0)) __PYX_ERR(1, 2308, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_source_ = values[0];
        __pyx_v_destination_ = values[1];
        __pyx_v_percentage_ = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_percentage_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2308, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("blend", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2308, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_120blend(__pyx_self, __pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_120blend(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blend", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_blend(__pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2308, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.blend", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2309:     """

     2310:     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE

     2311:

     2312:     The shader create a new image from both source_ and destination_

     2313:

     2314:     * Video system must be initialised

     2315:     * source_ & destination_ Textures must be same sizes

     2316:     * Compatible with 24 - 32 bit surface

     2317:     * Output create a new surface

     2318:     * Image returned is converted for fast blit (convert())

     2319:

     2320:     :param source_     : pygame.Surface (Source)

     2321:     :param destination_: pygame.Surface (Destination)

     2322:     :param percentage_ : float; Percentage value between [0.0 ... 100.0]

     2323:     :return: return    : Return a 24 bit pygame.Surface and blended with a percentage

     2324:                          of the destination texture.

     2325:     """

    +2326:     assert PyObject_IsInstance(source_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2326, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_source_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2326, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2327:         'Argument source_ must be a pygame.Surface got %s ' % type(source_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_source__must_be_a_pygam, ((PyObject *)Py_TYPE(__pyx_v_source_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2327, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2326, __pyx_L1_error)
        }
      }
      #endif

     2328:

    +2329:     assert PyObject_IsInstance(destination_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2329, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_destination_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2329, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2330:         'Argument destination_ must be a pygame.Surface got %s ' % type(destination_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_destination__must_be_a, ((PyObject *)Py_TYPE(__pyx_v_destination_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2330, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2329, __pyx_L1_error)
        }
      }
      #endif

     2331:

    +2332:     assert 0.0 <= percentage_ <= 100.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_2 = (0.0 <= __pyx_v_percentage_);
        if (__pyx_t_2) {
          __pyx_t_2 = (__pyx_v_percentage_ <= 100.0);
        }
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2333:         "\nIncorrect value for argument percentage should be [0.0 ... 100.0] got %s " % percentage_

          __pyx_t_1 = PyFloat_FromDouble(__pyx_v_percentage_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2333, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Incorrect_value_for_argument_pe, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2333, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 2332, __pyx_L1_error)
        }
      }
      #endif

     2334:

    +2335:     if percentage_ == 0.0:

      __pyx_t_2 = ((__pyx_v_percentage_ == 0.0) != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +2336:         return source_

        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_source_);
        __pyx_r = __pyx_v_source_;
        goto __pyx_L0;

     2337:

    +2338:     assert source_.get_size() == destination_.get_size(), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 2338, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) {

     2339:         'Source and Destination surfaces must have same dimensions: ' \

    +2340:         'Source (w:%s, h:%s), destination (w:%s, h:%s).' % \

          __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Source_and_Destination_surfaces, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2338, __pyx_L1_error)
        }
      }
      #endif

    +2341:         (*source_.get_size(), *destination_.get_size())

          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_4 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_destination_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__Pyx_PyList_Extend(__pyx_t_4, __pyx_t_1) < 0) __PYX_ERR(1, 2341, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          {
            PyObject *__pyx_temp = PyList_AsTuple(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_4);
            __pyx_t_4 = __pyx_temp; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2341, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
          }

     2342:

    +2343:     return blending(source_, destination_, percentage_)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_blending(__pyx_v_source_, __pyx_v_destination_, __pyx_v_percentage_); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     2344:

     2345:

     2346:

     2347: @cython.binding(False)

     2348: @cython.boundscheck(False)

     2349: @cython.wraparound(False)

     2350: @cython.nonecheck(False)

     2351: @cython.cdivision(True)

    +2352: cpdef cartoon(

    static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_cartoon(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_cartoon *__pyx_optional_args) {
      int __pyx_v_sobel_threshold_ = ((int)0x80);
      int __pyx_v_median_kernel_ = ((int)2);
      PyObject *__pyx_v_color_ = ((PyObject *)__pyx_int_8);
      PyObject *__pyx_v_flag_ = __pyx_k__17;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cartoon", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_sobel_threshold_ = __pyx_optional_args->sobel_threshold_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_median_kernel_ = __pyx_optional_args->median_kernel_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_color_ = __pyx_optional_args->color_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_flag_ = __pyx_optional_args->flag_;
              }
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_122cartoon[] = "\n    CREATE A CARTOON EFFECT FROM A GIVEN SURFACE \n    \n    * This shader cannot be use online or real time due to the amout of \n      transformation. You can use this shader while editing your textures \n      befre the main loop \n    \n    * Compatible with 24 - 32 bit image \n    \n    :param surface_: pygame.Surface compatible 24 - 32 bit \n    :param sobel_threshold_: integer sobel threshold\n    :param median_kernel_  : integer median kernel  \n    :param color_          : integer; color reduction value (max color)\n    :param flag_           : integer; Blend flag e.g (BLEND_RGB_ADD, BLEND_RGB_SUB, \n                             BLEND_RGB_MULT, BLEND_RGB_MAX, BLEND_RGB_MIN  \n    :return                : Return a pygame Surface with the cartoon effect \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_123cartoon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_sobel_threshold_;
      int __pyx_v_median_kernel_;
      PyObject *__pyx_v_color_ = 0;
      PyObject *__pyx_v_flag_ = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cartoon (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_sobel_threshold_2,&__pyx_n_s_median_kernel,&__pyx_n_s_color,&__pyx_n_s_flag,0};
        PyObject* values[5] = {0,0,0,0,0};
        values[3] = ((PyObject *)__pyx_int_8);
        values[4] = __pyx_k__17;
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sobel_threshold_2);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_median_kernel);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color);
              if (value) { values[3] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag);
              if (value) { values[4] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cartoon") < 0)) __PYX_ERR(1, 2352, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_sobel_threshold_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_sobel_threshold_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2354, __pyx_L3_error)
        } else {
          __pyx_v_sobel_threshold_ = ((int)0x80);
        }
        if (values[2]) {
          __pyx_v_median_kernel_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_median_kernel_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2355, __pyx_L3_error)
        } else {
          __pyx_v_median_kernel_ = ((int)2);
        }
        __pyx_v_color_ = values[3];
        __pyx_v_flag_ = values[4];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("cartoon", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2352, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_122cartoon(__pyx_self, __pyx_v_surface_, __pyx_v_sobel_threshold_, __pyx_v_median_kernel_, __pyx_v_color_, __pyx_v_flag_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_122cartoon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_sobel_threshold_, int __pyx_v_median_kernel_, PyObject *__pyx_v_color_, PyObject *__pyx_v_flag_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cartoon", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 4;
      __pyx_t_2.sobel_threshold_ = __pyx_v_sobel_threshold_;
      __pyx_t_2.median_kernel_ = __pyx_v_median_kernel_;
      __pyx_t_2.color_ = __pyx_v_color_;
      __pyx_t_2.flag_ = __pyx_v_flag_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_cartoon(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.cartoon", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2353:         object surface_,

     2354:         int sobel_threshold_ = 128,

     2355:         int median_kernel_   = 2,

     2356:         color_               = 8,

    +2357:         flag_                = BLEND_RGB_ADD

      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_k__17 = __pyx_t_33;
      __Pyx_GIVEREF(__pyx_t_33);
      __pyx_t_33 = 0;
    /* … */
      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_k__17 = __pyx_t_33;
      __Pyx_GIVEREF(__pyx_t_33);
      __pyx_t_33 = 0;

     2358: ):

     2359:     """

     2360:     CREATE A CARTOON EFFECT FROM A GIVEN SURFACE

     2361:

     2362:     * This shader cannot be use online or real time due to the amout of

     2363:       transformation. You can use this shader while editing your textures

     2364:       befre the main loop

     2365:

     2366:     * Compatible with 24 - 32 bit image

     2367:

     2368:     :param surface_: pygame.Surface compatible 24 - 32 bit

     2369:     :param sobel_threshold_: integer sobel threshold

     2370:     :param median_kernel_  : integer median kernel

     2371:     :param color_          : integer; color reduction value (max color)

     2372:     :param flag_           : integer; Blend flag e.g (BLEND_RGB_ADD, BLEND_RGB_SUB,

     2373:                              BLEND_RGB_MULT, BLEND_RGB_MAX, BLEND_RGB_MIN

     2374:     :return                : Return a pygame Surface with the cartoon effect

     2375:     """

     2376:

    +2377:     return cartoon_effect(surface_, sobel_threshold_, median_kernel_, color_, flag_)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_color_); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2377, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_flag_); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2377, __pyx_L1_error)
      __pyx_t_3 = __pyx_f_12PygameShader_6shader_cartoon_effect(__pyx_v_surface_, __pyx_v_sobel_threshold_, __pyx_v_median_kernel_, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2377, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     2378:

     2379:

     2380: @cython.binding(False)

     2381: @cython.boundscheck(False)

     2382: @cython.wraparound(False)

     2383: @cython.nonecheck(False)

     2384: @cython.cdivision(True)

    +2385: cpdef explode(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_explode(CYTHON_UNUSED PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("explode", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_AddTraceback("PygameShader.shader.explode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_124explode[] = "\n\n    :param surface_: \n    :return: \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_125explode(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("explode (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_124explode(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_124explode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("explode", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_explode(__pyx_v_surface_, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2385, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.explode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2386:     """

     2387:

     2388:     :param surface_:

     2389:     :return:

     2390:     """

    +2391:     raise NotImplementedError

      __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0);
      __PYX_ERR(1, 2391, __pyx_L1_error)

     2392:

     2393: @cython.binding(False)

     2394: @cython.boundscheck(False)

     2395: @cython.wraparound(False)

     2396: @cython.nonecheck(False)

     2397: @cython.cdivision(True)

    +2398: cpdef object spectrum(int width, int height, float gamma=1.0):

    static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_spectrum(int __pyx_v_width, int __pyx_v_height, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_spectrum *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("spectrum", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_126spectrum[] = "\n    CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm\n\n    Color   Wavelength(nm) Frequency(THz)\n    Red     620-750        484-400\n    Orange  590-620        508-484\n    Yellow  570-590        526-508\n    Green   495-570        606-526\n    Blue    450-495        668-606\n    Violet  380-450        789-668\n\n    :param width: integer; width of the image\n    :param height: integer; height of the image\n    :param gamma: float; gamma value \n    :return: Return a pygame surface 24-bit (width, height) converted for fast \n    blit \n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_127spectrum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_width;
      int __pyx_v_height;
      float __pyx_v_gamma;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("spectrum (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_gamma,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("spectrum", 0, 2, 3, 1); __PYX_ERR(1, 2398, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "spectrum") < 0)) __PYX_ERR(1, 2398, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
        __pyx_v_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
        if (values[2]) {
          __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2398, __pyx_L3_error)
        } else {
          __pyx_v_gamma = ((float)1.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("spectrum", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2398, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_126spectrum(__pyx_self, __pyx_v_width, __pyx_v_height, __pyx_v_gamma);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_126spectrum(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_width, int __pyx_v_height, float __pyx_v_gamma) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("spectrum", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_spectrum(__pyx_v_width, __pyx_v_height, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.spectrum", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2399:     """

     2400:     CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm

     2401:

     2402:     Color   Wavelength(nm) Frequency(THz)

     2403:     Red     620-750        484-400

     2404:     Orange  590-620        508-484

     2405:     Yellow  570-590        526-508

     2406:     Green   495-570        606-526

     2407:     Blue    450-495        668-606

     2408:     Violet  380-450        789-668

     2409:

     2410:     :param width: integer; width of the image

     2411:     :param height: integer; height of the image

     2412:     :param gamma: float; gamma value

     2413:     :return: Return a pygame surface 24-bit (width, height) converted for fast

     2414:     blit

     2415:

     2416:     """

     2417:

    +2418:     return spectrum_c(width, height, gamma)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_spectrum_c(__pyx_v_width, __pyx_v_height, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     2419:

     2420:

     2421: @cython.boundscheck(False)

     2422: @cython.wraparound(False)

     2423: @cython.nonecheck(False)

     2424: @cython.cdivision(True)

    +2425: cpdef inline void convert_27colors(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_array_ = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_27colors", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_array_);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_128convert_27colors[] = "\n    THIS ALGORITHM CONVERT AN IMAGE USING 27 COLORS ONLY\n\n    :param surface_: numpy.ndarray; containing the pixels RGB. Array shape (w, h, 3)  \n    :return: void \n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_129convert_27colors(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_27colors (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_128convert_27colors(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_128convert_27colors(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_27colors", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_convert_27colors(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2426:

     2427:     """

     2428:     THIS ALGORITHM CONVERT AN IMAGE USING 27 COLORS ONLY

     2429:

     2430:     :param surface_: numpy.ndarray; containing the pixels RGB. Array shape (w, h, 3)

     2431:     :return: void

     2432:     """

    +2433:     assert isinstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2433, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2433, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2434:         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2434, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2433, __pyx_L1_error)
        }
      }
      #endif

     2435:

    +2436:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        goto __pyx_L1_error;
        __pyx_L8_try_end:;
      }

    +2437:         array_ = pixels3d(surface_)

          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2437, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2437, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_v_array_ = __pyx_t_1;
          __pyx_t_1 = 0;

     2438:

    +2439:     except (pygame.error, ValueError):

        __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2439, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2439, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7);
        __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
        if (__pyx_t_10) {
          __Pyx_AddTraceback("PygameShader.shader.convert_27colors", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 2439, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_1);

    +2440:         raise ValueError('\nTexture/image is not compatible.')

          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2440, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(1, 2440, __pyx_L5_except_error)
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;
    /* … */
      __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Texture_image_is_not_compatible); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 2440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__18);
      __Pyx_GIVEREF(__pyx_tuple__18);

     2441:

    +2442:     convert_27colors_c(array_)

      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2442, __pyx_L1_error)
      __pyx_f_12PygameShader_6shader_convert_27colors_c(__pyx_t_11);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     2443:

     2444:

     2445:

     2446: @cython.boundscheck(False)

     2447: @cython.wraparound(False)

     2448: @cython.nonecheck(False)

     2449: @cython.cdivision(True)

    +2450: cpdef object bilateral(object image, float sigma_s, float sigma_i):

    static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_bilateral(PyObject *__pyx_v_image, float __pyx_v_sigma_s, float __pyx_v_sigma_i, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_array_ = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bilateral", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_array_);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_130bilateral[] = "\n    A bilateral filter is a non-linear, edge-preserving, and noise-reducing\n    smoothing filter for images. It replaces the intensity of each pixel with a\n    weighted average of intensity values from nearby pixels. This weight can be\n    based on a Gaussian distribution.\n\n    Here, the normalization factor and the range weight are new terms added to \n    the previous equation. sigma_s  denotes the spatial extent of the kernel, i.e. \n    the size of the neighborhood, and sigma_r  denotes the minimum amplitude of an edge.\n    It ensures that only those pixels with intensity values similar to that of the\n    central pixel are considered for blurring, while sharp intensity changes are maintained.\n    The smaller the value of sigma_i ( or sigma_r), the sharper the edge. As sigma_r  tends to \n    infinity, the equation tends to a Gaussian blur.\n       \n    e.g:\n    \n    bilateral(surface, sigma_s = 16, sigma_i = 18)\n    \n    :param image: Surface, Pygame Surface format 24-32 bit format (alpha channel will be ignored)\n    \n    :param sigma_s: float sigma_s : Spatial extent of the kernel, size of the \n    considered neighborhood\n    \n    :param sigma_i: float sigma_i (also call sigma_r) range kernel, minimum amplitude of an edge.\n    \n    :return: return a filtered Surface\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_131bilateral(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_image = 0;
      float __pyx_v_sigma_s;
      float __pyx_v_sigma_i;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bilateral (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_image,&__pyx_n_s_sigma_s,&__pyx_n_s_sigma_i,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_image)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_s)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, 1); __PYX_ERR(1, 2450, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sigma_i)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, 2); __PYX_ERR(1, 2450, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bilateral") < 0)) __PYX_ERR(1, 2450, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_image = values[0];
        __pyx_v_sigma_s = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_sigma_s == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2450, __pyx_L3_error)
        __pyx_v_sigma_i = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_sigma_i == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 2450, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("bilateral", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2450, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_130bilateral(__pyx_self, __pyx_v_image, __pyx_v_sigma_s, __pyx_v_sigma_i);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_130bilateral(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image, float __pyx_v_sigma_s, float __pyx_v_sigma_i) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bilateral", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_bilateral(__pyx_v_image, __pyx_v_sigma_s, __pyx_v_sigma_i, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2450, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2451:     """

     2452:     A bilateral filter is a non-linear, edge-preserving, and noise-reducing

     2453:     smoothing filter for images. It replaces the intensity of each pixel with a

     2454:     weighted average of intensity values from nearby pixels. This weight can be

     2455:     based on a Gaussian distribution.

     2456:

     2457:     Here, the normalization factor and the range weight are new terms added to

     2458:     the previous equation. sigma_s  denotes the spatial extent of the kernel, i.e.

     2459:     the size of the neighborhood, and sigma_r  denotes the minimum amplitude of an edge.

     2460:     It ensures that only those pixels with intensity values similar to that of the

     2461:     central pixel are considered for blurring, while sharp intensity changes are maintained.

     2462:     The smaller the value of sigma_i ( or sigma_r), the sharper the edge. As sigma_r  tends to

     2463:     infinity, the equation tends to a Gaussian blur.

     2464:

     2465:     e.g:

     2466:

     2467:     bilateral(surface, sigma_s = 16, sigma_i = 18)

     2468:

     2469:     :param image: Surface, Pygame Surface format 24-32 bit format (alpha channel will be ignored)

     2470:

     2471:     :param sigma_s: float sigma_s : Spatial extent of the kernel, size of the

     2472:     considered neighborhood

     2473:

     2474:     :param sigma_i: float sigma_i (also call sigma_r) range kernel, minimum amplitude of an edge.

     2475:

     2476:     :return: return a filtered Surface

     2477:     """

     2478:

    +2479:     assert isinstance(image, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2479, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_image, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2479, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2480:         'Argument image must be a valid Surface, got %s ' % type(image)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_image_must_be_a_valid_S, ((PyObject *)Py_TYPE(__pyx_v_image))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2479, __pyx_L1_error)
        }
      }
      #endif

     2481:

    +2482:     assert isinstance(sigma_s, float), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sigma_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyFloat_Check(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2483:         'Argument sigma_s must be a valid Surface, got %s ' % type(sigma_s)

          __pyx_t_1 = PyFloat_FromDouble(__pyx_v_sigma_s); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_sigma_s_must_be_a_valid, ((PyObject *)Py_TYPE(__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 2482, __pyx_L1_error)
        }
      }
      #endif

     2484:

    +2485:     assert isinstance(sigma_i, float), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sigma_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyFloat_Check(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2486:         'Argument sigma_i must be a valid Surface, got %s ' % type(sigma_i)

          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sigma_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_sigma_i_must_be_a_valid, ((PyObject *)Py_TYPE(__pyx_t_3))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2485, __pyx_L1_error)
        }
      }
      #endif

     2487:

    +2488:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L8_try_end:;
      }

    +2489:         array_ = pixels3d(image)

          __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2489, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_image) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_image);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2489, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_array_ = __pyx_t_1;
          __pyx_t_1 = 0;

     2490:

    +2491:     except (pygame.error, ValueError):

        __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2491, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2491, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_ErrRestore(__pyx_t_1, __pyx_t_3, __pyx_t_7);
        __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_7 = 0;
        if (__pyx_t_10) {
          __Pyx_AddTraceback("PygameShader.shader.bilateral", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_3, &__pyx_t_1) < 0) __PYX_ERR(1, 2491, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_1);

    +2492:         raise ValueError('\nTexture/image is not compatible.')

          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2492, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(1, 2492, __pyx_L5_except_error)
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

     2493:

     2494:

    +2495:     return bilateral_filter24_c(array_, sigma_s, sigma_i)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2495, __pyx_L1_error)
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_bilateral_filter24_c(__pyx_t_11, __pyx_v_sigma_s, __pyx_v_sigma_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2495, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     2496:

     2497: @cython.boundscheck(False)

     2498: @cython.wraparound(False)

     2499: @cython.nonecheck(False)

     2500: @cython.cdivision(True)

    +2501: cpdef object emboss(object surface_, unsigned int flag=0):

    static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_emboss(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_emboss *__pyx_optional_args) {
      unsigned int __pyx_v_flag = ((unsigned int)0);
      PyObject *__pyx_v_array_ = NULL;
      PyObject *__pyx_v_emb = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("emboss", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_flag = __pyx_optional_args->flag;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_array_);
      __Pyx_XDECREF(__pyx_v_emb);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_132emboss[] = "\n    EMBOSS A PYGAME SURFACE \n    \n    :param surface_: pygame.Surface; compatible 24-32 bit\n    :param flag    : integer; special pygame flag such as BLEND_RGB_ADD, BLEND_RGB_MULT etc\n    :return        : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_133emboss(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      unsigned int __pyx_v_flag;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("emboss (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_flag_2,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flag_2);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "emboss") < 0)) __PYX_ERR(1, 2501, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_flag = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_flag == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 2501, __pyx_L3_error)
        } else {
          __pyx_v_flag = ((unsigned int)0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("emboss", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2501, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_132emboss(__pyx_self, __pyx_v_surface_, __pyx_v_flag);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_132emboss(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, unsigned int __pyx_v_flag) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("emboss", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.flag = __pyx_v_flag;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_emboss(__pyx_v_surface_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2502:     """

     2503:     EMBOSS A PYGAME SURFACE

     2504:

     2505:     :param surface_: pygame.Surface; compatible 24-32 bit

     2506:     :param flag    : integer; special pygame flag such as BLEND_RGB_ADD, BLEND_RGB_MULT etc

     2507:     :return        : void

     2508:     """

     2509:

    +2510:     assert isinstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2510, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2510, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2511:         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2510, __pyx_L1_error)
        }
      }
      #endif

     2512:

    +2513:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
        goto __pyx_L1_error;
        __pyx_L8_try_end:;
      }

    +2514:         array_ = pixels3d(surface_)

          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2514, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          __pyx_t_1 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_surface_);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2514, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_v_array_ = __pyx_t_1;
          __pyx_t_1 = 0;

     2515:

    +2516:     except (pygame.error, ValueError):

        __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_6, &__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2516, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2516, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_builtin_ValueError);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_ErrRestore(__pyx_t_1, __pyx_t_6, __pyx_t_7);
        __pyx_t_1 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
        if (__pyx_t_10) {
          __Pyx_AddTraceback("PygameShader.shader.emboss", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_1) < 0) __PYX_ERR(1, 2516, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_1);

    +2517:         raise ValueError('\nTexture/image is not compatible.')

          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2517, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(1, 2517, __pyx_L5_except_error)
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

     2518:

    +2519:     cdef object emb = emboss5x5_c(array_)

      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2519, __pyx_L1_error)
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_emboss5x5_c(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2519, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;
      __pyx_v_emb = __pyx_t_1;
      __pyx_t_1 = 0;

     2520:

    +2521:     if flag != 0:

      __pyx_t_2 = ((__pyx_v_flag != 0) != 0);
      if (__pyx_t_2) {
    /* … */
      }

    +2522:         del array_

        __Pyx_DECREF(__pyx_v_array_);
        __pyx_v_array_ = NULL;

    +2523:         surface_.blit(emb, (0, 0), special_flags=flag)

        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_v_emb);
        __Pyx_GIVEREF(__pyx_v_emb);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_emb);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_tuple__12);
        __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_flag); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_special_flags, __pyx_t_9) < 0) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2523, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    +2524:         return surface_

        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_surface_);
        __pyx_r = __pyx_v_surface_;
        goto __pyx_L0;

     2525:

    +2526:     return emboss5x5_c(array_)

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2526, __pyx_L1_error)
      __pyx_t_9 = __pyx_f_12PygameShader_6shader_emboss5x5_c(__pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2526, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

     2527:

     2528:

     2529:

     2530:

     2531: @cython.binding(False)

     2532: @cython.boundscheck(False)

     2533: @cython.wraparound(False)

     2534: @cython.nonecheck(False)

     2535: @cython.cdivision(True)

    +2536: cpdef void palette_change(

    static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static void __pyx_f_12PygameShader_6shader_palette_change(PyObject *__pyx_v_surface_, PyObject *__pyx_v_palette_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      PyObject *__pyx_v_array_ = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("palette_change", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_array_);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_134palette_change[] = "\n    CHANGE AN IMAGE BY CHANGING THE COLOR PALETTE \n    \n    LIST_PALETTES contains all the palettes available\n    in the project.\n    \n    e.g: \n    from PygameShader.Palette import LIST_PALETTES\n    print(LIST_PALETTES.keys())\n    \n    :param surface_: pygame.Surface; \n    :param palette_: numpy.ndarray containing all the RGB color values \n    :return: void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_135palette_change(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      PyObject *__pyx_v_palette_ = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("palette_change (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_palette,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_palette)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("palette_change", 1, 2, 2, 1); __PYX_ERR(1, 2536, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "palette_change") < 0)) __PYX_ERR(1, 2536, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_palette_ = values[1];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("palette_change", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 2536, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_134palette_change(__pyx_self, __pyx_v_surface_, __pyx_v_palette_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_134palette_change(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, PyObject *__pyx_v_palette_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("palette_change", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_palette_change(__pyx_v_surface_, __pyx_v_palette_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2536, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     2537:         object surface_,

     2538:         object palette_):

     2539:     """

     2540:     CHANGE AN IMAGE BY CHANGING THE COLOR PALETTE

     2541:

     2542:     LIST_PALETTES contains all the palettes available

     2543:     in the project.

     2544:

     2545:     e.g:

     2546:     from PygameShader.Palette import LIST_PALETTES

     2547:     print(LIST_PALETTES.keys())

     2548:

     2549:     :param surface_: pygame.Surface;

     2550:     :param palette_: numpy.ndarray containing all the RGB color values

     2551:     :return: void

     2552:     """

     2553:

    +2554:     assert isinstance(surface_, Surface), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2554, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_1); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2554, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2555:         'Argument surface_ must be a valid Surface, got %s ' % type(surface_)

          __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2555, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_1);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(1, 2554, __pyx_L1_error)
        }
      }
      #endif

     2556:

    +2557:     assert isinstance(palette_, numpy.ndarray), \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_2 = PyObject_IsInstance(__pyx_v_palette_, __pyx_t_3); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(1, 2557, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!(__pyx_t_2 != 0))) {

    +2558:         'Argument surface_ must be a valid Surface, got %s ' % type(palette_)

          __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_vali, ((PyObject *)Py_TYPE(__pyx_v_palette_))); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2558, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 2557, __pyx_L1_error)
        }
      }
      #endif

    +2559:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_4);
        __Pyx_XGIVEREF(__pyx_t_5);
        __Pyx_XGIVEREF(__pyx_t_6);
        __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
        goto __pyx_L1_error;
        __pyx_L8_try_end:;
      }

    +2560:         array_ = pixels3d(surface_)

          __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2560, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_7 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_7, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_surface_);
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 2560, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_v_array_ = __pyx_t_3;
          __pyx_t_3 = 0;

     2561:

    +2562:     except (pygame.error, ValueError):

        __Pyx_ErrFetch(&__pyx_t_3, &__pyx_t_1, &__pyx_t_7);
        __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_pygame); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2562, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_error); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2562, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_t_9) || __Pyx_PyErr_GivenExceptionMatches(__pyx_t_3, __pyx_builtin_ValueError);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_7);
        __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_7 = 0;
        if (__pyx_t_10) {
          __Pyx_AddTraceback("PygameShader.shader.palette_change", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_1, &__pyx_t_3) < 0) __PYX_ERR(1, 2562, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);

    +2563:         raise ValueError('\nTexture/image is not compatible.')

          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2563, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(1, 2563, __pyx_L5_except_error)
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

     2564:

    +2565:     palette_change_c(array_, palette_)

      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2565, __pyx_L1_error)
      __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_palette_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 2565, __pyx_L1_error)
      __pyx_f_12PygameShader_6shader_palette_change_c(__pyx_t_11, __pyx_t_12);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;
      __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
      __pyx_t_12.memview = NULL;
      __pyx_t_12.data = NULL;

     2566:

     2567: # ******************************************************************

     2568:

     2569:

     2570:

     2571: @cython.boundscheck(False)

     2572: @cython.wraparound(False)

     2573: @cython.nonecheck(False)

     2574: @cython.cdivision(True)

    +2575: cdef inline float damped_oscillation(float t)nogil:

    static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_damped_oscillation(float __pyx_v_t) {
      float __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }

     2576:     """

     2577:

     2578:     :param t:

     2579:     :return:

     2580:     """

    +2581:     return <float>(exp(-t * 0.1) * <float>cos(M_PI * t))

      __pyx_r = ((float)(exp(((-__pyx_v_t) * 0.1)) * ((float)cos((__pyx_v_12PygameShader_6shader_M_PI * __pyx_v_t)))));
      goto __pyx_L0;

     2582:

     2583:

    +2584: cdef float C1_ = <float>1.0 / <float>sqrt(M_2PI)

      __pyx_v_12PygameShader_6shader_C1_ = (((float)1.0) / ((float)sqrt(__pyx_v_12PygameShader_6shader_M_2PI)));

     2585:

    +2586: cdef inline float gauss(float x, float c, float sigma=1.0, float mu=0.0)nogil:

    static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_gauss(float __pyx_v_x, float __pyx_v_c, struct __pyx_opt_args_12PygameShader_6shader_gauss *__pyx_optional_args) {
      float __pyx_v_sigma = ((float)1.0);
      float __pyx_v_mu = ((float)0.0);
      float __pyx_r;
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_sigma = __pyx_optional_args->sigma;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_mu = __pyx_optional_args->mu;
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_gauss {
      int __pyx_n;
      float sigma;
      float mu;
    };

     2587:     """

     2588:

     2589:     :param x:

     2590:     :param c:

     2591:     :param sigma:

     2592:     :param mu:

     2593:     :return:

     2594:     """

    +2595:     x -= c

      __pyx_v_x = (__pyx_v_x - __pyx_v_c);

    +2596:     return (1.0 / sigma * C1_) * exp(-0.5 * ((x - mu) * (x - mu)) / (sigma * sigma))

      __pyx_r = (((1.0 / __pyx_v_sigma) * __pyx_v_12PygameShader_6shader_C1_) * exp(((-0.5 * ((__pyx_v_x - __pyx_v_mu) * (__pyx_v_x - __pyx_v_mu))) / (__pyx_v_sigma * __pyx_v_sigma))));
      goto __pyx_L0;

     2597:

     2598:

     2599: @cython.boundscheck(False)

     2600: @cython.wraparound(False)

     2601: @cython.nonecheck(False)

     2602: @cython.cdivision(True)

    +2603: cdef inline void shader_rgb_to_bgr_inplace_c(unsigned char [:, :, :] rgb_array):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_bgr_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_tmp;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rgb_to_bgr_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     2604:     """

     2605:     SHADER RGB to BGR

     2606:

     2607:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     2608:     please refer to pygame function pixels3d or array3d to convert an image into a

     2609:     3d array (library surfarray)

     2610:

     2611:     Convert your game display from RGB to BGR format

     2612:     This algorithm can also be used to transform pygame texture in the equivalent bgr format

     2613:

     2614:     e.g:

     2615:     rgb_to_bgr(surface)

     2616:

     2617:     :param rgb_array    : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     2618:     pygame display pixels format RGB. Apply the transformation inplace by swapping the channel

     2619:     Red to channel blue and vice versa

     2620:     :return             : void

     2621:     """

     2622:

     2623:     cdef Py_ssize_t w, h

    +2624:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     2625:

     2626:     cdef:

    +2627:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     2628:         unsigned char tmp

     2629:

    +2630:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     2631:

    +2632:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_tmp = ((unsigned char)'?');

    +2633:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

    +2634:                 tmp = rgb_array[i, j, 0]  # keep the blue color

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_tmp = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

    +2635:                 rgb_array[i, j, 0]  = rgb_array[i, j, 2]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 2;
                                  __pyx_t_11 = __pyx_v_i;
                                  __pyx_t_12 = __pyx_v_j;
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )));

    +2636:                 rgb_array[i, j, 2]  = tmp

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     2637:

     2638:

     2639: @cython.boundscheck(False)

     2640: @cython.wraparound(False)

     2641: @cython.nonecheck(False)

     2642: @cython.cdivision(True)

    +2643: cdef inline void shader_rgb_to_brg_inplace_c(unsigned char [:, :, :] rgb_array):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_to_brg_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_tmp_r;
      unsigned char __pyx_v_tmp_g;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rgb_to_brg_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     2644:     """

     2645:

     2646:     SHADER RGB TO BRG

     2647:

     2648:     Convert your game display from RGB to BRG format.

     2649:     This algorithm can also be used to transform pygame texture in the equivalent BRG format

     2650:

     2651:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     2652:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     2653:     (library surfarray)

     2654:

     2655:     e.g:

     2656:     rgb_to_brg(surface)

     2657:

     2658:     :param rgb_array    : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     2659:     pygame display pixels format RGB

     2660:     :return             : void

     2661:     """

     2662:

     2663:     cdef Py_ssize_t w, h

    +2664:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     2665:

     2666:     cdef:

    +2667:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     2668:         unsigned char tmp_r, tmp_g

     2669:         unsigned char *r

     2670:         unsigned char *g

     2671:         unsigned char *b

     2672:

    +2673:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     2674:

    +2675:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp_g) lastprivate(__pyx_v_tmp_r) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_tmp_g) lastprivate(__pyx_v_tmp_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_tmp_g = ((unsigned char)'?');
                                __pyx_v_tmp_r = ((unsigned char)'?');

    +2676:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

    +2677:                 tmp_r = rgb_array[i, j, 0]  # keep the red color

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_tmp_r = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

    +2678:                 tmp_g = rgb_array[i, j, 1]  # keep the green color

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_tmp_g = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )));

    +2679:                 rgb_array[i, j, 0] = rgb_array[i, j, 2] # r-->b

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_t_11 = __pyx_v_i;
                                  __pyx_t_12 = __pyx_v_j;
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )));

    +2680:                 rgb_array[i, j, 1] = tmp_r  # g --> r

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp_r;

    +2681:                 rgb_array[i, j, 2] = tmp_g

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_tmp_g;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     2682:

     2683:

     2684:

     2685: @cython.boundscheck(False)

     2686: @cython.wraparound(False)

     2687: @cython.nonecheck(False)

     2688: @cython.cdivision(True)

    +2689: cdef inline void shader_greyscale_luminosity24_inplace_c(unsigned char [:, :, :] rgb_array):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_luminosity;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_greyscale_luminosity24_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     2690:     """

     2691:     SHADER GRAYSCALE (CONSERVE LUMINOSITY)

     2692:

     2693:     This shader transform the game display on a grayscale video game effect

     2694:     This shader can also be applied to pygame textures/surface to transform them into

     2695:     an equivalent grayscale model

     2696:

     2697:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     2698:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     2699:     (library surfarray)

     2700:

     2701:     e.g:

     2702:     greyscale(surface)

     2703:

     2704:     :param rgb_array    : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     2705:     pygame display pixels format RGB

     2706:     :return             : void

     2707:     """

     2708:

     2709:     cdef Py_ssize_t w, h

    +2710:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     2711:

     2712:     cdef:

     2713:         int i, j

     2714:         unsigned char luminosity

     2715:         unsigned char *r

     2716:         unsigned char *g

     2717:         unsigned char *b

     2718:

    +2719:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +2720:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_luminosity) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_luminosity) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_luminosity = ((unsigned char)'?');
                                __pyx_v_r = ((unsigned char *)1);

    +2721:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

    +2722:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +2723:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +2724:                 b = &rgb_array[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +2725:                 luminosity = <unsigned char>(r[0] * 0.2126 + g[0] * 0.7152 + b[0] * 0.072)

                                  __pyx_v_luminosity = ((unsigned char)((((__pyx_v_r[0]) * 0.2126) + ((__pyx_v_g[0]) * 0.7152)) + ((__pyx_v_b[0]) * 0.072)));

    +2726:                 r[0] = luminosity

                                  (__pyx_v_r[0]) = __pyx_v_luminosity;

    +2727:                 g[0] = luminosity

                                  (__pyx_v_g[0]) = __pyx_v_luminosity;

    +2728:                 b[0] = luminosity

                                  (__pyx_v_b[0]) = __pyx_v_luminosity;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     2729:

     2730:

     2731: @cython.boundscheck(False)

     2732: @cython.wraparound(False)

     2733: @cython.nonecheck(False)

     2734: @cython.cdivision(True)

    +2735: cdef inline void shader_sepia24_inplace_c(unsigned char [:, :, :] rgb_array):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sepia24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_rr;
      float __pyx_v_gg;
      float __pyx_v_bb;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_sepia24_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     2736:

     2737:     """

     2738:     SHADER SEPIA MODEL

     2739:

     2740:     Transform your video game into an equivalent sepia model

     2741:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     2742:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     2743:     (library surfarray)

     2744:

     2745:     e.g:

     2746:     sepia(surface)

     2747:

     2748:     :param rgb_array    : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     2749:     pygame display pixels format RGB

     2750:     :return             : void

     2751:     """

     2752:     cdef Py_ssize_t w, h

    +2753:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     2754:

     2755:     cdef:

    +2756:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     2757:         float rr, gg, bb

     2758:         unsigned char *r

     2759:         unsigned char *g

     2760:         unsigned char *b

     2761:

    +2762:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +2763:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_bb = ((float)__PYX_NAN());
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_gg = ((float)__PYX_NAN());
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_rr = ((float)__PYX_NAN());

    +2764:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

     2765:

    +2766:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +2767:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +2768:                 b = &rgb_array[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

     2769:

    +2770:                 rr = r[0] * <float>0.393 + g[0] * <float>0.769 + b[0] * <float>0.189

                                  __pyx_v_rr = ((((__pyx_v_r[0]) * ((float)0.393)) + ((__pyx_v_g[0]) * ((float)0.769))) + ((__pyx_v_b[0]) * ((float)0.189)));

    +2771:                 gg = r[0] * <float>0.349 + g[0] * <float>0.686 + b[0] * <float>0.168

                                  __pyx_v_gg = ((((__pyx_v_r[0]) * ((float)0.349)) + ((__pyx_v_g[0]) * ((float)0.686))) + ((__pyx_v_b[0]) * ((float)0.168)));

    +2772:                 bb = r[0] * <float>0.272 + g[0] * <float>0.534 + b[0] * <float>0.131

                                  __pyx_v_bb = ((((__pyx_v_r[0]) * ((float)0.272)) + ((__pyx_v_g[0]) * ((float)0.534))) + ((__pyx_v_b[0]) * ((float)0.131)));

    +2773:                 if rr > 255:

                                  __pyx_t_11 = ((__pyx_v_rr > 255.0) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +2774:                     rr = 255

                                    __pyx_v_rr = 255.0;

    +2775:                 if gg > 255:

                                  __pyx_t_11 = ((__pyx_v_gg > 255.0) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +2776:                     gg = 255

                                    __pyx_v_gg = 255.0;

    +2777:                 if bb > 255:

                                  __pyx_t_11 = ((__pyx_v_bb > 255.0) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +2778:                     bb = 255

                                    __pyx_v_bb = 255.0;

    +2779:                 r[0] = <unsigned char> rr

                                  (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rr);

    +2780:                 g[0] = <unsigned char> gg

                                  (__pyx_v_g[0]) = ((unsigned char)__pyx_v_gg);

    +2781:                 b[0] = <unsigned char> bb

                                  (__pyx_v_b[0]) = ((unsigned char)__pyx_v_bb);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     2782:

     2783: # ************* SORTING ALGORITHM FOR MEDIAN FILTER

     2784: @cython.boundscheck(False)

     2785: @cython.wraparound(False)

     2786: @cython.nonecheck(False)

     2787: @cython.cdivision(True)

    +2788: cdef inline void bubble_sort(unsigned char [::1] nums, int size)nogil:

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bubble_sort(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_size) {
      int __pyx_v_i;
      unsigned char *__pyx_v_p;
      unsigned char *__pyx_v_p1;
      int __pyx_v_swapped;
    /* … */
      /* function exit code */
    }

     2789:     """

     2790:

     2791:     :param nums:

     2792:     :param size:

     2793:     :return:

     2794:     """

     2795:     # We set swapped to True so the loop looks runs at least once

     2796:     cdef:

     2797:         int i, j

     2798:         unsigned char *p

     2799:         unsigned char *p1

     2800:         bint swapped

     2801:

    +2802:     swapped = True

      __pyx_v_swapped = 1;

    +2803:     while swapped:

      while (1) {
        __pyx_t_1 = (__pyx_v_swapped != 0);
        if (!__pyx_t_1) break;

    +2804:         swapped = False

        __pyx_v_swapped = 0;

    +2805:         for i in range(size - 1):

        __pyx_t_2 = (__pyx_v_size - 1);
        __pyx_t_3 = __pyx_t_2;
        for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
          __pyx_v_i = __pyx_t_4;

    +2806:             p  = &nums[i]

          __pyx_t_5 = __pyx_v_i;
          __pyx_v_p = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_5)) ))));

    +2807:             p1 = &nums[i+1]

          __pyx_t_5 = (__pyx_v_i + 1);
          __pyx_v_p1 = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_5)) ))));

    +2808:             if p[0] > p1[0]:

          __pyx_t_1 = (((__pyx_v_p[0]) > (__pyx_v_p1[0])) != 0);
          if (__pyx_t_1) {
    /* … */
          }
        }
      }

    +2809:                 p[0], p1[0] = p1[0], p[0]

            __pyx_t_6 = (__pyx_v_p1[0]);
            __pyx_t_7 = (__pyx_v_p[0]);
            (__pyx_v_p[0]) = __pyx_t_6;
            (__pyx_v_p1[0]) = __pyx_t_7;

    +2810:                 swapped = True

            __pyx_v_swapped = 1;

     2811:

     2812:

     2813: @cython.boundscheck(False)

     2814: @cython.wraparound(False)

     2815: @cython.nonecheck(False)

     2816: @cython.cdivision(True)

    +2817: cdef inline void insertion_sort(unsigned char [::1] nums, int size)nogil:

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_insertion_sort(__Pyx_memviewslice __pyx_v_nums, CYTHON_UNUSED int __pyx_v_size) {
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_item_to_insert;
    /* … */
      /* function exit code */
    }

     2818:     """

     2819:

     2820:     :param nums:

     2821:     :param size:

     2822:     :return:

     2823:     """

     2824:

     2825:     cdef:

     2826:         int i, j

     2827:         unsigned char item_to_insert

     2828:

    +2829:     for i in prange(1, size, schedule='static', num_threads=THREADS):

      __pyx_t_1 = __pyx_v_size;
      if ((1 == 0)) abort();
      {
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   (x)
              #define unlikely(x) (x)
          #endif
          __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
          if (__pyx_t_3 > 0)
          {
              #ifdef _OPENMP
              #pragma omp parallel
              #endif /* _OPENMP */
              {
                  #ifdef _OPENMP
                  #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_item_to_insert) lastprivate(__pyx_v_j) schedule(static)
    /* … */
      __pyx_t_1 = __pyx_v_size;
      if ((1 == 0)) abort();
      {
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   (x)
              #define unlikely(x) (x)
          #endif
          __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
          if (__pyx_t_3 > 0)
          {
              #ifdef _OPENMP
              #pragma omp parallel
              #endif /* _OPENMP */
              {
                  #ifdef _OPENMP
                  #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_item_to_insert) lastprivate(__pyx_v_j) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                  #endif /* _OPENMP */
                  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                      {
                          __pyx_v_i = (int)(1 + 1 * __pyx_t_2);
                          /* Initialize private variables to invalid values */
                          __pyx_v_item_to_insert = ((unsigned char)'?');
                          __pyx_v_j = ((int)0xbad0bad0);

    +2830:         item_to_insert = nums[i]

                          __pyx_t_4 = __pyx_v_i;
                          __pyx_v_item_to_insert = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )));

     2831:

    +2832:         j = i - 1

                          __pyx_v_j = (__pyx_v_i - 1);

    +2833:         while j >= 0 and nums[j] > item_to_insert:

                          while (1) {
                            __pyx_t_6 = ((__pyx_v_j >= 0) != 0);
                            if (__pyx_t_6) {
                            } else {
                              __pyx_t_5 = __pyx_t_6;
                              goto __pyx_L9_bool_binop_done;
                            }
                            __pyx_t_4 = __pyx_v_j;
                            __pyx_t_6 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) ))) > __pyx_v_item_to_insert) != 0);
                            __pyx_t_5 = __pyx_t_6;
                            __pyx_L9_bool_binop_done:;
                            if (!__pyx_t_5) break;

    +2834:             nums[j + 1] = nums[j]

                            __pyx_t_4 = __pyx_v_j;
                            __pyx_t_7 = (__pyx_v_j + 1);
                            *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_7)) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )));

    +2835:             j = j - 1

                            __pyx_v_j = (__pyx_v_j - 1);
                          }

     2836:         # Insert the item

    +2837:         nums[j + 1] = item_to_insert

                          __pyx_t_4 = (__pyx_v_j + 1);
                          *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )) = __pyx_v_item_to_insert;
                      }
                  }
              }
          }
      }
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   __builtin_expect(!!(x), 1)
          #define unlikely(x) __builtin_expect(!!(x), 0)
      #endif

     2838:

     2839:

     2840:

     2841: @cython.boundscheck(False)

     2842: @cython.wraparound(False)

     2843: @cython.nonecheck(False)

     2844: @cython.cdivision(True)

     2845: # There are different ways to do a Quick Sort partition, this implements the

     2846: # Hoare partition scheme. Tony Hoare also created the Quick Sort algorithm.

    +2847: cdef inline int partition(unsigned char [::1] nums, int low, int high)nogil:

    static CYTHON_INLINE int __pyx_f_12PygameShader_6shader_partition(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_low, int __pyx_v_high) {
      int __pyx_v_pivot;
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_r;
    /* … */
      /* function exit code */
      __pyx_r = 0;
      __pyx_L0:;
      return __pyx_r;
    }

     2848:     """

     2849:

     2850:     :param nums:

     2851:     :param low:

     2852:     :param high:

     2853:     :return:

     2854:     """

     2855:     cdef:

     2856:         int pivot

     2857:         int i, j

    +2858:     pivot = nums[(low + high) >> 1]

      __pyx_t_1 = ((__pyx_v_low + __pyx_v_high) >> 1);
      __pyx_v_pivot = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));

    +2859:     i = low - 1

      __pyx_v_i = (__pyx_v_low - 1);

    +2860:     j = high + 1

      __pyx_v_j = (__pyx_v_high + 1);

    +2861:     while True:

      while (1) {

    +2862:         i += 1

        __pyx_v_i = (__pyx_v_i + 1);

    +2863:         while nums[i] < pivot:

        while (1) {
          __pyx_t_1 = __pyx_v_i;
          __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) ))) < __pyx_v_pivot) != 0);
          if (!__pyx_t_2) break;

    +2864:             i += 1

          __pyx_v_i = (__pyx_v_i + 1);
        }

     2865:

    +2866:         j -= 1

        __pyx_v_j = (__pyx_v_j - 1);

    +2867:         while nums[j] > pivot:

        while (1) {
          __pyx_t_1 = __pyx_v_j;
          __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) ))) > __pyx_v_pivot) != 0);
          if (!__pyx_t_2) break;

    +2868:             j -= 1

          __pyx_v_j = (__pyx_v_j - 1);
        }

     2869:

    +2870:         if i >= j:

        __pyx_t_2 = ((__pyx_v_i >= __pyx_v_j) != 0);
        if (__pyx_t_2) {
    /* … */
        }

    +2871:             return j

          __pyx_r = __pyx_v_j;
          goto __pyx_L0;

     2872:

    +2873:         nums[i], nums[j] = nums[j], nums[i]

        __pyx_t_1 = __pyx_v_j;
        __pyx_t_3 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));
        __pyx_t_1 = __pyx_v_i;
        __pyx_t_4 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )));
        __pyx_t_1 = __pyx_v_i;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )) = __pyx_t_3;
        __pyx_t_1 = __pyx_v_j;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_1)) )) = __pyx_t_4;
      }

     2874:

     2875:

     2876: @cython.boundscheck(False)

     2877: @cython.wraparound(False)

     2878: @cython.nonecheck(False)

     2879: @cython.cdivision(True)

    +2880: cdef inline void _quick_sort(unsigned char [::1] items, int low, int high)nogil:

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader__quick_sort(__Pyx_memviewslice __pyx_v_items, int __pyx_v_low, int __pyx_v_high) {
      int __pyx_v_split_index;
    /* … */
      /* function exit code */
    }

     2881:     """

     2882:

     2883:     :param items:

     2884:     :param low:

     2885:     :param high:

     2886:     :return:

     2887:     """

     2888:     cdef int split_index

    +2889:     if low < high:

      __pyx_t_1 = ((__pyx_v_low < __pyx_v_high) != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +2890:         split_index = partition(items, low, high)

        __pyx_v_split_index = __pyx_f_12PygameShader_6shader_partition(__pyx_v_items, __pyx_v_low, __pyx_v_high);

    +2891:         _quick_sort(items, low, split_index)

        __pyx_f_12PygameShader_6shader__quick_sort(__pyx_v_items, __pyx_v_low, __pyx_v_split_index);

    +2892:         _quick_sort(items, split_index + 1, high)

        __pyx_f_12PygameShader_6shader__quick_sort(__pyx_v_items, (__pyx_v_split_index + 1), __pyx_v_high);

     2893:

     2894:

     2895: @cython.boundscheck(False)

     2896: @cython.wraparound(False)

     2897: @cython.nonecheck(False)

     2898: @cython.cdivision(True)

    +2899: cdef inline void heapify(unsigned char [::1] nums, int heap_size, int root_index)nogil:

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heapify(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_heap_size, int __pyx_v_root_index) {
      int __pyx_v_largest;
      int __pyx_v_left_child;
      int __pyx_v_right_child;
    /* … */
      /* function exit code */
    }

     2900:     """

     2901:

     2902:     :param nums:

     2903:     :param heap_size:

     2904:     :param root_index:

     2905:     :return:

     2906:     """

     2907:     # Assume the index of the largest element is the root index

    +2908:     cdef int largest = root_index

      __pyx_v_largest = __pyx_v_root_index;

    +2909:     cdef int left_child = (2 * root_index) + 1

      __pyx_v_left_child = ((2 * __pyx_v_root_index) + 1);

    +2910:     cdef int right_child = (2 * root_index) + 2

      __pyx_v_right_child = ((2 * __pyx_v_root_index) + 2);

     2911:

    +2912:     if left_child < heap_size and nums[left_child] > nums[largest]:

      __pyx_t_2 = ((__pyx_v_left_child < __pyx_v_heap_size) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_3 = __pyx_v_left_child;
      __pyx_t_4 = __pyx_v_largest;
      __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) ))) > (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) )))) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_1) {
    /* … */
      }

    +2913:         largest = left_child

        __pyx_v_largest = __pyx_v_left_child;

     2914:

    +2915:     if right_child < heap_size and nums[right_child] > nums[largest]:

      __pyx_t_2 = ((__pyx_v_right_child < __pyx_v_heap_size) != 0);
      if (__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_4 = __pyx_v_right_child;
      __pyx_t_3 = __pyx_v_largest;
      __pyx_t_2 = (((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_4)) ))) > (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )))) != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L7_bool_binop_done:;
      if (__pyx_t_1) {
    /* … */
      }

    +2916:         largest = right_child

        __pyx_v_largest = __pyx_v_right_child;

     2917:

    +2918:     if largest != root_index:

      __pyx_t_1 = ((__pyx_v_largest != __pyx_v_root_index) != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +2919:         nums[root_index], nums[largest] = nums[largest], nums[root_index]

        __pyx_t_3 = __pyx_v_largest;
        __pyx_t_5 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )));
        __pyx_t_3 = __pyx_v_root_index;
        __pyx_t_6 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )));
        __pyx_t_3 = __pyx_v_root_index;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )) = __pyx_t_5;
        __pyx_t_3 = __pyx_v_largest;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_3)) )) = __pyx_t_6;

    +2920:         heapify(nums, heap_size, largest)

        __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_heap_size, __pyx_v_largest);

     2921:

     2922:

     2923:

     2924: @cython.boundscheck(False)

     2925: @cython.wraparound(False)

     2926: @cython.nonecheck(False)

     2927: @cython.cdivision(True)

    +2928: cdef inline void heap_sort(unsigned char [::1] nums, int n)nogil:

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heap_sort(__Pyx_memviewslice __pyx_v_nums, int __pyx_v_n) {
      long __pyx_v_i;
    /* … */
      /* function exit code */
    }

     2929:     """

     2930:

     2931:     :param nums:

     2932:     :param n:

     2933:     :return:

     2934:     """

     2935:

    +2936:     for i in range(n, -1, -1):

      for (__pyx_t_1 = __pyx_v_n; __pyx_t_1 > -1L; __pyx_t_1-=1) {
        __pyx_v_i = __pyx_t_1;

    +2937:         heapify(nums, n, i)

        __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_n, __pyx_v_i);
      }

     2938:

    +2939:     for i in range(n - 1, 0, -1):

      for (__pyx_t_1 = (__pyx_v_n - 1); __pyx_t_1 > 0; __pyx_t_1-=1) {
        __pyx_v_i = __pyx_t_1;

    +2940:         nums[i], nums[0] = nums[0], nums[i]

        __pyx_t_2 = 0;
        __pyx_t_3 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )));
        __pyx_t_2 = __pyx_v_i;
        __pyx_t_4 = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )));
        __pyx_t_2 = __pyx_v_i;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )) = __pyx_t_3;
        __pyx_t_2 = 0;
        *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_nums.data) + __pyx_t_2)) )) = __pyx_t_4;

    +2941:         heapify(nums, i, 0)

        __pyx_f_12PygameShader_6shader_heapify(__pyx_v_nums, __pyx_v_i, 0);
      }

     2942:

     2943:

     2944:

     2945: # *********** END OF SORTING ALGORITHM

     2946:

     2947:

     2948: @cython.boundscheck(False)

     2949: @cython.wraparound(False)

     2950: @cython.nonecheck(False)

     2951: @cython.cdivision(True)

    +2952: cdef inline void shader_median_filter24_inplace_heapsort_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_k;
      int __pyx_v_k_size;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_ky;
      int __pyx_v_kx;
      Py_ssize_t __pyx_v_ii;
      Py_ssize_t __pyx_v_jj;
      __Pyx_memviewslice __pyx_v_tmp_red = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_tmp_green = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_tmp_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_index;
      CYTHON_UNUSED Py_ssize_t __pyx_v_w_1;
      Py_ssize_t __pyx_v_h_1;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_median_filter24_inplace_heapsort_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_inplace_heapsort_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_red, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_green, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_blue, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_heapsort_c {
      int __pyx_n;
      int kernel_size_;
    };

     2953:         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):

     2954:

     2955:     """

     2956:     SHADER MEDIAN FILTER

     2957:

     2958:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     2959:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     2960:     be adapted for a real time application. Another version can also be written with a surface

     2961:     downscale prior processing /rescale method that would boost the fps performance.

     2962:

     2963:     In the state, this shader can be used for texture/surface transformation offline

     2964:

     2965:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     2966:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     2967:     (library surfarray)

     2968:

     2969:     :param rgb_array_   : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     2970:     pygame display pixels format RGB

     2971:     :param kernel_size_ : integer; size of the kernel

     2972:     :return             : void

     2973:     """

     2974:

     2975:     cdef Py_ssize_t w, h

    +2976:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     2977:

     2978:     cdef:

    +2979:         int k = kernel_size_ >> 1

      __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

    +2980:         int k_size = kernel_size_ * kernel_size_

      __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

     2981:

     2982:     cdef:

     2983:         unsigned char [:, :, ::1] rgb_array_copy = \

    +2984:             ascontiguousarray(numpy.array(rgb_array_, copy=True))

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 2984, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 2984, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_10;
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;

     2985:

    +2986:         int i=0, j=0, ky, kx

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +2987:         Py_ssize_t ii=0, jj=0

      __pyx_v_ii = 0;
      __pyx_v_jj = 0;

     2988:

    +2989:         unsigned char [::1] tmp_red   = empty(k_size, numpy.uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2989, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2989, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_tmp_red = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

    +2990:         unsigned char [::1] tmp_green = empty(k_size, numpy.uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
      __pyx_t_6 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2990, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2990, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_tmp_green = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

    +2991:         unsigned char [::1] tmp_blue  = empty(k_size, numpy.uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_k_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 2991, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 2991, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_tmp_blue = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     2992:

    +2993:         int index = 0

      __pyx_v_index = 0;

    +2994:         Py_ssize_t w_1 = w, h_1 = h

      __pyx_v_w_1 = __pyx_v_w;
      __pyx_v_h_1 = __pyx_v_h;

     2995:

    +2996:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +2997:         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):

            __pyx_t_3 = __pyx_v_w_1;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky)            __pyx_t_13 = 0x800;
    /* … */
            __pyx_t_3 = __pyx_v_w_1;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) schedule(static, __pyx_t_13) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_index = ((int)0xbad0bad0);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_kx = ((int)0xbad0bad0);
                                __pyx_v_ky = ((int)0xbad0bad0);

    +2998:             for j in range(h_1):

                                __pyx_t_14 = __pyx_v_h_1;
                                __pyx_t_15 = __pyx_t_14;
                                for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) {
                                  __pyx_v_j = __pyx_t_16;

     2999:

    +3000:                 index = 0

                                  __pyx_v_index = 0;

     3001:

    +3002:                 for kx in range(-k, k):

                                  __pyx_t_17 = __pyx_v_k;
                                  __pyx_t_18 = __pyx_t_17;
                                  for (__pyx_t_19 = (-__pyx_v_k); __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
                                    __pyx_v_kx = __pyx_t_19;

    +3003:                     for ky in range(-k, k):

                                    __pyx_t_20 = __pyx_v_k;
                                    __pyx_t_21 = __pyx_t_20;
                                    for (__pyx_t_22 = (-__pyx_v_k); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                      __pyx_v_ky = __pyx_t_22;

     3004:

    +3005:                         ii = i + kx

                                      __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

    +3006:                         jj = j + ky

                                      __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

     3007:

    +3008:                         if ii < 0:

                                      __pyx_t_23 = ((__pyx_v_ii < 0) != 0);
                                      if (__pyx_t_23) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +3009:                             ii = 0

                                        __pyx_v_ii = 0;

    +3010:                         elif ii > w:

                                      __pyx_t_23 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                      if (__pyx_t_23) {
    /* … */
                                      }
                                      __pyx_L16:;

    +3011:                             ii = w

                                        __pyx_v_ii = __pyx_v_w;

     3012:

    +3013:                         if jj < 0:

                                      __pyx_t_23 = ((__pyx_v_jj < 0) != 0);
                                      if (__pyx_t_23) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +3014:                             jj = 0

                                        __pyx_v_jj = 0;

    +3015:                         elif jj > h:

                                      __pyx_t_23 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                      if (__pyx_t_23) {
    /* … */
                                      }
                                      __pyx_L17:;

    +3016:                             jj = h

                                        __pyx_v_jj = __pyx_v_h;

     3017:

    +3018:                         tmp_red[index]   = rgb_array_copy[ii, jj, 0]

                                      __pyx_t_24 = __pyx_v_ii;
                                      __pyx_t_25 = __pyx_v_jj;
                                      __pyx_t_26 = 0;
                                      __pyx_t_27 = __pyx_v_index;
                                      *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_red.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_26)) )));

    +3019:                         tmp_green[index] = rgb_array_copy[ii, jj, 1]

                                      __pyx_t_26 = __pyx_v_ii;
                                      __pyx_t_25 = __pyx_v_jj;
                                      __pyx_t_24 = 1;
                                      __pyx_t_27 = __pyx_v_index;
                                      *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_green.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_24)) )));

    +3020:                         tmp_blue[index]  = rgb_array_copy[ii, jj, 2]

                                      __pyx_t_24 = __pyx_v_ii;
                                      __pyx_t_25 = __pyx_v_jj;
                                      __pyx_t_26 = 2;
                                      __pyx_t_27 = __pyx_v_index;
                                      *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_blue.data) + __pyx_t_27)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_26)) )));

    +3021:                         index = index + 1

                                      __pyx_v_index = (__pyx_v_index + 1);
                                    }
                                  }

     3022:

    +3023:                 heap_sort(tmp_red, k_size)

                                  __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_red, __pyx_v_k_size);

    +3024:                 heap_sort(tmp_green, k_size)

                                  __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_green, __pyx_v_k_size);

    +3025:                 heap_sort(tmp_blue, k_size)

                                  __pyx_f_12PygameShader_6shader_heap_sort(__pyx_v_tmp_blue, __pyx_v_k_size);

     3026:

    +3027:                 rgb_array_[i, j, 0] = tmp_red[k + 1]

                                  __pyx_t_26 = (__pyx_v_k + 1);
                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_27 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_red.data) + __pyx_t_26)) )));

    +3028:                 rgb_array_[i, j, 1] = tmp_green[k + 1]

                                  __pyx_t_26 = (__pyx_v_k + 1);
                                  __pyx_t_27 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_25 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_green.data) + __pyx_t_26)) )));

    +3029:                 rgb_array_[i, j, 2]= tmp_blue[k + 1]

                                  __pyx_t_26 = (__pyx_v_k + 1);
                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_27 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_tmp_blue.data) + __pyx_t_26)) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3030:

     3031:

     3032:

     3033: @cython.boundscheck(False)

     3034: @cython.wraparound(False)

     3035: @cython.nonecheck(False)

     3036: @cython.cdivision(True)

    +3037: cdef inline void shader_median_filter24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_ky;
      int __pyx_v_kx;
      Py_ssize_t __pyx_v_ii;
      Py_ssize_t __pyx_v_jj;
      int __pyx_v_k;
      int __pyx_v_k_size;
      int *__pyx_v_tmp_red;
      int *__pyx_v_tmp_green;
      int *__pyx_v_tmp_blue;
      __Pyx_memviewslice __pyx_v_tmp_red_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_tmp_green_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_tmp_blue_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      int *__pyx_v_tmpr;
      int *__pyx_v_tmpg;
      int *__pyx_v_tmpb;
      int __pyx_v_index;
      CYTHON_UNUSED Py_ssize_t __pyx_v_w_1;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h_1;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_median_filter24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __Pyx_XDECREF(((PyObject *)__pyx_t_11));
      __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_red_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_green_, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_tmp_blue_, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_inplace_c {
      int __pyx_n;
      int kernel_size_;
    };

     3038:         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):

     3039:

     3040:     """

     3041:     SHADER MEDIAN FILTER

     3042:

     3043:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     3044:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     3045:     be adapted for a real time application. Another version can also be written with a surface

     3046:     downscale prior processing /rescale method that would boost the fps performance.

     3047:

     3048:     In the state, this shader can be used for texture/surface transformation offline

     3049:

     3050:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3051:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     3052:     (library surfarray)

     3053:

     3054:     :param rgb_array_   : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     3055:     pygame display pixels format RGB

     3056:     :param kernel_size_ : integer; size of the kernel

     3057:     :return             : void

     3058:     """

     3059:

     3060:     cdef Py_ssize_t w, h

    +3061:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3062:

     3063:     cdef:

     3064:         unsigned char [:, :, ::1] rgb_array_copy = \

    +3065:             ascontiguousarray(numpy.array(rgb_array_, copy=True))

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3065, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3065, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_10;
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;

     3066:

    +3067:         int i=0, j=0, ky, kx

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +3068:         Py_ssize_t ii=0, jj=0

      __pyx_v_ii = 0;
      __pyx_v_jj = 0;

    +3069:         int k = kernel_size_ >> 1

      __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

    +3070:         int k_size = kernel_size_ * kernel_size_

      __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

     3071:

     3072:         # int [64] tmp_red   = empty(64, numpy.int16, order='C')

     3073:         # int [64] tmp_green = empty(64, numpy.int16, order='C')

     3074:         # int [64] tmp_blue  = empty(64, numpy.int16, order='C')

     3075:

    +3076:         int *tmp_red   = <int *> malloc(k_size * sizeof(int))

      __pyx_v_tmp_red = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

    +3077:         int *tmp_green = <int *> malloc(k_size * sizeof(int))

      __pyx_v_tmp_green = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

    +3078:         int *tmp_blue  = <int *> malloc(k_size * sizeof(int))

      __pyx_v_tmp_blue = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

     3079:

    +3080:         int [::1] tmp_red_ = <int[:k_size]>tmp_red

      if (!__pyx_v_tmp_red) {
        PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
        __PYX_ERR(1, 3080, __pyx_L1_error)
      }
      __pyx_t_5 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __pyx_array_new(__pyx_t_4, sizeof(int), PyBytes_AS_STRING(__pyx_t_5), (char *) "c", (char *) __pyx_v_tmp_red);
      if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3080, __pyx_L1_error)
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_v_tmp_red_ = __pyx_t_12;
      __pyx_t_12.memview = NULL;
      __pyx_t_12.data = NULL;

    +3081:         int [::1] tmp_green_ = <int[:k_size]>tmp_green

      if (!__pyx_v_tmp_green) {
        PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
        __PYX_ERR(1, 3081, __pyx_L1_error)
      }
      __pyx_t_4 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_11 = __pyx_array_new(__pyx_t_5, sizeof(int), PyBytes_AS_STRING(__pyx_t_4), (char *) "c", (char *) __pyx_v_tmp_green);
      if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3081, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3081, __pyx_L1_error)
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_v_tmp_green_ = __pyx_t_12;
      __pyx_t_12.memview = NULL;
      __pyx_t_12.data = NULL;

    +3082:         int [::1] tmp_blue_ = <int[:k_size]>tmp_blue

      if (!__pyx_v_tmp_blue) {
        PyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");
        __PYX_ERR(1, 3082, __pyx_L1_error)
      }
      __pyx_t_5 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = Py_BuildValue((char*) "("  __PYX_BUILD_PY_SSIZE_T  ")", ((Py_ssize_t)__pyx_v_k_size)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __pyx_array_new(__pyx_t_4, sizeof(int), PyBytes_AS_STRING(__pyx_t_5), (char *) "c", (char *) __pyx_v_tmp_blue);
      if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_int(((PyObject *)__pyx_t_11), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 3082, __pyx_L1_error)
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __pyx_v_tmp_blue_ = __pyx_t_12;
      __pyx_t_12.memview = NULL;
      __pyx_t_12.data = NULL;

     3083:

     3084:         int *tmpr

     3085:         int *tmpg

     3086:         int *tmpb

     3087:

    +3088:         int index = 0

      __pyx_v_index = 0;

    +3089:         Py_ssize_t w_1 = w, h_1 = h

      __pyx_v_w_1 = __pyx_v_w;
      __pyx_v_h_1 = __pyx_v_h;

     3090:

     3091:

    +3092:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3093:         for i in prange(w_1, schedule='static', num_threads=THREADS, chunksize=2048):

            __pyx_t_3 = __pyx_v_w_1;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_13 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmpb) lastprivate(__pyx_v_tmpg) lastprivate(__pyx_v_tmpr)            __pyx_t_14 = 0x800;
    /* … */
            __pyx_t_3 = __pyx_v_w_1;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_13 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_13 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmpb) lastprivate(__pyx_v_tmpg) lastprivate(__pyx_v_tmpr) schedule(static, __pyx_t_14) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_13; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_index = ((int)0xbad0bad0);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_kx = ((int)0xbad0bad0);
                                __pyx_v_ky = ((int)0xbad0bad0);
                                __pyx_v_tmpb = ((int *)1);
                                __pyx_v_tmpg = ((int *)1);
                                __pyx_v_tmpr = ((int *)1);

    +3094:             for j in prange(h_1):

                                __pyx_t_15 = __pyx_v_h_1;
                                if ((1 == 0)) abort();
                                {
                                    __pyx_t_17 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1;
                                    if (__pyx_t_17 > 0)
                                    {
                                        #if 0
                                        #pragma omp parallel
                                        #endif /* _OPENMP */
                                        {
                                            #if 0
                                            #pragma omp for lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmpb) lastprivate(__pyx_v_tmpg) lastprivate(__pyx_v_tmpr)
                                            #endif /* _OPENMP */
                                            for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){
                                                {
                                                    __pyx_v_j = (int)(0 + 1 * __pyx_t_16);
                                                    /* Initialize private variables to invalid values */
                                                    __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                                    __pyx_v_index = ((int)0xbad0bad0);
                                                    __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                                    __pyx_v_kx = ((int)0xbad0bad0);
                                                    __pyx_v_ky = ((int)0xbad0bad0);
                                                    __pyx_v_tmpb = ((int *)1);
                                                    __pyx_v_tmpg = ((int *)1);
                                                    __pyx_v_tmpr = ((int *)1);

     3095:

    +3096:                 index = 0

                                                    __pyx_v_index = 0;

     3097:

    +3098:                 for kx in range(-k, k):

                                                    __pyx_t_18 = __pyx_v_k;
                                                    __pyx_t_19 = __pyx_t_18;
                                                    for (__pyx_t_20 = (-__pyx_v_k); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                                      __pyx_v_kx = __pyx_t_20;

    +3099:                     for ky in range(-k, k):

                                                      __pyx_t_21 = __pyx_v_k;
                                                      __pyx_t_22 = __pyx_t_21;
                                                      for (__pyx_t_23 = (-__pyx_v_k); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                                        __pyx_v_ky = __pyx_t_23;

     3100:

    +3101:                         ii = i + kx

                                                        __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

    +3102:                         jj = j + ky

                                                        __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

     3103:

    +3104:                         if ii < 0:

                                                        __pyx_t_24 = ((__pyx_v_ii < 0) != 0);
                                                        if (__pyx_t_24) {
    /* … */
                                                          goto __pyx_L18;
                                                        }

    +3105:                             ii = 0

                                                          __pyx_v_ii = 0;

    +3106:                         elif ii > w:

                                                        __pyx_t_24 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                                        if (__pyx_t_24) {
    /* … */
                                                        }
                                                        __pyx_L18:;

    +3107:                             ii = w

                                                          __pyx_v_ii = __pyx_v_w;

     3108:

    +3109:                         if jj < 0:

                                                        __pyx_t_24 = ((__pyx_v_jj < 0) != 0);
                                                        if (__pyx_t_24) {
    /* … */
                                                          goto __pyx_L19;
                                                        }

    +3110:                             jj = 0

                                                          __pyx_v_jj = 0;

    +3111:                         elif jj > h:

                                                        __pyx_t_24 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                                        if (__pyx_t_24) {
    /* … */
                                                        }
                                                        __pyx_L19:;

    +3112:                             jj = h

                                                          __pyx_v_jj = __pyx_v_h;

     3113:

    +3114:                         tmp_red_[index]   = rgb_array_copy[ii, jj, 0]

                                                        __pyx_t_25 = __pyx_v_ii;
                                                        __pyx_t_26 = __pyx_v_jj;
                                                        __pyx_t_27 = 0;
                                                        __pyx_t_28 = __pyx_v_index;
                                                        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_red_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_27)) )));

    +3115:                         tmp_green_[index] = rgb_array_copy[ii, jj, 1]

                                                        __pyx_t_27 = __pyx_v_ii;
                                                        __pyx_t_26 = __pyx_v_jj;
                                                        __pyx_t_25 = 1;
                                                        __pyx_t_28 = __pyx_v_index;
                                                        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_green_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_27 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_25)) )));

    +3116:                         tmp_blue_[index]  = rgb_array_copy[ii, jj, 2]

                                                        __pyx_t_25 = __pyx_v_ii;
                                                        __pyx_t_26 = __pyx_v_jj;
                                                        __pyx_t_27 = 2;
                                                        __pyx_t_28 = __pyx_v_index;
                                                        *((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_blue_.data) + __pyx_t_28)) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_25 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_27)) )));

    +3117:                         index = index + 1

                                                        __pyx_v_index = (__pyx_v_index + 1);
                                                      }
                                                    }

     3118:

     3119:                 # External C quicksort

    +3120:                 tmpr = quickSort(&tmp_red_[0], 0, k_size)

                                                    __pyx_t_27 = 0;
                                                    __pyx_v_tmpr = quickSort((&(*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_tmp_red_.data) + __pyx_t_27)) )))), 0, __pyx_v_k_size);

    +3121:                 tmpg = quickSort(&tmp_green[0], 0, k_size)

                                                    __pyx_v_tmpg = quickSort((&(__pyx_v_tmp_green[0])), 0, __pyx_v_k_size);

    +3122:                 tmpb = quickSort(&tmp_blue[0], 0, k_size)

                                                    __pyx_v_tmpb = quickSort((&(__pyx_v_tmp_blue[0])), 0, __pyx_v_k_size);

     3123:

    +3124:                 rgb_array_[i, j, 0] = tmpr[k + 1]

                                                    __pyx_t_27 = __pyx_v_i;
                                                    __pyx_t_26 = __pyx_v_j;
                                                    __pyx_t_25 = 0;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpr[(__pyx_v_k + 1)]);

    +3125:                 rgb_array_[i, j, 1] = tmpg[k + 1]

                                                    __pyx_t_25 = __pyx_v_i;
                                                    __pyx_t_26 = __pyx_v_j;
                                                    __pyx_t_27 = 1;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpg[(__pyx_v_k + 1)]);

    +3126:                 rgb_array_[i, j, 2] = tmpb[k + 1]

                                                    __pyx_t_27 = __pyx_v_i;
                                                    __pyx_t_26 = __pyx_v_j;
                                                    __pyx_t_25 = 2;
                                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_26 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmpb[(__pyx_v_k + 1)]);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3127:

     3128:

     3129:

     3130: @cython.boundscheck(False)

     3131: @cython.wraparound(False)

     3132: @cython.nonecheck(False)

     3133: @cython.cdivision(True)

    +3134: cdef inline void shader_median_filter24_avg_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_filter24_avg_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      CYTHON_UNUSED __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_ky;
      int __pyx_v_kx;
      Py_ssize_t __pyx_v_ii;
      Py_ssize_t __pyx_v_jj;
      int __pyx_v_k;
      CYTHON_UNUSED int __pyx_v_k_size;
      Py_ssize_t __pyx_v_w_1;
      Py_ssize_t __pyx_v_h_1;
      unsigned char __pyx_v_max_r;
      unsigned char __pyx_v_min_r;
      unsigned char __pyx_v_max_g;
      unsigned char __pyx_v_min_g;
      unsigned char __pyx_v_max_b;
      unsigned char __pyx_v_min_b;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_median_filter24_avg_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_median_filter24_avg_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_median_filter24_avg_inplace_c {
      int __pyx_n;
      int kernel_size_;
    };

     3135:         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):

     3136:

     3137:     """

     3138:     SHADER MEDIAN FILTER

     3139:

     3140:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     3141:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     3142:     be adapted for a real time application. Another version can also be written with a surface

     3143:     downscale prior processing /rescale method that would boost the fps performance.

     3144:

     3145:     In the state, this shader can be used for texture/surface transformation offline

     3146:

     3147:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3148:     please refer to pygame function pixels3d or array3d to convert an image into a

     3149:     3d array (library surfarray)

     3150:

     3151:     :param rgb_array_   : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     3152:     pygame display pixels format RGB

     3153:     :param kernel_size_ : integer; size of the kernel

     3154:     :return             : void

     3155:     """

     3156:

     3157:     cdef Py_ssize_t w, h

    +3158:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3159:

     3160:     cdef:

     3161:         unsigned char [:, :, ::1] rgb_array_copy = \

    +3162:             ascontiguousarray(numpy.array(rgb_array_, copy=True))

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3162, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3162, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_10;
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;

     3163:

    +3164:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     3165:         int ky, kx

    +3166:         Py_ssize_t ii=0, jj=0

      __pyx_v_ii = 0;
      __pyx_v_jj = 0;

    +3167:         int k = kernel_size_ >> 1

      __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

    +3168:         int k_size = kernel_size_ * kernel_size_

      __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

     3169:

    +3170:         Py_ssize_t w_1 = w - 1, h_1 = h - 1

      __pyx_v_w_1 = (__pyx_v_w - 1);
      __pyx_v_h_1 = (__pyx_v_h - 1);

     3171:         int red, green, blue

     3172:         unsigned char max_r, min_r, max_g, min_g, max_b, min_b

     3173:         unsigned char *r

     3174:         unsigned char *g

     3175:         unsigned char *b

     3176:

    +3177:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3178:         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=2048):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_max_b) lastprivate(__pyx_v_max_g) lastprivate(__pyx_v_max_r) lastprivate(__pyx_v_min_b) lastprivate(__pyx_v_min_g) lastprivate(__pyx_v_min_r) lastprivate(__pyx_v_r)            __pyx_t_12 = 0x800;
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_max_b) lastprivate(__pyx_v_max_g) lastprivate(__pyx_v_max_r) lastprivate(__pyx_v_min_b) lastprivate(__pyx_v_min_g) lastprivate(__pyx_v_min_r) lastprivate(__pyx_v_r) schedule(static, __pyx_t_12) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_11; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_kx = ((int)0xbad0bad0);
                                __pyx_v_ky = ((int)0xbad0bad0);
                                __pyx_v_max_b = ((unsigned char)'?');
                                __pyx_v_max_g = ((unsigned char)'?');
                                __pyx_v_max_r = ((unsigned char)'?');
                                __pyx_v_min_b = ((unsigned char)'?');
                                __pyx_v_min_g = ((unsigned char)'?');
                                __pyx_v_min_r = ((unsigned char)'?');
                                __pyx_v_r = ((unsigned char *)1);

    +3179:             for j in range(h):

                                __pyx_t_13 = __pyx_v_h;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                                  __pyx_v_j = __pyx_t_15;

     3180:

    +3181:                 max_r = 0

                                  __pyx_v_max_r = 0;

    +3182:                 min_r = 0

                                  __pyx_v_min_r = 0;

    +3183:                 max_g = 0

                                  __pyx_v_max_g = 0;

    +3184:                 min_g = 0

                                  __pyx_v_min_g = 0;

    +3185:                 max_b = 0

                                  __pyx_v_max_b = 0;

    +3186:                 min_b = 0

                                  __pyx_v_min_b = 0;

     3187:

    +3188:                 for kx in range(-k, k):

                                  __pyx_t_16 = __pyx_v_k;
                                  __pyx_t_17 = __pyx_t_16;
                                  for (__pyx_t_18 = (-__pyx_v_k); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                    __pyx_v_kx = __pyx_t_18;

    +3189:                     for ky in range(-k, k):

                                    __pyx_t_19 = __pyx_v_k;
                                    __pyx_t_20 = __pyx_t_19;
                                    for (__pyx_t_21 = (-__pyx_v_k); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                      __pyx_v_ky = __pyx_t_21;

    +3190:                         ii = (i + kx)

                                      __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

    +3191:                         jj = (j + ky)

                                      __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

     3192:

    +3193:                         if ii < 0:

                                      __pyx_t_22 = ((__pyx_v_ii < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +3194:                             ii = 0

                                        __pyx_v_ii = 0;

    +3195:                         elif ii > w_1:

                                      __pyx_t_22 = ((__pyx_v_ii > __pyx_v_w_1) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L16:;

    +3196:                             ii = w_1

                                        __pyx_v_ii = __pyx_v_w_1;

     3197:

    +3198:                         if jj < 0:

                                      __pyx_t_22 = ((__pyx_v_jj < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +3199:                             jj = 0

                                        __pyx_v_jj = 0;

    +3200:                         elif jj > h_1:

                                      __pyx_t_22 = ((__pyx_v_jj > __pyx_v_h_1) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L17:;

    +3201:                             jj = h_1

                                        __pyx_v_jj = __pyx_v_h_1;

     3202:

    +3203:                         r = &rgb_array_[ii, jj, 0]

                                      __pyx_t_23 = __pyx_v_ii;
                                      __pyx_t_24 = __pyx_v_jj;
                                      __pyx_t_25 = 0;
                                      __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) ))));

    +3204:                         g = &rgb_array_[ii, jj, 1]

                                      __pyx_t_25 = __pyx_v_ii;
                                      __pyx_t_24 = __pyx_v_jj;
                                      __pyx_t_23 = 1;
                                      __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) ))));

    +3205:                         b = &rgb_array_[ii, jj, 2]

                                      __pyx_t_23 = __pyx_v_ii;
                                      __pyx_t_24 = __pyx_v_jj;
                                      __pyx_t_25 = 2;
                                      __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) ))));

     3206:

    +3207:                         if r[0] > max_r:

                                      __pyx_t_22 = (((__pyx_v_r[0]) > __pyx_v_max_r) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }

    +3208:                             max_r = r[0]

                                        __pyx_v_max_r = (__pyx_v_r[0]);

    +3209:                         if g[0] > max_g:

                                      __pyx_t_22 = (((__pyx_v_g[0]) > __pyx_v_max_g) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }

    +3210:                             max_g = g[0]

                                        __pyx_v_max_g = (__pyx_v_g[0]);

    +3211:                         if b[0] > max_b:

                                      __pyx_t_22 = (((__pyx_v_b[0]) > __pyx_v_max_b) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }

    +3212:                             max_b = b[0]

                                        __pyx_v_max_b = (__pyx_v_b[0]);

     3213:

    +3214:                         if r[0] < min_r:

                                      __pyx_t_22 = (((__pyx_v_r[0]) < __pyx_v_min_r) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }

    +3215:                             min_r = r[0]

                                        __pyx_v_min_r = (__pyx_v_r[0]);

    +3216:                         if g[0] < min_g:

                                      __pyx_t_22 = (((__pyx_v_g[0]) < __pyx_v_min_g) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }

    +3217:                             min_g = g[0]

                                        __pyx_v_min_g = (__pyx_v_g[0]);

    +3218:                         if b[0] < min_b:

                                      __pyx_t_22 = (((__pyx_v_b[0]) < __pyx_v_min_b) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                    }
                                  }

    +3219:                             min_b = b[0]

                                        __pyx_v_min_b = (__pyx_v_b[0]);

     3220:

    +3221:                 rgb_array_[i, j, 0] = <unsigned char>((max_r - min_r) *0.5)

                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_23 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_r - __pyx_v_min_r) * 0.5));

    +3222:                 rgb_array_[i, j, 1] = <unsigned char>((max_g - min_g) *0.5)

                                  __pyx_t_23 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_25 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_g - __pyx_v_min_g) * 0.5));

    +3223:                 rgb_array_[i, j, 2] = <unsigned char>((max_b - min_b) *0.5)

                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_23 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((__pyx_v_max_b - __pyx_v_min_b) * 0.5));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3224:

     3225:

     3226:

     3227: @cython.boundscheck(False)

     3228: @cython.wraparound(False)

     3229: @cython.nonecheck(False)

     3230: @cython.cdivision(True)

    +3231: cdef inline void shader_median_grayscale_filter24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c *__pyx_optional_args) {
      int __pyx_v_kernel_size_ = ((int)2);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_ky;
      int __pyx_v_kx;
      Py_ssize_t __pyx_v_ii;
      Py_ssize_t __pyx_v_jj;
      int __pyx_v_k;
      int __pyx_v_k_size;
      int *__pyx_v_tmp_;
      int *__pyx_v_tmp;
      int __pyx_v_index;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_median_grayscale_filter24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_kernel_size_ = __pyx_optional_args->kernel_size_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_median_grayscale_filter24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_median_grayscale_filter24_inplace_c {
      int __pyx_n;
      int kernel_size_;
    };

     3232:         unsigned char [:, :, :] rgb_array_, int kernel_size_=2):

     3233:

     3234:     """

     3235:     SHADER MEDIAN FILTER

     3236:

     3237:     This shader cannot be used for real time rendering as the performance of the algorithm are not

     3238:     satisfactory. The code would have to be changed and improved with C or assembler in order to

     3239:     be adapted for a real time application. Another version can also be written with a surface

     3240:     downscale prior processing /rescale method that would boost the fps performance.

     3241:

     3242:     In the state, this shader can be used for texture/surface transformation offline

     3243:

     3244:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3245:     please refer to pygame function pixels3d or array3d to convert an image into a 3d

     3246:     array (library surfarray)

     3247:

     3248:     :param rgb_array_   : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     3249:     pygame display pixels format RGB

     3250:     :param kernel_size_ : integer; size of the kernel

     3251:     :return             : void

     3252:     """

     3253:

     3254:     cdef Py_ssize_t w, h

    +3255:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3256:

     3257:     cdef:

     3258:         unsigned char [:, :, ::1] rgb_array_copy = \

    +3259:             ascontiguousarray(numpy.array(rgb_array_, copy=True))

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3259, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(1, 3259, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_10;
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;

     3260:

    +3261:         int i=0, j=0, ky, kx

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +3262:         Py_ssize_t ii=0, jj=0

      __pyx_v_ii = 0;
      __pyx_v_jj = 0;

     3263:

    +3264:         int k = kernel_size_ >> 1

      __pyx_v_k = (__pyx_v_kernel_size_ >> 1);

    +3265:         int k_size = kernel_size_ * kernel_size_

      __pyx_v_k_size = (__pyx_v_kernel_size_ * __pyx_v_kernel_size_);

     3266:         # int [64] tmp_  = empty(64, numpy.int16, order='C')

    +3267:         int *tmp_   = <int *> malloc(k_size * sizeof(int))

      __pyx_v_tmp_ = ((int *)malloc((__pyx_v_k_size * (sizeof(int)))));

     3268:         int *tmp

    +3269:         int index = 0

      __pyx_v_index = 0;

     3270:         unsigned char *v

     3271:

     3272:

    +3273:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3274:         for i in prange(0, w, schedule='static', num_threads=THREADS, chunksize=2048):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmp)            __pyx_t_12 = 0x800;
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_index) lastprivate(__pyx_v_j) lastprivate(__pyx_v_jj) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_tmp) schedule(static, __pyx_t_12) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_11; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_ii = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_index = ((int)0xbad0bad0);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_jj = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_kx = ((int)0xbad0bad0);
                                __pyx_v_ky = ((int)0xbad0bad0);
                                __pyx_v_tmp = ((int *)1);

    +3275:             for j in range(0, h):

                                __pyx_t_13 = __pyx_v_h;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
                                  __pyx_v_j = __pyx_t_15;

     3276:

    +3277:                 index = 0

                                  __pyx_v_index = 0;

     3278:

    +3279:                 for kx in range(-k, k):

                                  __pyx_t_16 = __pyx_v_k;
                                  __pyx_t_17 = __pyx_t_16;
                                  for (__pyx_t_18 = (-__pyx_v_k); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                    __pyx_v_kx = __pyx_t_18;

    +3280:                     for ky in range(-k, k):

                                    __pyx_t_19 = __pyx_v_k;
                                    __pyx_t_20 = __pyx_t_19;
                                    for (__pyx_t_21 = (-__pyx_v_k); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                      __pyx_v_ky = __pyx_t_21;

     3281:

    +3282:                         ii = i + kx

                                      __pyx_v_ii = (__pyx_v_i + __pyx_v_kx);

    +3283:                         jj = j + ky

                                      __pyx_v_jj = (__pyx_v_j + __pyx_v_ky);

     3284:

    +3285:                         if ii < 0:

                                      __pyx_t_22 = ((__pyx_v_ii < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +3286:                             ii = 0

                                        __pyx_v_ii = 0;

    +3287:                         elif ii > w:

                                      __pyx_t_22 = ((__pyx_v_ii > __pyx_v_w) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L16:;

    +3288:                             ii = w

                                        __pyx_v_ii = __pyx_v_w;

     3289:

    +3290:                         if jj < 0:

                                      __pyx_t_22 = ((__pyx_v_jj < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +3291:                             jj = 0

                                        __pyx_v_jj = 0;

    +3292:                         elif jj > h:

                                      __pyx_t_22 = ((__pyx_v_jj > __pyx_v_h) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L17:;

    +3293:                             jj = h

                                        __pyx_v_jj = __pyx_v_h;

     3294:

    +3295:                         tmp_[index]   = rgb_array_copy[ii, jj, 0]

                                      __pyx_t_23 = __pyx_v_ii;
                                      __pyx_t_24 = __pyx_v_jj;
                                      __pyx_t_25 = 0;
                                      (__pyx_v_tmp_[__pyx_v_index]) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_23 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_25)) )));

     3296:

    +3297:                         index = index + 1

                                      __pyx_v_index = (__pyx_v_index + 1);
                                    }
                                  }

     3298:

    +3299:                 tmp = quickSort(tmp_, 0, k_size)

                                  __pyx_v_tmp = quickSort(__pyx_v_tmp_, 0, __pyx_v_k_size);

     3300:

    +3301:                 rgb_array_[i, j, 0] = tmp[k + 1]

                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_23 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);

    +3302:                 rgb_array_[i, j, 1] = tmp[k + 1]

                                  __pyx_t_23 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_25 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);

    +3303:                 rgb_array_[i, j, 2] = tmp[k + 1]

                                  __pyx_t_25 = __pyx_v_i;
                                  __pyx_t_24 = __pyx_v_j;
                                  __pyx_t_23 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_tmp[(__pyx_v_k + 1)]);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3304:

     3305:

     3306:

    +3307: cdef float ONE_255 = <float>1.0 / <float>255.0

      __pyx_v_12PygameShader_6shader_ONE_255 = (((float)1.0) / ((float)255.0));

     3308:

     3309: @cython.boundscheck(False)

     3310: @cython.wraparound(False)

     3311: @cython.nonecheck(False)

     3312: @cython.cdivision(True)

    +3313: cdef inline void shader_color_reduction24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, int __pyx_v_color_number) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_f;
      float __pyx_v_c1;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_color_reduction24_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     3314:         unsigned char [:, :, :] rgb_array, int color_number):

     3315:     """

     3316:     COLOR REDUCTION SHADER

     3317:

     3318:     Decrease the amount of colors in the display or texture.

     3319:     The method of color reduction is very simple: every color of the original picture is replaced

     3320:     by an appropriate color from the limited palette that is accessible.

     3321:

     3322:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3323:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array

     3324:      (library surfarray)

     3325:

     3326:     e.g:

     3327:     color_reduction(surface, 8)

     3328:

     3329:     :param rgb_array    : numpy.ndarray shape(w, h, 3) uint8 (unsigned char 0...255) containing the

     3330:     pygame display pixels format RGB

     3331:     :param color_number : integer; color number color_number^2

     3332:     :return             : void

     3333:     """

     3334:

     3335:

     3336:     cdef Py_ssize_t w, h

    +3337:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3338:

     3339:     # cdef float color_number = <float>pow(2, factor)

     3340:

     3341:     cdef:

    +3342:         int x=0, y=0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     3343:         unsigned char *r

     3344:         unsigned char *g

     3345:         unsigned char *b

    +3346:         float f = <float> 255.0 / <float> color_number

      __pyx_v_f = (((float)255.0) / ((float)__pyx_v_color_number));

    +3347:         float c1 = <float>color_number / <float>255.0

      __pyx_v_c1 = (((float)__pyx_v_color_number) / ((float)255.0));

     3348:

    +3349:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3350:         for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_x = ((int)0xbad0bad0);

    +3351:             for x in range(0, w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_x = __pyx_t_7;

     3352:

    +3353:                 r = &rgb_array[x, y, 0]

                                  __pyx_t_8 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +3354:                 g = &rgb_array[x, y, 1]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +3355:                 b = &rgb_array[x, y, 2]

                                  __pyx_t_8 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

     3356:

    +3357:                 r[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>r[0]) * f))

                                  (__pyx_v_r[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_r[0]))))) * __pyx_v_f)));

    +3358:                 g[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>g[0]) * f))

                                  (__pyx_v_g[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_g[0]))))) * __pyx_v_f)));

    +3359:                 b[0] = <unsigned char>(<int>(<float>round_c(c1 * <float>b[0]) * f))

                                  (__pyx_v_b[0]) = ((unsigned char)((int)(((float)round((__pyx_v_c1 * ((float)(__pyx_v_b[0]))))) * __pyx_v_f)));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3360:

     3361:

     3362:

     3363: cdef:

    +3364:     short [:, ::1] GY = numpy.array(

      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_numpy); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_array_2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
    /* … */
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_30, __pyx_t_31); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;

    +3365:         ([-1, 0, 1],

      __pyx_t_33 = PyList_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_1);
    /* … */
      __pyx_t_31 = PyTuple_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_32);
      PyTuple_SET_ITEM(__pyx_t_31, 1, __pyx_t_32);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_31, 2, __pyx_t_2);
      __pyx_t_33 = 0;
      __pyx_t_32 = 0;
      __pyx_t_2 = 0;

    +3366:          [-2, 0, 2],

      __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_INCREF(__pyx_int_neg_2);
      __Pyx_GIVEREF(__pyx_int_neg_2);
      PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_neg_2);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_2);

    +3367:          [-1, 0, 1])).astype(dtype=int16, order='C')

      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
    /* … */
      __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_int16); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_30) < 0) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 3367, __pyx_L1_error)
      __pyx_t_30 = __Pyx_PyObject_Call(__pyx_t_31, __pyx_empty_tuple, __pyx_t_2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_35 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__pyx_t_30, PyBUF_WRITABLE); if (unlikely(!__pyx_t_35.memview)) __PYX_ERR(1, 3367, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_GY, 1);
      __pyx_v_12PygameShader_6shader_GY = __pyx_t_35;
      __pyx_t_35.memview = NULL;
      __pyx_t_35.data = NULL;

     3368:

    +3369:     short [:, ::1] GX = numpy.array(

      __Pyx_GetModuleGlobalName(__pyx_t_30, __pyx_n_s_numpy); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
    /* … */
      __pyx_t_32 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_33); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3369, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;

    +3370:         ([-1, -2, -1],

      __pyx_t_30 = PyList_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 3370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_2);
      __Pyx_GIVEREF(__pyx_int_neg_2);
      PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_neg_2);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_neg_1);
    /* … */
      __pyx_t_33 = PyTuple_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_30);
      PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_31);
      PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_32);
      PyTuple_SET_ITEM(__pyx_t_33, 2, __pyx_t_32);
      __pyx_t_30 = 0;
      __pyx_t_31 = 0;
      __pyx_t_32 = 0;

    +3371:          [0,   0,  0],

      __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 3371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_0);

    +3372:          [1,   2,  1])).astype(dtype=int16, order='c')

      __pyx_t_32 = PyList_New(3); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_2);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_1);
    /* … */
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_32, __pyx_n_s_astype); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __pyx_t_32 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_int16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_32, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_32, __pyx_n_s_order, __pyx_n_s_c_2) < 0) __PYX_ERR(1, 3372, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_empty_tuple, __pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __pyx_t_35 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_short(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_35.memview)) __PYX_ERR(1, 3372, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_GX, 1);
      __pyx_v_12PygameShader_6shader_GX = __pyx_t_35;
      __pyx_t_35.memview = NULL;
      __pyx_t_35.data = NULL;

     3373:

    +3374:     unsigned short int KERNEL_HALF = 1

      __pyx_v_12PygameShader_6shader_KERNEL_HALF = 1;

     3375:

     3376:

     3377: @cython.boundscheck(False)

     3378: @cython.wraparound(False)

     3379: @cython.nonecheck(False)

     3380: @cython.cdivision(True)

    +3381: cdef inline void shader_sobel24_inplace_c(unsigned char [:, :, :] rgb_array, float threshold=20.0):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c *__pyx_optional_args) {
      float __pyx_v_threshold = ((float)20.0);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      Py_ssize_t __pyx_v_w_1;
      Py_ssize_t __pyx_v_h_1;
      int __pyx_v_kernel_offset_x;
      int __pyx_v_kernel_offset_y;
      __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      Py_ssize_t __pyx_v_xx;
      Py_ssize_t __pyx_v_yy;
      float __pyx_v_r_gx;
      float __pyx_v_r_gy;
      unsigned char *__pyx_v_gray;
      unsigned char __pyx_v_m;
      float __pyx_v_magnitude;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_sobel24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold = __pyx_optional_args->threshold;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_sobel24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_inplace_c {
      int __pyx_n;
      float threshold;
    };

     3382:     """

     3383:     SHADER SOBEL (EDGE DETECTION)

     3384:

     3385:     Transform the game display or a pygame surface into a sobel equivalent model

     3386:     (surface edge detection)

     3387:

     3388:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3389:     please refer to pygame function pixels3d or array3d to convert an image into a 3d

     3390:     array (library surfarray)

     3391:

     3392:     e.g:

     3393:     sobel(surface, 64)

     3394:

     3395:     :param rgb_array    : numpy.ndarray shape (w, h, 3) containing RGB values

     3396:     :param threshold    : float; Threshold value (Default value = 20.0)

     3397:     :return             : void

     3398:     """

     3399:

     3400:     cdef Py_ssize_t w, h

    +3401:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3402:

     3403:     cdef:

    +3404:         Py_ssize_t w_1 = w - 1

      __pyx_v_w_1 = (__pyx_v_w - 1);

    +3405:         Py_ssize_t h_1 = h - 1

      __pyx_v_h_1 = (__pyx_v_h - 1);

     3406:         int kernel_offset_x, kernel_offset_y

    +3407:         unsigned char [:, :, :] source_array = numpy.array(rgb_array, copy=True)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3407, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3407, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_source_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     3408:         int x, y

     3409:         Py_ssize_t xx, yy

     3410:         float r_gx, r_gy

     3411:         unsigned char *gray

     3412:         unsigned char m

     3413:         float magnitude

     3414:

    +3415:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L4_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L5:;
          }
      }

     3416:

    +3417:         for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_gray = ((unsigned char *)1);
                                __pyx_v_kernel_offset_x = ((int)0xbad0bad0);
                                __pyx_v_kernel_offset_y = ((int)0xbad0bad0);
                                __pyx_v_m = ((unsigned char)'?');
                                __pyx_v_magnitude = ((float)__PYX_NAN());
                                __pyx_v_r_gx = ((float)__PYX_NAN());
                                __pyx_v_r_gy = ((float)__PYX_NAN());
                                __pyx_v_x = ((int)0xbad0bad0);
                                __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

     3418:

    +3419:             for x in range(w):

                                __pyx_t_10 = __pyx_v_w;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_x = __pyx_t_12;

     3420:

    +3421:                 r_gx, r_gy = <float>0.0, <float>0.0

                                  __pyx_t_13 = ((float)0.0);
                                  __pyx_t_14 = ((float)0.0);
                                  __pyx_v_r_gx = __pyx_t_13;
                                  __pyx_v_r_gy = __pyx_t_14;

     3422:

    +3423:                 for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):

                                  __pyx_t_15 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                  __pyx_t_16 = __pyx_t_15;
                                  for (__pyx_t_17 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
                                    __pyx_v_kernel_offset_x = __pyx_t_17;

     3424:

    +3425:                     for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):

                                    __pyx_t_18 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                    __pyx_t_19 = __pyx_t_18;
                                    for (__pyx_t_20 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                      __pyx_v_kernel_offset_y = __pyx_t_20;

     3426:

    +3427:                         xx = x + kernel_offset_x

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

    +3428:                         yy = y + kernel_offset_y

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

     3429:

    +3430:                         if xx > w_1:

                                      __pyx_t_21 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }

    +3431:                             xx = w_1

                                        __pyx_v_xx = __pyx_v_w_1;

    +3432:                         if xx < 0:

                                      __pyx_t_21 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }

    +3433:                             xx = 0

                                        __pyx_v_xx = 0;

     3434:

    +3435:                         if yy > h_1:

                                      __pyx_t_21 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }

    +3436:                             yy = h_1

                                        __pyx_v_yy = __pyx_v_h_1;

    +3437:                         if yy < 0:

                                      __pyx_t_21 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }

    +3438:                             yy = 0

                                        __pyx_v_yy = 0;

     3439:

     3440:                         # grayscale image red = green = blue

    +3441:                         gray = &source_array[xx, yy, 0]

                                      __pyx_t_22 = __pyx_v_xx;
                                      __pyx_t_23 = __pyx_v_yy;
                                      __pyx_t_24 = 0;
                                      __pyx_v_gray = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_22 * __pyx_v_source_array.strides[0]) ) + __pyx_t_23 * __pyx_v_source_array.strides[1]) ) + __pyx_t_24 * __pyx_v_source_array.strides[2]) ))));

     3442:

    +3443:                         if kernel_offset_x != 0:

                                      __pyx_t_21 = ((__pyx_v_kernel_offset_x != 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }

     3444:

    +3445:                             r_gx = r_gx + <float> gray[0] * \

                                        __pyx_v_r_gx = (__pyx_v_r_gx + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GX.data + __pyx_t_24 * __pyx_v_12PygameShader_6shader_GX.strides[0]) )) + __pyx_t_23)) ))))));

    +3446:                                    <float> GX[kernel_offset_x + KERNEL_HALF,

                                        if (unlikely(!__pyx_v_12PygameShader_6shader_GX.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GX"); __PYX_ERR(1, 3446, __pyx_L8_error) }
    /* … */
                                        __pyx_t_24 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                        __pyx_t_23 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

     3447:                                               kernel_offset_y + KERNEL_HALF]

     3448:

    +3449:                         if kernel_offset_y != 0:

                                      __pyx_t_21 = ((__pyx_v_kernel_offset_y != 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }
                                    }
                                  }

     3450:

    +3451:                             r_gy = r_gy + <float> gray[0] * \

                                        __pyx_v_r_gy = (__pyx_v_r_gy + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GY.data + __pyx_t_23 * __pyx_v_12PygameShader_6shader_GY.strides[0]) )) + __pyx_t_24)) ))))));

    +3452:                                    <float> GY[kernel_offset_x + KERNEL_HALF,

                                        if (unlikely(!__pyx_v_12PygameShader_6shader_GY.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GY"); __PYX_ERR(1, 3452, __pyx_L8_error) }
    /* … */
                                        __pyx_t_23 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                        __pyx_t_24 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

     3453:                                               kernel_offset_y + KERNEL_HALF]

     3454:

    +3455:                 magnitude = min(<float> sqrt(r_gx * r_gx + r_gy * r_gy), <float>255.0)

                                  __pyx_t_14 = ((float)255.0);
                                  __pyx_t_13 = ((float)sqrt(((__pyx_v_r_gx * __pyx_v_r_gx) + (__pyx_v_r_gy * __pyx_v_r_gy))));
                                  if (((__pyx_t_14 < __pyx_t_13) != 0)) {
                                    __pyx_t_25 = __pyx_t_14;
                                  } else {
                                    __pyx_t_25 = __pyx_t_13;
                                  }
                                  __pyx_v_magnitude = __pyx_t_25;

     3456:

     3457:                 # if magnitude > 255:

     3458:                 #     magnitude = 255.0

     3459:

    +3460:                 m = <unsigned char> magnitude if magnitude > threshold else 0

                                  if (((__pyx_v_magnitude > __pyx_v_threshold) != 0)) {
                                    __pyx_t_26 = ((unsigned char)__pyx_v_magnitude);
                                  } else {
                                    __pyx_t_26 = 0;
                                  }
                                  __pyx_v_m = __pyx_t_26;

     3461:

     3462:                 # update the pixel if the magnitude is above threshold else black pixel

    +3463:                 rgb_array[x, y, 0] = m

                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_22 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_24 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;

    +3464:                 rgb_array[x, y, 1] = m

                                  __pyx_t_22 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_24 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_22 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;

    +3465:                 rgb_array[x, y, 2] = m

                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_22 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_24 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[2]) )) = __pyx_v_m;
                                }
                                goto __pyx_L23;
                                __pyx_L8_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L22;
                                __pyx_L22:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates0)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_gray;
                                    __pyx_parallel_temp1 = __pyx_v_kernel_offset_x;
                                    __pyx_parallel_temp2 = __pyx_v_kernel_offset_y;
                                    __pyx_parallel_temp3 = __pyx_v_m;
                                    __pyx_parallel_temp4 = __pyx_v_magnitude;
                                    __pyx_parallel_temp5 = __pyx_v_r_gx;
                                    __pyx_parallel_temp6 = __pyx_v_r_gy;
                                    __pyx_parallel_temp7 = __pyx_v_x;
                                    __pyx_parallel_temp8 = __pyx_v_xx;
                                    __pyx_parallel_temp9 = __pyx_v_y;
                                    __pyx_parallel_temp10 = __pyx_v_yy;
                                }
                                __pyx_L23:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_gray = __pyx_parallel_temp0;
                  __pyx_v_kernel_offset_x = __pyx_parallel_temp1;
                  __pyx_v_kernel_offset_y = __pyx_parallel_temp2;
                  __pyx_v_m = __pyx_parallel_temp3;
                  __pyx_v_magnitude = __pyx_parallel_temp4;
                  __pyx_v_r_gx = __pyx_parallel_temp5;
                  __pyx_v_r_gy = __pyx_parallel_temp6;
                  __pyx_v_x = __pyx_parallel_temp7;
                  __pyx_v_xx = __pyx_parallel_temp8;
                  __pyx_v_y = __pyx_parallel_temp9;
                  __pyx_v_yy = __pyx_parallel_temp10;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L4_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3466:

     3467:

     3468:

     3469: @cython.boundscheck(False)

     3470: @cython.wraparound(False)

     3471: @cython.nonecheck(False)

     3472: @cython.cdivision(True)

    +3473: cdef unsigned char [:, :, ::1] scale_array24_c(

    static __Pyx_memviewslice __pyx_f_12PygameShader_6shader_scale_array24_c(__Pyx_memviewslice __pyx_v_rgb_array, int __pyx_v_w2, int __pyx_v_h2) {
      Py_ssize_t __pyx_v_w1;
      Py_ssize_t __pyx_v_h1;
      CYTHON_UNUSED Py_ssize_t __pyx_v_s;
      CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
      __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_fx;
      float __pyx_v_fy;
      int __pyx_v_x;
      int __pyx_v_y;
      Py_ssize_t __pyx_v_xx;
      Py_ssize_t __pyx_v_yy;
      __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("scale_array24_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_14);
      __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
      __pyx_r.data = NULL;
      __pyx_r.memview = NULL;
      __Pyx_AddTraceback("PygameShader.shader.scale_array24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      goto __pyx_L2;
      __pyx_L0:;
      if (unlikely(!__pyx_r.memview)) {
        PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
      }
      __pyx_L2:;
      __Pyx_XDECREF(__pyx_v_e);
      __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     3474:         unsigned char [:, :, :]

     3475:         rgb_array,

     3476:         int w2,

     3477:         int h2

     3478: ):

     3479:     """

     3480:     ARRAY RE-SCALING ; ARRAY SHAPE (W, H, 3)

     3481:

     3482:     This is an internal tool that cannot be access outside of this library (cpdef hook missing)

     3483:     Re-scale an array (rgb_array) of size (w, h, 3) into an equivalent array size (w2, h2, 3).

     3484:     This function is identical to a surface rescaling but uses the array instead

     3485:

     3486:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3487:      please refer to pygame function pixels3d or array3d to convert an image into a 3d

     3488:       array (library surfarray)

     3489:

     3490:     e.g:

     3491:     memview_array = scale_array24_c(my_array, 300, 300)

     3492:

     3493:     :param rgb_array    : RGB numpy.ndarray, format (w, h, 3) numpy.uint8

     3494:     :param w2           : new width

     3495:     :param h2           : new height

     3496:     :return             : Return a MemoryViewSlice 3d numpy.ndarray format (w, h, 3) uint8

     3497:     """

    +3498:     assert w2 > 0, "Argument w2 cannot be <=0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_w2 > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w2_cannot_be_0);
          __PYX_ERR(1, 3498, __pyx_L1_error)
        }
      }
      #endif

    +3499:     assert h2 > 0, "Argument h2 cannot be <=0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_h2 > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h2_cannot_be_0);
          __PYX_ERR(1, 3499, __pyx_L1_error)
        }
      }
      #endif

     3500:

     3501:     cdef Py_ssize_t w1, h1, s

     3502:

    +3503:     try:

      {
        /*try:*/ {
    /* … */
        }
      }

    +3504:         w1, h1, s = rgb_array.shape[:3]

          __pyx_t_4 = __pyx_v_rgb_array.shape;
          __pyx_t_5 = (__pyx_t_4[0]);
          __pyx_t_6 = (__pyx_t_4[1]);
          __pyx_t_7 = (__pyx_t_4[2]);
          __pyx_v_w1 = __pyx_t_5;
          __pyx_v_h1 = __pyx_t_6;
          __pyx_v_s = __pyx_t_7;

     3505:

     3506:     except (ValueError, pygame.error) as e:

     3507:         raise ValueError('\nArray shape not understood.')

     3508:

     3509:     cdef:

    +3510:         unsigned char [:, :, ::1] new_array = numpy.zeros((w2, h2, 3), numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_numpy); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_w2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_h2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyTuple_New(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_11);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_int_3);
      __pyx_t_9 = 0;
      __pyx_t_11 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_numpy); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_uint8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      __pyx_t_13 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_13 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_12, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_13, 2+__pyx_t_13); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 3510, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_9);
        __pyx_t_12 = 0;
        __pyx_t_9 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 3510, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 3510, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_new_array = __pyx_t_15;
      __pyx_t_15.memview = NULL;
      __pyx_t_15.data = NULL;

    +3511:         float fx = <float>w1 / <float>w2

      __pyx_v_fx = (((float)__pyx_v_w1) / ((float)__pyx_v_w2));

    +3512:         float fy = <float>h1 / <float>h2

      __pyx_v_fy = (((float)__pyx_v_h1) / ((float)__pyx_v_h2));

     3513:         int x, y

     3514:         Py_ssize_t xx, yy

    +3515:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L11;
            }
            __pyx_L11:;
          }
      }

    +3516:         for x in prange(w2, schedule='static', num_threads=THREADS):

            __pyx_t_13 = __pyx_v_w2;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_17 = (__pyx_t_13 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_17 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_13 = __pyx_v_w2;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_17 = (__pyx_t_13 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_17 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_17; __pyx_t_16++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_16);
                                /* Initialize private variables to invalid values */
                                __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

    +3517:             xx = <int>(x * fx)

                                __pyx_v_xx = ((int)(__pyx_v_x * __pyx_v_fx));

    +3518:             for y in range(h2):

                                __pyx_t_18 = __pyx_v_h2;
                                __pyx_t_19 = __pyx_t_18;
                                for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                  __pyx_v_y = __pyx_t_20;

    +3519:                 yy = <int>(y * fy)

                                  __pyx_v_yy = ((int)(__pyx_v_y * __pyx_v_fy));

    +3520:                 new_array[x, y, 0] = rgb_array[xx, yy, 0]

                                  __pyx_t_21 = __pyx_v_xx;
                                  __pyx_t_22 = __pyx_v_yy;
                                  __pyx_t_23 = 0;
                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_25 = __pyx_v_y;
                                  __pyx_t_26 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_24 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_26)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_21 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[2]) )));

    +3521:                 new_array[x, y, 1] = rgb_array[xx, yy, 1]

                                  __pyx_t_23 = __pyx_v_xx;
                                  __pyx_t_22 = __pyx_v_yy;
                                  __pyx_t_21 = 1;
                                  __pyx_t_26 = __pyx_v_x;
                                  __pyx_t_25 = __pyx_v_y;
                                  __pyx_t_24 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_26 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_24)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_23 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_21 * __pyx_v_rgb_array.strides[2]) )));

    +3522:                 new_array[x, y, 2] = rgb_array[xx, yy, 2]

                                  __pyx_t_21 = __pyx_v_xx;
                                  __pyx_t_22 = __pyx_v_yy;
                                  __pyx_t_23 = 2;
                                  __pyx_t_24 = __pyx_v_x;
                                  __pyx_t_25 = __pyx_v_y;
                                  __pyx_t_26 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_24 * __pyx_v_new_array.strides[0]) ) + __pyx_t_25 * __pyx_v_new_array.strides[1]) )) + __pyx_t_26)) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_21 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_22 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3523:

    +3524:     return new_array

      __PYX_INC_MEMVIEW(&__pyx_v_new_array, 0);
      __pyx_r = __pyx_v_new_array;
      goto __pyx_L0;

     3525:

     3526:

     3527: @cython.boundscheck(False)

     3528: @cython.wraparound(False)

     3529: @cython.nonecheck(False)

     3530: @cython.cdivision(True)

    +3531: cdef inline void shader_sobel24_fast_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sobel24_fast_inplace_c(PyObject *__pyx_v_surface_, struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c *__pyx_optional_args) {
      int __pyx_v_threshold_ = ((int)20);
      unsigned short __pyx_v_factor_ = ((unsigned short)1);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      Py_ssize_t __pyx_v_w_1;
      Py_ssize_t __pyx_v_h_1;
      int __pyx_v_kernel_offset_x;
      int __pyx_v_kernel_offset_y;
      int __pyx_v_x;
      int __pyx_v_y;
      Py_ssize_t __pyx_v_xx;
      Py_ssize_t __pyx_v_yy;
      float __pyx_v_r_gx;
      float __pyx_v_r_gy;
      unsigned char *__pyx_v_gray;
      unsigned char __pyx_v_m;
      float __pyx_v_magnitude;
      __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_rescale_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_new_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_sobel24_fast_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold_ = __pyx_optional_args->threshold_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_factor_ = __pyx_optional_args->factor_;
          }
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_sobel24_fast_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_rescale_array, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_new_, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_sobel24_fast_inplace_c {
      int __pyx_n;
      int threshold_;
      unsigned short factor_;
    };

     3532:         surface_, int threshold_=20, unsigned short factor_=1):

     3533:     """

     3534:     SHADER FAST SOBEL (EDGE DETECTION)

     3535:

     3536:     Transform the game display or a pygame surface into a sobel equivalent model

     3537:     (surface edge detection).This version is slightly fastest than shader_sobel24_inplace_c as

     3538:     it down-scale the array containing all the pixels and apply the sobel algorithm to a smaller

     3539:     sample. When the processing is done, the array is re-scale to its original dimensions.

     3540:     If this method is in theory faster than shader_sobel24_inplace_c, down-scaling and up-scaling

     3541:     an array does have a side effect of decreasing the overall image definition

     3542:     (jagged lines non-antialiasing)

     3543:

     3544:     e.g:

     3545:     sobel_fast(surface, 64, factor_=1)

     3546:

     3547:     :param surface_     :  pygame.Surface

     3548:     :param threshold_   : integer; threshold value for the sobel filter

     3549:     :param factor_      : unsigned short (default value =1). Define the

     3550:     reduction factor of an image. 1 divide by 2, 2 divide by 4 etc

     3551:     :return             : void

     3552:     """

     3553:

     3554:     cdef:

     3555:         Py_ssize_t w, h, w_1, h_1

    +3556:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 3556, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 3556, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 3556, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 3556, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 3556, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     3557:

     3558:     cdef:

     3559:         int kernel_offset_x, kernel_offset_y

     3560:         int x, y

     3561:         Py_ssize_t xx, yy

     3562:         float r_gx, r_gy

     3563:         unsigned char *gray

     3564:         unsigned char m

     3565:         float magnitude

     3566:

    +3567:         unsigned char [:, :, :] source_array = pixels3d(surface_)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_source_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     3568:         unsigned char [:, :, :] rescale_array = \

    +3569:             numpy.array(pixels3d(scale(surface_, (w >> factor_, h >> factor_))))

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_scale); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyInt_FromSsize_t((__pyx_v_w >> __pyx_v_factor_)); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyInt_FromSsize_t((__pyx_v_h >> __pyx_v_factor_)); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
      __pyx_t_11 = 0;
      __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_surface_, __pyx_t_13};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_surface_, __pyx_t_13};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 3569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface_);
        __Pyx_GIVEREF(__pyx_v_surface_);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_14, __pyx_v_surface_);
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_14, __pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3569, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rescale_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +3570:         unsigned char [:, :, :] new_array = empty((w >> factor_, h >> factor_, 3), uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_w >> __pyx_v_factor_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_h >> __pyx_v_factor_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_9, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 3570, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_14, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_14, __pyx_t_4);
        __pyx_t_9 = 0;
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 3570, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3570, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_new_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     3571:

    +3572:     h = h >> factor_

      __pyx_v_h = (__pyx_v_h >> __pyx_v_factor_);

    +3573:     w = w >> factor_

      __pyx_v_w = (__pyx_v_w >> __pyx_v_factor_);

    +3574:     w_1 = w - 1

      __pyx_v_w_1 = (__pyx_v_w - 1);

    +3575:     h_1 = h - 1

      __pyx_v_h_1 = (__pyx_v_h - 1);

     3576:

    +3577:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L6_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L7:;
          }
      }

     3578:

    +3579:         for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_7 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_15 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_15 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_7 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_15 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_15 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_gray) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_m) lastprivate(__pyx_v_magnitude) lastprivate(__pyx_v_r_gx) lastprivate(__pyx_v_r_gy) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_15; __pyx_t_6++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_gray = ((unsigned char *)1);
                                __pyx_v_kernel_offset_x = ((int)0xbad0bad0);
                                __pyx_v_kernel_offset_y = ((int)0xbad0bad0);
                                __pyx_v_m = ((unsigned char)'?');
                                __pyx_v_magnitude = ((float)__PYX_NAN());
                                __pyx_v_r_gx = ((float)__PYX_NAN());
                                __pyx_v_r_gy = ((float)__PYX_NAN());
                                __pyx_v_x = ((int)0xbad0bad0);
                                __pyx_v_xx = ((Py_ssize_t)0xbad0bad0);
                                __pyx_v_yy = ((Py_ssize_t)0xbad0bad0);

     3580:

    +3581:             for x in range(w):

                                __pyx_t_16 = __pyx_v_w;
                                __pyx_t_17 = __pyx_t_16;
                                for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_17; __pyx_t_14+=1) {
                                  __pyx_v_x = __pyx_t_14;

     3582:

    +3583:                 r_gx, r_gy = <float>0.0, <float>0.0

                                  __pyx_t_18 = ((float)0.0);
                                  __pyx_t_19 = ((float)0.0);
                                  __pyx_v_r_gx = __pyx_t_18;
                                  __pyx_v_r_gy = __pyx_t_19;

     3584:

    +3585:                 for kernel_offset_y in range(-KERNEL_HALF, KERNEL_HALF + 1):

                                  __pyx_t_20 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                  __pyx_t_21 = __pyx_t_20;
                                  for (__pyx_t_22 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                    __pyx_v_kernel_offset_y = __pyx_t_22;

     3586:

    +3587:                     for kernel_offset_x in range(-KERNEL_HALF, KERNEL_HALF + 1):

                                    __pyx_t_23 = (__pyx_v_12PygameShader_6shader_KERNEL_HALF + 1);
                                    __pyx_t_24 = __pyx_t_23;
                                    for (__pyx_t_25 = (-__pyx_v_12PygameShader_6shader_KERNEL_HALF); __pyx_t_25 < __pyx_t_24; __pyx_t_25+=1) {
                                      __pyx_v_kernel_offset_x = __pyx_t_25;

     3588:

    +3589:                         xx = x + kernel_offset_x

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

    +3590:                         yy = y + kernel_offset_y

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

     3591:

    +3592:                         if xx > w_1:

                                      __pyx_t_26 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }

    +3593:                             xx = w_1

                                        __pyx_v_xx = __pyx_v_w_1;

    +3594:                         if xx < 0:

                                      __pyx_t_26 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }

    +3595:                             xx = 0

                                        __pyx_v_xx = 0;

     3596:

    +3597:                         if yy > h_1:

                                      __pyx_t_26 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }

    +3598:                             yy = h_1

                                        __pyx_v_yy = __pyx_v_h_1;

    +3599:                         if yy < 0:

                                      __pyx_t_26 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }

    +3600:                             yy = 0

                                        __pyx_v_yy = 0;

     3601:

     3602:                         # grayscale image red = green = blue

    +3603:                         gray = &rescale_array[xx, yy, 0]

                                      __pyx_t_27 = __pyx_v_xx;
                                      __pyx_t_28 = __pyx_v_yy;
                                      __pyx_t_29 = 0;
                                      __pyx_v_gray = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rescale_array.data + __pyx_t_27 * __pyx_v_rescale_array.strides[0]) ) + __pyx_t_28 * __pyx_v_rescale_array.strides[1]) ) + __pyx_t_29 * __pyx_v_rescale_array.strides[2]) ))));

     3604:

    +3605:                         if kernel_offset_x != 0:

                                      __pyx_t_26 = ((__pyx_v_kernel_offset_x != 0) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }

     3606:

    +3607:                             r_gx = r_gx + <float> gray[0] * \

                                        __pyx_v_r_gx = (__pyx_v_r_gx + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GX.data + __pyx_t_29 * __pyx_v_12PygameShader_6shader_GX.strides[0]) )) + __pyx_t_28)) ))))));

    +3608:                                    <float> GX[kernel_offset_x + KERNEL_HALF,

                                        if (unlikely(!__pyx_v_12PygameShader_6shader_GX.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GX"); __PYX_ERR(1, 3608, __pyx_L10_error) }
    /* … */
                                        __pyx_t_29 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                        __pyx_t_28 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

     3609:                                               kernel_offset_y + KERNEL_HALF]

     3610:

    +3611:                         if kernel_offset_y != 0:

                                      __pyx_t_26 = ((__pyx_v_kernel_offset_y != 0) != 0);
                                      if (__pyx_t_26) {
    /* … */
                                      }
                                    }
                                  }

     3612:

    +3613:                             r_gy = r_gy + <float> gray[0] * \

                                        __pyx_v_r_gy = (__pyx_v_r_gy + (((float)(__pyx_v_gray[0])) * ((float)(*((short *) ( /* dim=1 */ ((char *) (((short *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_GY.data + __pyx_t_28 * __pyx_v_12PygameShader_6shader_GY.strides[0]) )) + __pyx_t_29)) ))))));

    +3614:                                    <float> GY[kernel_offset_x + KERNEL_HALF,

                                        if (unlikely(!__pyx_v_12PygameShader_6shader_GY.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("GY"); __PYX_ERR(1, 3614, __pyx_L10_error) }
    /* … */
                                        __pyx_t_28 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_KERNEL_HALF);
                                        __pyx_t_29 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_KERNEL_HALF);

     3615:                                               kernel_offset_y + KERNEL_HALF]

     3616:

    +3617:                 magnitude = <float> sqrt(r_gx * r_gx + r_gy * r_gy)

                                  __pyx_v_magnitude = ((float)sqrt(((__pyx_v_r_gx * __pyx_v_r_gx) + (__pyx_v_r_gy * __pyx_v_r_gy))));

     3618:

    +3619:                 if magnitude > 255:

                                  __pyx_t_26 = ((__pyx_v_magnitude > 255.0) != 0);
                                  if (__pyx_t_26) {
    /* … */
                                  }

    +3620:                     magnitude = <float>255.0

                                    __pyx_v_magnitude = ((float)255.0);

     3621:

    +3622:                 m = <unsigned char> magnitude if magnitude > threshold_ else 0

                                  if (((__pyx_v_magnitude > __pyx_v_threshold_) != 0)) {
                                    __pyx_t_30 = ((unsigned char)__pyx_v_magnitude);
                                  } else {
                                    __pyx_t_30 = 0;
                                  }
                                  __pyx_v_m = __pyx_t_30;

     3623:

     3624:                 # update the pixel if the magnitude is above threshold else black pixel

    +3625:                 new_array[x, y, 0] = m

                                  __pyx_t_29 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_27 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_29 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_27 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;

    +3626:                 new_array[x, y, 1] = m

                                  __pyx_t_27 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_29 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_27 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_29 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;

    +3627:                 new_array[x, y, 2] = m

                                  __pyx_t_29 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_27 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_29 * __pyx_v_new_array.strides[0]) ) + __pyx_t_28 * __pyx_v_new_array.strides[1]) ) + __pyx_t_27 * __pyx_v_new_array.strides[2]) )) = __pyx_v_m;
                                }
                                goto __pyx_L26;
                                __pyx_L10_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L25;
                                __pyx_L25:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates1)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_gray;
                                    __pyx_parallel_temp1 = __pyx_v_kernel_offset_x;
                                    __pyx_parallel_temp2 = __pyx_v_kernel_offset_y;
                                    __pyx_parallel_temp3 = __pyx_v_m;
                                    __pyx_parallel_temp4 = __pyx_v_magnitude;
                                    __pyx_parallel_temp5 = __pyx_v_r_gx;
                                    __pyx_parallel_temp6 = __pyx_v_r_gy;
                                    __pyx_parallel_temp7 = __pyx_v_x;
                                    __pyx_parallel_temp8 = __pyx_v_xx;
                                    __pyx_parallel_temp9 = __pyx_v_y;
                                    __pyx_parallel_temp10 = __pyx_v_yy;
                                }
                                __pyx_L26:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_gray = __pyx_parallel_temp0;
                  __pyx_v_kernel_offset_x = __pyx_parallel_temp1;
                  __pyx_v_kernel_offset_y = __pyx_parallel_temp2;
                  __pyx_v_m = __pyx_parallel_temp3;
                  __pyx_v_magnitude = __pyx_parallel_temp4;
                  __pyx_v_r_gx = __pyx_parallel_temp5;
                  __pyx_v_r_gy = __pyx_parallel_temp6;
                  __pyx_v_x = __pyx_parallel_temp7;
                  __pyx_v_xx = __pyx_parallel_temp8;
                  __pyx_v_y = __pyx_parallel_temp9;
                  __pyx_v_yy = __pyx_parallel_temp10;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L6_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3628:

    +3629:     w = w << factor_

      __pyx_v_w = (__pyx_v_w << __pyx_v_factor_);

    +3630:     h = h << factor_

      __pyx_v_h = (__pyx_v_h << __pyx_v_factor_);

     3631:

    +3632:     cdef unsigned char [:, :, :] new_ = scale_array24_c(new_array, w, h)

      __pyx_t_31 = __pyx_f_12PygameShader_6shader_scale_array24_c(__pyx_v_new_array, __pyx_v_w, __pyx_v_h); if (unlikely(!__pyx_t_31.memview)) __PYX_ERR(1, 3632, __pyx_L1_error)
      __pyx_v_new_ = __pyx_t_31;
      __pyx_t_31.memview = NULL;
      __pyx_t_31.data = NULL;

     3633:

    +3634:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L29;
            }
            __pyx_L29:;
          }
      }

     3635:

    +3636:         for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_15 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_7 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_7 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_15 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_7 = (__pyx_t_15 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_7 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_7; __pyx_t_6++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_x = ((int)0xbad0bad0);

    +3637:             for x in range(w):

                                __pyx_t_16 = __pyx_v_w;
                                __pyx_t_17 = __pyx_t_16;
                                for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_17; __pyx_t_14+=1) {
                                  __pyx_v_x = __pyx_t_14;

     3638:

    +3639:                 source_array[x, y, 0] = new_[x, y, 0]

                                  __pyx_t_27 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_29 = 0;
                                  __pyx_t_32 = __pyx_v_x;
                                  __pyx_t_33 = __pyx_v_y;
                                  __pyx_t_34 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_32 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_34 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_27 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_29 * __pyx_v_new_.strides[2]) )));

    +3640:                 source_array[x, y, 1] = new_[x, y, 1]

                                  __pyx_t_29 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_27 = 1;
                                  __pyx_t_34 = __pyx_v_x;
                                  __pyx_t_33 = __pyx_v_y;
                                  __pyx_t_32 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_34 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_32 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_29 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_27 * __pyx_v_new_.strides[2]) )));

    +3641:                 source_array[x, y, 2] = new_[x, y, 2]

                                  __pyx_t_27 = __pyx_v_x;
                                  __pyx_t_28 = __pyx_v_y;
                                  __pyx_t_29 = 2;
                                  __pyx_t_32 = __pyx_v_x;
                                  __pyx_t_33 = __pyx_v_y;
                                  __pyx_t_34 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_32 * __pyx_v_source_array.strides[0]) ) + __pyx_t_33 * __pyx_v_source_array.strides[1]) ) + __pyx_t_34 * __pyx_v_source_array.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_.data + __pyx_t_27 * __pyx_v_new_.strides[0]) ) + __pyx_t_28 * __pyx_v_new_.strides[1]) ) + __pyx_t_29 * __pyx_v_new_.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3642:

     3643:

     3644: @cython.boundscheck(False)

     3645: @cython.wraparound(False)

     3646: @cython.nonecheck(False)

     3647: @cython.cdivision(True)

    +3648: cdef inline void shader_invert_surface_24bit_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_invert_surface_24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_invert_surface_24bit_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     3649:         unsigned char [:, :, :] rgb_array):

     3650:

     3651:     """

     3652:     SHADER INVERT PIXELS

     3653:

     3654:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3655:      please refer to pygame function pixels3d or array3d to convert an image into a 3d

     3656:      array (library surfarray)

     3657:

     3658:     Invert all pixels of the display or a given texture

     3659:     e.g:

     3660:     invert(surface)

     3661:

     3662:     :param rgb_array    : numpy.ndarray containing all the RGB color values. Array shape (w, h, 3)

     3663:     :return             : void

     3664:     """

     3665:

     3666:     cdef Py_ssize_t w, h

    +3667:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3668:

     3669:     cdef:

    +3670:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     3671:         unsigned char *r

     3672:         unsigned char *g

     3673:         unsigned char *b

     3674:

    +3675:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3676:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);

    +3677:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

    +3678:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +3679:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +3680:                 b = &rgb_array[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +3681:                 r[0] = 255 - r[0]

                                  (__pyx_v_r[0]) = (0xFF - (__pyx_v_r[0]));

    +3682:                 g[0] = 255 - g[0]

                                  (__pyx_v_g[0]) = (0xFF - (__pyx_v_g[0]));

    +3683:                 b[0] = 255 - b[0]

                                  (__pyx_v_b[0]) = (0xFF - (__pyx_v_b[0]));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3684:

     3685:

    +3686: cdef float[5] GAUSS_KERNEL = [1.0/16.0, 4.0/16.0, 6.0/16.0, 4.0/16.0, 1.0/16.0]

      __pyx_t_36[0] = (1.0 / 16.0);
      __pyx_t_36[1] = (4.0 / 16.0);
      __pyx_t_36[2] = (6.0 / 16.0);
      __pyx_t_36[3] = (4.0 / 16.0);
      __pyx_t_36[4] = (1.0 / 16.0);
      memcpy(&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[0]), __pyx_t_36, sizeof(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[0]) * (5));

     3687:

     3688: @cython.boundscheck(False)

     3689: @cython.wraparound(False)

     3690: @cython.nonecheck(False)

     3691: @cython.cdivision(True)

    +3692: cdef inline void shader_blur5x5_array24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c *__pyx_optional_args) {
      PyObject *__pyx_v_t = ((PyObject *)__pyx_int_1);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      short __pyx_v_kernel_half;
      __Pyx_memviewslice __pyx_v_convolve = { 0, 0, { 0 }, { 0 }, { 0 } };
      CYTHON_UNUSED __Pyx_memviewslice __pyx_v_convolved = { 0, 0, { 0 }, { 0 }, { 0 } };
      CYTHON_UNUSED Py_ssize_t __pyx_v_kernel_length;
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_xx;
      int __pyx_v_yy;
      float __pyx_v_r;
      float __pyx_v_g;
      float __pyx_v_b;
      char __pyx_v_kernel_offset;
      unsigned char __pyx_v_red;
      unsigned char __pyx_v_green;
      unsigned char __pyx_v_blue;
      float *__pyx_v_k;
      unsigned char *__pyx_v_c1;
      unsigned char *__pyx_v_c2;
      unsigned char *__pyx_v_c3;
      unsigned char *__pyx_v_c4;
      unsigned char *__pyx_v_c5;
      unsigned char *__pyx_v_c6;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_blur5x5_array24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 1) {
          __pyx_v_t = __pyx_optional_args->t;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_blur5x5_array24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_convolve, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_convolved, 1);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_blur5x5_array24_inplace_c {
      int __pyx_n;
      PyObject *mask;
      PyObject *t;
    };

     3693:         unsigned char [:, :, :] rgb_array_, mask=None, t=1):

     3694:     """

     3695:     APPLY A GAUSSIAN BLUR EFFECT TO THE GAME DISPLAY OR TO A GIVEN TEXTURE (KERNEL 5x5)

     3696:

     3697:     # Gaussian kernel 5x5

     3698:         # |1   4   6   4  1|

     3699:         # |4  16  24  16  4|

     3700:         # |6  24  36  24  6|  x 1/256

     3701:         # |4  16  24  16  4|

     3702:         # |1  4    6   4  1|

     3703:     This method is using convolution property and process the image in two passes,

     3704:     first the horizontal convolution and last the vertical convolution

     3705:     pixels convoluted outside image edges will be set to adjacent edge value

     3706:

     3707:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3708:     please refer to pygame function pixels3d or array3d to convert an image into a 3d array (

     3709:     library surfarray)

     3710:

     3711:     :param rgb_array_   : numpy.ndarray type (w, h, 3) uint8

     3712:     :param mask         : numpy.ndarray default None

     3713:     :param t            : integer; number of times

     3714:     :return             : Return 24-bit a numpy.ndarray type (w, h, 3) uint8

     3715:     """

     3716:

     3717:     cdef Py_ssize_t w, h

    +3718:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3719:

     3720:     # kernel 5x5 separable

     3721:     cdef:

     3722:

    +3723:         short int kernel_half = 2

      __pyx_v_kernel_half = 2;

    +3724:         unsigned char [:, :, ::1] convolve = numpy.empty((w, h, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_int_3);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
      __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3724, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_convolve = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +3725:         unsigned char [:, :, ::1] convolved = numpy.empty((w, h, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3725, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_convolved = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +3726:         Py_ssize_t kernel_length = len(GAUSS_KERNEL)

      __pyx_t_4 = __Pyx_carray_to_py_float(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL, 5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 3726, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_kernel_length = __pyx_t_3;

     3727:         int x, y, xx, yy

     3728:         float r, g, b, s

     3729:         char kernel_offset

     3730:         unsigned char red, green, blue

     3731:         float *k

     3732:         unsigned char *c1

     3733:         unsigned char *c2

     3734:         unsigned char *c3

     3735:         unsigned char *c4

     3736:         unsigned char *c5

     3737:         unsigned char *c6

     3738:

    +3739:     for r in range(t):

      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_t); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
        __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_3 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_3 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3739, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 3739, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_5))) {
            if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 3739, __pyx_L1_error)
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          } else {
            if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 3739, __pyx_L1_error)
            #else
            __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3739, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            #endif
          }
        } else {
          __pyx_t_4 = __pyx_t_9(__pyx_t_5);
          if (unlikely(!__pyx_t_4)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(1, 3739, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_10 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_10 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 3739, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_r = __pyx_t_10;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    +3740:         with nogil:

        {
            #ifdef WITH_THREAD
            PyThreadState *_save;
            Py_UNBLOCK_THREADS
            __Pyx_FastGIL_Remember();
            #endif
            /*try:*/ {
    /* … */
            /*finally:*/ {
              /*normal exit:*/{
                #ifdef WITH_THREAD
                __Pyx_FastGIL_Forget();
                Py_BLOCK_THREADS
                #endif
                goto __pyx_L9;
              }
              __pyx_L9:;
            }
        }

     3741:

     3742:             # horizontal convolution

    +3743:             for y in prange(0, h, schedule='static', num_threads=THREADS):

              __pyx_t_2 = __pyx_v_h;
              if ((1 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_12 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_12 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
              __pyx_t_2 = __pyx_v_h;
              if ((1 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_12 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_12 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                          #endif /* _OPENMP */
                          for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                              {
                                  __pyx_v_y = (int)(0 + 1 * __pyx_t_11);
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_b = ((float)__PYX_NAN());
                                  __pyx_v_blue = ((unsigned char)'?');
                                  __pyx_v_c1 = ((unsigned char *)1);
                                  __pyx_v_c2 = ((unsigned char *)1);
                                  __pyx_v_c3 = ((unsigned char *)1);
                                  __pyx_v_c4 = ((unsigned char *)1);
                                  __pyx_v_c5 = ((unsigned char *)1);
                                  __pyx_v_c6 = ((unsigned char *)1);
                                  __pyx_v_g = ((float)__PYX_NAN());
                                  __pyx_v_green = ((unsigned char)'?');
                                  __pyx_v_k = ((float *)1);
                                  __pyx_v_kernel_offset = ((char)'?');
                                  __pyx_v_r = ((float)__PYX_NAN());
                                  __pyx_v_red = ((unsigned char)'?');
                                  __pyx_v_x = ((int)0xbad0bad0);
                                  __pyx_v_xx = ((int)0xbad0bad0);

     3744:

    +3745:                 c1 = &rgb_array_[0, y, 0]

                                  __pyx_t_13 = 0;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  __pyx_v_c1 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +3746:                 c2 = &rgb_array_[0, y, 1]

                                  __pyx_t_15 = 0;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  __pyx_v_c2 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

    +3747:                 c3 = &rgb_array_[0, y, 2]

                                  __pyx_t_13 = 0;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  __pyx_v_c3 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +3748:                 c4 = &rgb_array_[w-1, y, 0]

                                  __pyx_t_15 = (__pyx_v_w - 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 0;
                                  __pyx_v_c4 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

    +3749:                 c5 = &rgb_array_[w-1, y, 1]

                                  __pyx_t_13 = (__pyx_v_w - 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  __pyx_v_c5 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +3750:                 c6 = &rgb_array_[w-1, y, 2]

                                  __pyx_t_15 = (__pyx_v_w - 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 2;
                                  __pyx_v_c6 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

     3751:

    +3752:                 for x in range(0, w):  # range [0..w-1]

                                  __pyx_t_16 = __pyx_v_w;
                                  __pyx_t_17 = __pyx_t_16;
                                  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                    __pyx_v_x = __pyx_t_18;

     3753:

    +3754:                     r, g, b = 0, 0, 0

                                    __pyx_t_10 = 0.0;
                                    __pyx_t_19 = 0.0;
                                    __pyx_t_20 = 0.0;
                                    __pyx_v_r = __pyx_t_10;
                                    __pyx_v_g = __pyx_t_19;
                                    __pyx_v_b = __pyx_t_20;

     3755:

    +3756:                     for kernel_offset in range(-kernel_half, kernel_half + 1):

                                    __pyx_t_21 = (__pyx_v_kernel_half + 1);
                                    __pyx_t_22 = __pyx_t_21;
                                    for (__pyx_t_23 = (-__pyx_v_kernel_half); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                      __pyx_v_kernel_offset = __pyx_t_23;

     3757:

    +3758:                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]

                                      __pyx_v_k = (&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[(__pyx_v_kernel_offset + __pyx_v_kernel_half)]));

     3759:

    +3760:                         xx = x + kernel_offset

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset);

     3761:

     3762:                         # check boundaries.

     3763:                         # Fetch the edge pixel for the convolution

    +3764:                         if xx < 0:

                                      __pyx_t_24 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_24) {
    /* … */
                                        goto __pyx_L18;
                                      }

    +3765:                             red, green, blue = c1[0], c2[0], c3[0]

                                        __pyx_t_25 = (__pyx_v_c1[0]);
                                        __pyx_t_26 = (__pyx_v_c2[0]);
                                        __pyx_t_27 = (__pyx_v_c3[0]);
                                        __pyx_v_red = __pyx_t_25;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_27;

    +3766:                         elif xx > (w - 1):

                                      __pyx_t_24 = ((__pyx_v_xx > (__pyx_v_w - 1)) != 0);
                                      if (__pyx_t_24) {
    /* … */
                                        goto __pyx_L18;
                                      }

    +3767:                             red, green, blue = c4[0], c5[0], c6[0]

                                        __pyx_t_27 = (__pyx_v_c4[0]);
                                        __pyx_t_26 = (__pyx_v_c5[0]);
                                        __pyx_t_25 = (__pyx_v_c6[0]);
                                        __pyx_v_red = __pyx_t_27;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_25;

     3768:                         else:

    +3769:                             red, green, blue = rgb_array_[xx, y, 0],\

                                      /*else*/ {
                                        __pyx_t_13 = __pyx_v_xx;
                                        __pyx_t_14 = __pyx_v_y;
                                        __pyx_t_15 = 0;
                                        __pyx_t_25 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )));

    +3770:                                 rgb_array_[xx, y, 1], rgb_array_[xx, y, 2]

                                        __pyx_t_15 = __pyx_v_xx;
                                        __pyx_t_14 = __pyx_v_y;
                                        __pyx_t_13 = 1;
                                        __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )));
                                        __pyx_t_13 = __pyx_v_xx;
                                        __pyx_t_14 = __pyx_v_y;
                                        __pyx_t_15 = 2;
                                        __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )));
                                        __pyx_v_red = __pyx_t_25;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_27;

    +3771:                             if red + green + blue == 0:

                                        __pyx_t_24 = ((((__pyx_v_red + __pyx_v_green) + __pyx_v_blue) == 0) != 0);
                                        if (__pyx_t_24) {
    /* … */
                                        }
                                      }
                                      __pyx_L18:;

    +3772:                                 continue

                                          goto __pyx_L16_continue;

     3773:

    +3774:                         r = r + red * k[0]

                                      __pyx_v_r = (__pyx_v_r + (__pyx_v_red * (__pyx_v_k[0])));

    +3775:                         g = g + green * k[0]

                                      __pyx_v_g = (__pyx_v_g + (__pyx_v_green * (__pyx_v_k[0])));

    +3776:                         b = b + blue * k[0]

                                      __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * (__pyx_v_k[0])));
                                      __pyx_L16_continue:;
                                    }

     3777:

    +3778:                     convolve[x, y, 0] = <unsigned char>r

                                    __pyx_t_15 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_13 = 0;
                                    *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )) = ((unsigned char)__pyx_v_r);

    +3779:                     convolve[x, y, 1] = <unsigned char>g

                                    __pyx_t_13 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_15 = 1;
                                    *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )) = ((unsigned char)__pyx_v_g);

    +3780:                     convolve[x, y, 2] = <unsigned char>b

                                    __pyx_t_15 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_13 = 2;
                                    *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )) = ((unsigned char)__pyx_v_b);
                                  }
                              }
                          }
                      }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif

     3781:

     3782:             # Vertical convolution

    +3783:             for x in prange(0,  w, schedule='static', num_threads=THREADS):

              __pyx_t_12 = __pyx_v_w;
              if ((1 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_2 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_2 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
              __pyx_t_12 = __pyx_v_w;
              if ((1 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_2 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                  if (__pyx_t_2 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_c4) lastprivate(__pyx_v_c5) lastprivate(__pyx_v_c6) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                          #endif /* _OPENMP */
                          for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_2; __pyx_t_11++){
                              {
                                  __pyx_v_x = (int)(0 + 1 * __pyx_t_11);
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_b = ((float)__PYX_NAN());
                                  __pyx_v_blue = ((unsigned char)'?');
                                  __pyx_v_c1 = ((unsigned char *)1);
                                  __pyx_v_c2 = ((unsigned char *)1);
                                  __pyx_v_c3 = ((unsigned char *)1);
                                  __pyx_v_c4 = ((unsigned char *)1);
                                  __pyx_v_c5 = ((unsigned char *)1);
                                  __pyx_v_c6 = ((unsigned char *)1);
                                  __pyx_v_g = ((float)__PYX_NAN());
                                  __pyx_v_green = ((unsigned char)'?');
                                  __pyx_v_k = ((float *)1);
                                  __pyx_v_kernel_offset = ((char)'?');
                                  __pyx_v_r = ((float)__PYX_NAN());
                                  __pyx_v_red = ((unsigned char)'?');
                                  __pyx_v_y = ((int)0xbad0bad0);
                                  __pyx_v_yy = ((int)0xbad0bad0);

     3784:

    +3785:                 c1 = &convolve[x, 0, 0]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = 0;
                                  __pyx_t_15 = 0;
                                  __pyx_v_c1 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

    +3786:                 c2 = &convolve[x, 0, 1]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = 0;
                                  __pyx_t_13 = 1;
                                  __pyx_v_c2 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

    +3787:                 c3 = &convolve[x, 0, 2]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = 0;
                                  __pyx_t_15 = 2;
                                  __pyx_v_c3 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

    +3788:                 c4 = &convolve[x, h-1, 0]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_h - 1);
                                  __pyx_t_13 = 0;
                                  __pyx_v_c4 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

    +3789:                 c5 = &convolve[x, h-1, 1]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_h - 1);
                                  __pyx_t_15 = 1;
                                  __pyx_v_c5 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) ))));

    +3790:                 c6 = &convolve[x, h-1, 2]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_h - 1);
                                  __pyx_t_13 = 2;
                                  __pyx_v_c6 = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) ))));

     3791:

    +3792:                 for y in range(0, h):

                                  __pyx_t_16 = __pyx_v_h;
                                  __pyx_t_17 = __pyx_t_16;
                                  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                    __pyx_v_y = __pyx_t_18;

    +3793:                     r, g, b = 0, 0, 0

                                    __pyx_t_20 = 0.0;
                                    __pyx_t_19 = 0.0;
                                    __pyx_t_10 = 0.0;
                                    __pyx_v_r = __pyx_t_20;
                                    __pyx_v_g = __pyx_t_19;
                                    __pyx_v_b = __pyx_t_10;

     3794:

    +3795:                     for kernel_offset in range(-kernel_half, kernel_half + 1):

                                    __pyx_t_21 = (__pyx_v_kernel_half + 1);
                                    __pyx_t_22 = __pyx_t_21;
                                    for (__pyx_t_23 = (-__pyx_v_kernel_half); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                      __pyx_v_kernel_offset = __pyx_t_23;

     3796:

    +3797:                         k = &GAUSS_KERNEL[kernel_offset + kernel_half]

                                      __pyx_v_k = (&(__pyx_v_12PygameShader_6shader_GAUSS_KERNEL[(__pyx_v_kernel_offset + __pyx_v_kernel_half)]));

    +3798:                         yy = y + kernel_offset

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset);

     3799:

    +3800:                         if yy < 0:

                                      __pyx_t_24 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_24) {
    /* … */
                                        goto __pyx_L30;
                                      }

    +3801:                             red, green, blue = c1[0], c2[0], c3[0]

                                        __pyx_t_27 = (__pyx_v_c1[0]);
                                        __pyx_t_26 = (__pyx_v_c2[0]);
                                        __pyx_t_25 = (__pyx_v_c3[0]);
                                        __pyx_v_red = __pyx_t_27;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_25;

    +3802:                         elif yy > (h -1):

                                      __pyx_t_24 = ((__pyx_v_yy > (__pyx_v_h - 1)) != 0);
                                      if (__pyx_t_24) {
    /* … */
                                        goto __pyx_L30;
                                      }

    +3803:                             red, green, blue = c4[0], c5[0], c6[0]

                                        __pyx_t_25 = (__pyx_v_c4[0]);
                                        __pyx_t_26 = (__pyx_v_c5[0]);
                                        __pyx_t_27 = (__pyx_v_c6[0]);
                                        __pyx_v_red = __pyx_t_25;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_27;

     3804:                         else:

    +3805:                             red, green, blue = convolve[x, yy, 0],\

                                      /*else*/ {
                                        __pyx_t_13 = __pyx_v_x;
                                        __pyx_t_14 = __pyx_v_yy;
                                        __pyx_t_15 = 0;
                                        __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )));

    +3806:                                 convolve[x, yy, 1], convolve[x, yy, 2]

                                        __pyx_t_15 = __pyx_v_x;
                                        __pyx_t_14 = __pyx_v_yy;
                                        __pyx_t_13 = 1;
                                        __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_15 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_13)) )));
                                        __pyx_t_13 = __pyx_v_x;
                                        __pyx_t_14 = __pyx_v_yy;
                                        __pyx_t_15 = 2;
                                        __pyx_t_25 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_convolve.data + __pyx_t_13 * __pyx_v_convolve.strides[0]) ) + __pyx_t_14 * __pyx_v_convolve.strides[1]) )) + __pyx_t_15)) )));
                                        __pyx_v_red = __pyx_t_27;
                                        __pyx_v_green = __pyx_t_26;
                                        __pyx_v_blue = __pyx_t_25;

    +3807:                             if red + green + blue == 0:

                                        __pyx_t_24 = ((((__pyx_v_red + __pyx_v_green) + __pyx_v_blue) == 0) != 0);
                                        if (__pyx_t_24) {
    /* … */
                                        }
                                      }
                                      __pyx_L30:;

    +3808:                                 continue

                                          goto __pyx_L28_continue;

     3809:

    +3810:                         r = r + red * k[0]

                                      __pyx_v_r = (__pyx_v_r + (__pyx_v_red * (__pyx_v_k[0])));

    +3811:                         g = g + green * k[0]

                                      __pyx_v_g = (__pyx_v_g + (__pyx_v_green * (__pyx_v_k[0])));

    +3812:                         b = b + blue * k[0]

                                      __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * (__pyx_v_k[0])));
                                      __pyx_L28_continue:;
                                    }

     3813:

    +3814:                     rgb_array_[x, y, 0], rgb_array_[x, y, 1], rgb_array_[x, y, 2] = \

                                    __pyx_t_15 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_13 = 0;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_25;
                                    __pyx_t_13 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_15 = 1;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_26;
                                    __pyx_t_15 = __pyx_v_x;
                                    __pyx_t_14 = __pyx_v_y;
                                    __pyx_t_13 = 2;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_27;
                                  }
                              }
                          }
                      }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif
            }

    +3815:                         <unsigned char>r, <unsigned char>g, <unsigned char>b

                                    __pyx_t_25 = ((unsigned char)__pyx_v_r);
                                    __pyx_t_26 = ((unsigned char)__pyx_v_g);
                                    __pyx_t_27 = ((unsigned char)__pyx_v_b);

     3816:

     3817:

     3818: @cython.boundscheck(False)

     3819: @cython.wraparound(False)

     3820: @cython.nonecheck(False)

     3821: @cython.cdivision(True)

    +3822: cdef inline void shader_wave24bit_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_wave24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_rad, int __pyx_v_size) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_x_pos;
      int __pyx_v_y_pos;
      int __pyx_v_xx;
      int __pyx_v_yy;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_c1;
      int __pyx_v_w_1;
      int __pyx_v_h_1;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_wave24bit_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_wave24bit_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
      __Pyx_RefNannyFinishContext();
    }

     3823:         unsigned char [:, :, :] rgb_array_,

     3824:         float rad,

     3825:         int size):

     3826:     """

     3827:     CREATE A WAVE EFFECT TO THE GAME DISPLAY OR TO A GIVEN SURFACE

     3828:

     3829:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3830:      please refer to pygame function pixels3d or array3d to convert an image into a

     3831:      3d array (library surfarray)

     3832:

     3833:     e.g:

     3834:     wave(surface, 8 * math.pi/180.0 + frame_number, 5)

     3835:

     3836:     :param rgb_array_   : numpy.ndarray shape (w, h, 3) containing all the RGB values

     3837:     :param rad          : float; angle in rad to rotate over time

     3838:     :param size         : int; Number of sub-surfaces

     3839:     :return             : void

     3840:     """

     3841:

     3842:

     3843:

     3844:     cdef Py_ssize_t w, h

    +3845:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3846:

     3847:     cdef:

    +3848:         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3848, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3848, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     3849:         int x, y, x_pos, y_pos, xx, yy

    +3850:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +3851:         float c1 = <float>1.0 / <float>(size * size)

      __pyx_v_c1 = (((float)1.0) / ((float)(__pyx_v_size * __pyx_v_size)));

    +3852:         int w_1 = <int>w - 1

      __pyx_v_w_1 = (((int)__pyx_v_w) - 1);

    +3853:         int h_1 = <int>h - 1

      __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

     3854:

    +3855:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     3856:

    +3857:         for y in prange(0, h_1 - size, size, schedule='static', num_threads=THREADS):

            __pyx_t_9 = (__pyx_v_h_1 - __pyx_v_size);
            __pyx_t_10 = __pyx_v_size;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y_pos) lastprivate(__pyx_v_yy) schedule(static)        __pyx_t_10 = __pyx_v_size;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y_pos) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                            {
                                __pyx_v_y = (int)(0 + __pyx_t_10 * __pyx_t_11);
                                /* Initialize private variables to invalid values */
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);
                                __pyx_v_x_pos = ((int)0xbad0bad0);
                                __pyx_v_xx = ((int)0xbad0bad0);
                                __pyx_v_y_pos = ((int)0xbad0bad0);
                                __pyx_v_yy = ((int)0xbad0bad0);

     3858:

    +3859:             y_pos = y + size + <int>(<float>sin(rad + <float>y * c1) * <float>size)

                                __pyx_v_y_pos = ((__pyx_v_y + __pyx_v_size) + ((int)(((float)sin((__pyx_v_rad + (((float)__pyx_v_y) * __pyx_v_c1)))) * ((float)__pyx_v_size))));

     3860:

    +3861:             for x in prange(0, w_1 - size, size, schedule='static', num_threads=THREADS):

                                __pyx_t_13 = (__pyx_v_w_1 - __pyx_v_size);
                                __pyx_t_14 = __pyx_v_size;
                                if ((__pyx_t_14 == 0)) abort();
                                {
                                    __pyx_t_16 = (__pyx_t_13 - 0 + __pyx_t_14 - __pyx_t_14/abs(__pyx_t_14)) / __pyx_t_14;
                                    if (__pyx_t_16 > 0)
                                    {
                                        #if 0
                                        #pragma omp parallel
                                        #endif /* _OPENMP */
                                        {
                                            #if 0
                                            #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_yy) schedule(static)                            __pyx_t_14 = __pyx_v_size;
                                if ((__pyx_t_14 == 0)) abort();
                                {
                                    __pyx_t_16 = (__pyx_t_13 - 0 + __pyx_t_14 - __pyx_t_14/abs(__pyx_t_14)) / __pyx_t_14;
                                    if (__pyx_t_16 > 0)
                                    {
                                        #if 0
                                        #pragma omp parallel
                                        #endif /* _OPENMP */
                                        {
                                            #if 0
                                            #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x_pos) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                                            #endif /* _OPENMP */
                                            for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                                                {
                                                    __pyx_v_x = (int)(0 + __pyx_t_14 * __pyx_t_15);
                                                    /* Initialize private variables to invalid values */
                                                    __pyx_v_i = ((int)0xbad0bad0);
                                                    __pyx_v_j = ((int)0xbad0bad0);
                                                    __pyx_v_x_pos = ((int)0xbad0bad0);
                                                    __pyx_v_xx = ((int)0xbad0bad0);
                                                    __pyx_v_yy = ((int)0xbad0bad0);

     3862:

    +3863:                 x_pos = x + size + <int> (<float>sin(rad + <float> x * c1) * <float> size)

                                                    __pyx_v_x_pos = ((__pyx_v_x + __pyx_v_size) + ((int)(((float)sin((__pyx_v_rad + (((float)__pyx_v_x) * __pyx_v_c1)))) * ((float)__pyx_v_size))));

     3864:

    +3865:                 for i in range(0, size + 1):

                                                    __pyx_t_17 = (__pyx_v_size + 1);
                                                    __pyx_t_18 = __pyx_t_17;
                                                    for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
                                                      __pyx_v_i = __pyx_t_19;

     3866:

    +3867:                     for j in range(0, size + 1):

                                                      __pyx_t_20 = (__pyx_v_size + 1);
                                                      __pyx_t_21 = __pyx_t_20;
                                                      for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {
                                                        __pyx_v_j = __pyx_t_22;

     3868:

    +3869:                         xx = x_pos + i

                                                        __pyx_v_xx = (__pyx_v_x_pos + __pyx_v_i);

    +3870:                         yy = y_pos + j

                                                        __pyx_v_yy = (__pyx_v_y_pos + __pyx_v_j);

     3871:

    +3872:                         if xx > w_1:

                                                        __pyx_t_23 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                                        if (__pyx_t_23) {
    /* … */
                                                          goto __pyx_L18;
                                                        }

    +3873:                             xx = w_1

                                                          __pyx_v_xx = __pyx_v_w_1;

    +3874:                         elif xx < 0:

                                                        __pyx_t_23 = ((__pyx_v_xx < 0) != 0);
                                                        if (__pyx_t_23) {
    /* … */
                                                        }
                                                        __pyx_L18:;

    +3875:                             xx = 0

                                                          __pyx_v_xx = 0;

    +3876:                         if yy > h_1:

                                                        __pyx_t_23 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                                        if (__pyx_t_23) {
    /* … */
                                                          goto __pyx_L19;
                                                        }

    +3877:                             yy = h_1

                                                          __pyx_v_yy = __pyx_v_h_1;

    +3878:                         elif yy < 0:

                                                        __pyx_t_23 = ((__pyx_v_yy < 0) != 0);
                                                        if (__pyx_t_23) {
    /* … */
                                                        }
                                                        __pyx_L19:;

    +3879:                             yy = 0

                                                          __pyx_v_yy = 0;

    +3880:                         rgb_array_[xx, yy, 0] = rgb[x + i, y + j, 0]

                                                        __pyx_t_24 = (__pyx_v_x + __pyx_v_i);
                                                        __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                        __pyx_t_26 = 0;
                                                        __pyx_t_27 = __pyx_v_xx;
                                                        __pyx_t_28 = __pyx_v_yy;
                                                        __pyx_t_29 = 0;
                                                        *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_24 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_26 * __pyx_v_rgb.strides[2]) )));

    +3881:                         rgb_array_[xx, yy, 1] = rgb[x + i, y + j, 1]

                                                        __pyx_t_26 = (__pyx_v_x + __pyx_v_i);
                                                        __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                        __pyx_t_24 = 1;
                                                        __pyx_t_29 = __pyx_v_xx;
                                                        __pyx_t_28 = __pyx_v_yy;
                                                        __pyx_t_27 = 1;
                                                        *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_29 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_27 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_26 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb.strides[2]) )));

    +3882:                         rgb_array_[xx, yy, 2] = rgb[x + i, y + j, 2]

                                                        __pyx_t_24 = (__pyx_v_x + __pyx_v_i);
                                                        __pyx_t_25 = (__pyx_v_y + __pyx_v_j);
                                                        __pyx_t_26 = 2;
                                                        __pyx_t_27 = __pyx_v_xx;
                                                        __pyx_t_28 = __pyx_v_yy;
                                                        __pyx_t_29 = 2;
                                                        *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_27 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_24 * __pyx_v_rgb.strides[0]) ) + __pyx_t_25 * __pyx_v_rgb.strides[1]) ) + __pyx_t_26 * __pyx_v_rgb.strides[2]) )));
                                                      }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     3883:

     3884:

     3885:

     3886:

     3887: @cython.boundscheck(False)

     3888: @cython.wraparound(False)

     3889: @cython.nonecheck(False)

     3890: @cython.cdivision(False)

    +3891: cdef inline void shader_swirl24bit_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_degrees) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_diffx;
      int __pyx_v_diffy;
      int __pyx_v_angle;
      float __pyx_v_columns;
      float __pyx_v_rows;
      float __pyx_v_r;
      float __pyx_v_di;
      float __pyx_v_dj;
      float __pyx_v_c1;
      float __pyx_v_c2;
      __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_r_max;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_swirl24bit_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_swirl24bit_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
      __Pyx_RefNannyFinishContext();
    }

     3892:         unsigned char [:, :, :] rgb_array_,

     3893:         float degrees

     3894: ):

     3895:     """

     3896:     SWIRL AN IMAGE (ANGLE APPROXIMATION METHOD)

     3897:

     3898:     This algorithm uses a table of cos and sin.

     3899:

     3900:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3901:      please refer to pygame function pixels3d or array3d to convert an image into a

     3902:      3d array (library surfarray)

     3903:

     3904:     e.g:

     3905:     swirl(surface, frame_number / 1000.0)

     3906:

     3907:     :param rgb_array_   : numpy.ndarray shape (w, h, 3) containing all the RGB color values

     3908:     :param degrees      : float; swirl angle in degrees

     3909:     :return             : void

     3910:     """

     3911:

     3912:     cdef Py_ssize_t w, h

    +3913:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3914:

     3915:     cdef:

     3916:         int i, j, diffx, diffy, angle

     3917:         float columns, rows, r, di, dj, c1, c2

    +3918:         unsigned char [:, :, ::1] rgb = numpy.array(rgb_array_, copy=True, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3918, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 3918, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3918, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     3919:         float r_max

     3920:

     3921:

    +3922:     columns = <float>0.5 * (<float>w - <float>1.0)

      __pyx_v_columns = (((float)0.5) * (((float)__pyx_v_w) - ((float)1.0)));

    +3923:     rows    = <float>0.5 * (<float>h - <float>1.0)

      __pyx_v_rows = (((float)0.5) * (((float)__pyx_v_h) - ((float)1.0)));

     3924:

    +3925:     r_max = <float>sqrt(columns * columns + rows * rows)

      __pyx_v_r_max = ((float)sqrt(((__pyx_v_columns * __pyx_v_columns) + (__pyx_v_rows * __pyx_v_rows))));

     3926:

    +3927:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L4_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L5:;
          }
      }

    +3928:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_angle = ((int)0xbad0bad0);
                                __pyx_v_c1 = ((float)__PYX_NAN());
                                __pyx_v_c2 = ((float)__PYX_NAN());
                                __pyx_v_di = ((float)__PYX_NAN());
                                __pyx_v_diffx = ((int)0xbad0bad0);
                                __pyx_v_diffy = ((int)0xbad0bad0);
                                __pyx_v_dj = ((float)__PYX_NAN());
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((float)__PYX_NAN());

    +3929:             for i in range(w):

                                __pyx_t_10 = __pyx_v_w;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_i = __pyx_t_12;

     3930:

    +3931:                 di = <float>i - columns

                                  __pyx_v_di = (((float)__pyx_v_i) - __pyx_v_columns);

    +3932:                 dj = <float>j - rows

                                  __pyx_v_dj = (((float)__pyx_v_j) - __pyx_v_rows);

     3933:

    +3934:                 r = <float>sqrt(di * di + dj * dj) / <float>r_max

                                  __pyx_t_13 = ((float)sqrt(((__pyx_v_di * __pyx_v_di) + (__pyx_v_dj * __pyx_v_dj))));
                                  if (unlikely(((float)__pyx_v_r_max) == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 3934, __pyx_L8_error)
                                  }
                                  __pyx_v_r = (__pyx_t_13 / ((float)__pyx_v_r_max));

    +3935:                 angle = <int>(degrees * r % 360)

                                  __pyx_v_angle = ((int)__Pyx_mod_float((__pyx_v_degrees * __pyx_v_r), 360.0));

     3936:

    +3937:                 c1 = COS_TABLE[angle]

                                  __pyx_v_c1 = (__pyx_v_12PygameShader_6shader_COS_TABLE[__pyx_v_angle]);

    +3938:                 c2 = SIN_TABLE[angle]

                                  __pyx_v_c2 = (__pyx_v_12PygameShader_6shader_SIN_TABLE[__pyx_v_angle]);

    +3939:                 diffx = <int>(di * c1 - dj * c2 + columns)

                                  __pyx_v_diffx = ((int)(((__pyx_v_di * __pyx_v_c1) - (__pyx_v_dj * __pyx_v_c2)) + __pyx_v_columns));

    +3940:                 diffy = <int>(di * c2 + dj * c1 + rows)

                                  __pyx_v_diffy = ((int)(((__pyx_v_di * __pyx_v_c2) + (__pyx_v_dj * __pyx_v_c1)) + __pyx_v_rows));

     3941:

    +3942:                 if (diffx >-1) and (diffx < w) and \

                                  __pyx_t_15 = ((__pyx_v_diffx > -1L) != 0);
                                  if (__pyx_t_15) {
                                  } else {
                                    __pyx_t_14 = __pyx_t_15;
                                    goto __pyx_L13_bool_binop_done;
                                  }
                                  __pyx_t_15 = ((__pyx_v_diffx < __pyx_v_w) != 0);
                                  if (__pyx_t_15) {
                                  } else {
                                    __pyx_t_14 = __pyx_t_15;
                                    goto __pyx_L13_bool_binop_done;
                                  }
    /* … */
                                  if (__pyx_t_14) {
    /* … */
                                  }
                                }
                                goto __pyx_L18;
                                __pyx_L8_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L17;
                                __pyx_L17:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates2)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_angle;
                                    __pyx_parallel_temp1 = __pyx_v_c1;
                                    __pyx_parallel_temp2 = __pyx_v_c2;
                                    __pyx_parallel_temp3 = __pyx_v_di;
                                    __pyx_parallel_temp4 = __pyx_v_diffx;
                                    __pyx_parallel_temp5 = __pyx_v_diffy;
                                    __pyx_parallel_temp6 = __pyx_v_dj;
                                    __pyx_parallel_temp7 = __pyx_v_i;
                                    __pyx_parallel_temp8 = __pyx_v_j;
                                    __pyx_parallel_temp9 = __pyx_v_r;
                                }
                                __pyx_L18:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_angle = __pyx_parallel_temp0;
                  __pyx_v_c1 = __pyx_parallel_temp1;
                  __pyx_v_c2 = __pyx_parallel_temp2;
                  __pyx_v_di = __pyx_parallel_temp3;
                  __pyx_v_diffx = __pyx_parallel_temp4;
                  __pyx_v_diffy = __pyx_parallel_temp5;
                  __pyx_v_dj = __pyx_parallel_temp6;
                  __pyx_v_i = __pyx_parallel_temp7;
                  __pyx_v_j = __pyx_parallel_temp8;
                  __pyx_v_r = __pyx_parallel_temp9;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L4_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +3943:                    (diffy >-1) and (diffy < h):

                                  __pyx_t_15 = ((__pyx_v_diffy > -1L) != 0);
                                  if (__pyx_t_15) {
                                  } else {
                                    __pyx_t_14 = __pyx_t_15;
                                    goto __pyx_L13_bool_binop_done;
                                  }
                                  __pyx_t_15 = ((__pyx_v_diffy < __pyx_v_h) != 0);
                                  __pyx_t_14 = __pyx_t_15;
                                  __pyx_L13_bool_binop_done:;

    +3944:                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\

                                    __pyx_t_18 = __pyx_v_i;
                                    __pyx_t_17 = __pyx_v_j;
                                    __pyx_t_16 = 0;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;
                                    __pyx_t_16 = __pyx_v_i;
                                    __pyx_t_17 = __pyx_v_j;
                                    __pyx_t_18 = 1;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_20;

    +3945:                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \

                                    __pyx_t_16 = __pyx_v_diffx;
                                    __pyx_t_17 = __pyx_v_diffy;
                                    __pyx_t_18 = 0;
                                    __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_16 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_18)) )));
    /* … */
                                    __pyx_t_18 = __pyx_v_i;
                                    __pyx_t_17 = __pyx_v_j;
                                    __pyx_t_16 = 2;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_21;

    +3946:                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]

                                    __pyx_t_18 = __pyx_v_diffx;
                                    __pyx_t_17 = __pyx_v_diffy;
                                    __pyx_t_16 = 1;
                                    __pyx_t_20 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_18 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_16)) )));
                                    __pyx_t_16 = __pyx_v_diffx;
                                    __pyx_t_17 = __pyx_v_diffy;
                                    __pyx_t_18 = 2;
                                    __pyx_t_21 = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_16 * __pyx_v_rgb.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb.strides[1]) )) + __pyx_t_18)) )));

     3947:

     3948:

     3949: @cython.boundscheck(False)

     3950: @cython.wraparound(False)

     3951: @cython.nonecheck(False)

     3952: @cython.cdivision(True)

    +3953: cdef inline void shader_swirl24bit_inplace_c1(unsigned char [:, :, :] rgb_array_, float degrees):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_swirl24bit_inplace_c1(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_degrees) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_diffx;
      int __pyx_v_diffy;
      float __pyx_v_columns;
      float __pyx_v_rows;
      float __pyx_v_r;
      float __pyx_v_di;
      float __pyx_v_dj;
      float __pyx_v_c1;
      float __pyx_v_c2;
      float __pyx_v_angle;
      __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_rad;
      float __pyx_v_r_max;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_swirl24bit_inplace_c1", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_swirl24bit_inplace_c1", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
      __Pyx_RefNannyFinishContext();
    }

     3954:     """

     3955:     SWIRL AN IMAGE WITHOUT ANGLE APPROXIMATION

     3956:

     3957:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     3958:      please refer to pygame function pixels3d or array3d to convert an image into a 3d

     3959:      array (library surfarray)

     3960:

     3961:     e.g:

     3962:     swirl(surface_, frame_number / 1000)

     3963:

     3964:     :param rgb_array_   : numpy.ndarray shape (w, h, 3) containing all the RGB color values

     3965:     :param degrees      : float; swirl angle in degrees

     3966:     :return             : void

     3967:     """

     3968:

     3969:     cdef Py_ssize_t w, h

    +3970:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     3971:

     3972:     cdef:

     3973:         int i, j, diffx, diffy

     3974:         float columns, rows, r, di, dj, c1, c2, angle

    +3975:         unsigned char [:, :, :] rgb = numpy.array(rgb_array_, copy=True)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 3975, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 3975, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +3976:         float rad = degrees * DEG_TO_RAD

      __pyx_v_rad = (__pyx_v_degrees * __pyx_v_12PygameShader_6shader_DEG_TO_RAD);

     3977:         float r_max

     3978:

     3979:

    +3980:     columns = <float>0.5 * (w - <float>1.0)

      __pyx_v_columns = (((float)0.5) * (__pyx_v_w - ((float)1.0)));

    +3981:     rows    = <float>0.5 * (h - <float>1.0)

      __pyx_v_rows = (((float)0.5) * (__pyx_v_h - ((float)1.0)));

    +3982:     r_max   = <float>sqrt(columns * columns + rows * rows)

      __pyx_v_r_max = ((float)sqrt(((__pyx_v_columns * __pyx_v_columns) + (__pyx_v_rows * __pyx_v_rows))));

    +3983:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +3984:         for i in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_angle) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_di) lastprivate(__pyx_v_diffx) lastprivate(__pyx_v_diffy) lastprivate(__pyx_v_dj) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_angle = ((float)__PYX_NAN());
                                __pyx_v_c1 = ((float)__PYX_NAN());
                                __pyx_v_c2 = ((float)__PYX_NAN());
                                __pyx_v_di = ((float)__PYX_NAN());
                                __pyx_v_diffx = ((int)0xbad0bad0);
                                __pyx_v_diffy = ((int)0xbad0bad0);
                                __pyx_v_dj = ((float)__PYX_NAN());
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_r = ((float)__PYX_NAN());

    +3985:             for j in range(h):

                                __pyx_t_10 = __pyx_v_h;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_j = __pyx_t_12;

     3986:

    +3987:                 di = <float>i - columns

                                  __pyx_v_di = (((float)__pyx_v_i) - __pyx_v_columns);

    +3988:                 dj = <float>j - rows

                                  __pyx_v_dj = (((float)__pyx_v_j) - __pyx_v_rows);

     3989:

    +3990:                 r = <float>sqrt(di * di + dj * dj)

                                  __pyx_v_r = ((float)sqrt(((__pyx_v_di * __pyx_v_di) + (__pyx_v_dj * __pyx_v_dj))));

    +3991:                 angle = <float>(rad * r/r_max)

                                  __pyx_v_angle = ((float)((__pyx_v_rad * __pyx_v_r) / __pyx_v_r_max));

     3992:

    +3993:                 c1 = <float>cos(angle)

                                  __pyx_v_c1 = ((float)cos(__pyx_v_angle));

    +3994:                 c2 = <float>sin(angle)

                                  __pyx_v_c2 = ((float)sin(__pyx_v_angle));

    +3995:                 diffx = <int>(di * c1 - dj * c2 + columns)

                                  __pyx_v_diffx = ((int)(((__pyx_v_di * __pyx_v_c1) - (__pyx_v_dj * __pyx_v_c2)) + __pyx_v_columns));

    +3996:                 diffy = <int>(di * c2 + dj * c1 + rows)

                                  __pyx_v_diffy = ((int)(((__pyx_v_di * __pyx_v_c2) + (__pyx_v_dj * __pyx_v_c1)) + __pyx_v_rows));

     3997:

    +3998:                 if (diffx >-1) and (diffx < w) and \

                                  __pyx_t_14 = ((__pyx_v_diffx > -1L) != 0);
                                  if (__pyx_t_14) {
                                  } else {
                                    __pyx_t_13 = __pyx_t_14;
                                    goto __pyx_L13_bool_binop_done;
                                  }
                                  __pyx_t_14 = ((__pyx_v_diffx < __pyx_v_w) != 0);
                                  if (__pyx_t_14) {
                                  } else {
                                    __pyx_t_13 = __pyx_t_14;
                                    goto __pyx_L13_bool_binop_done;
                                  }
    /* … */
                                  if (__pyx_t_13) {
    /* … */
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +3999:                    (diffy >-1) and (diffy < h):

                                  __pyx_t_14 = ((__pyx_v_diffy > -1L) != 0);
                                  if (__pyx_t_14) {
                                  } else {
                                    __pyx_t_13 = __pyx_t_14;
                                    goto __pyx_L13_bool_binop_done;
                                  }
                                  __pyx_t_14 = ((__pyx_v_diffy < __pyx_v_h) != 0);
                                  __pyx_t_13 = __pyx_t_14;
                                  __pyx_L13_bool_binop_done:;

    +4000:                     rgb_array_[i, j, 0], rgb_array_[i, j, 1],\

                                    __pyx_t_17 = __pyx_v_i;
                                    __pyx_t_16 = __pyx_v_j;
                                    __pyx_t_15 = 0;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_18;
                                    __pyx_t_15 = __pyx_v_i;
                                    __pyx_t_16 = __pyx_v_j;
                                    __pyx_t_17 = 1;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;

    +4001:                         rgb_array_[i, j, 2] = rgb[diffx, diffy, 0], \

                                    __pyx_t_15 = __pyx_v_diffx;
                                    __pyx_t_16 = __pyx_v_diffy;
                                    __pyx_t_17 = 0;
                                    __pyx_t_18 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_15 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb.strides[2]) )));
    /* … */
                                    __pyx_t_17 = __pyx_v_i;
                                    __pyx_t_16 = __pyx_v_j;
                                    __pyx_t_15 = 2;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_20;

    +4002:                                               rgb[diffx, diffy, 1], rgb[diffx, diffy, 2]

                                    __pyx_t_17 = __pyx_v_diffx;
                                    __pyx_t_16 = __pyx_v_diffy;
                                    __pyx_t_15 = 1;
                                    __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_17 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb.strides[2]) )));
                                    __pyx_t_15 = __pyx_v_diffx;
                                    __pyx_t_16 = __pyx_v_diffy;
                                    __pyx_t_17 = 2;
                                    __pyx_t_20 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_15 * __pyx_v_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb.strides[2]) )));

     4003:

     4004:

     4005:

     4006:

     4007: @cython.boundscheck(False)

     4008: @cython.wraparound(False)

     4009: @cython.nonecheck(False)

     4010: @cython.cdivision(False)

    +4011: cdef inline void shader_plasma24bit_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_frame, struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c *__pyx_optional_args) {
      float __pyx_v_hue_ = __pyx_k__19;
      float __pyx_v_sat_ = __pyx_k__20;
      float __pyx_v_value_ = __pyx_k__21;
      float __pyx_v_a_ = ((float)0.00392156862745098);
      float __pyx_v_b_ = ((float)0.08333333333333333);
      float __pyx_v_c_ = ((float)0.08333333333333333);
      CYTHON_UNUSED Py_ssize_t __pyx_v_width;
      Py_ssize_t __pyx_v_height;
      float __pyx_v_xx;
      float __pyx_v_yy;
      float __pyx_v_t;
      float __pyx_v_h;
      float __pyx_v_s;
      float __pyx_v_v;
      int __pyx_v_i;
      int __pyx_v_x;
      int __pyx_v_y;
      float __pyx_v_f;
      float __pyx_v_p;
      float __pyx_v_q;
      float __pyx_v_t_;
      float __pyx_v_hue;
      float __pyx_v_r;
      float __pyx_v_g;
      float __pyx_v_b;
      unsigned char *__pyx_v_rr;
      unsigned char *__pyx_v_gg;
      unsigned char *__pyx_v_bb;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_plasma24bit_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_hue_ = __pyx_optional_args->hue_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_sat_ = __pyx_optional_args->sat_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_value_ = __pyx_optional_args->value_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_a_ = __pyx_optional_args->a_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_b_ = __pyx_optional_args->b_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_c_ = __pyx_optional_args->c_;
                  }
                }
              }
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_plasma24bit_inplace_c {
      int __pyx_n;
      float hue_;
      float sat_;
      float value_;
      float a_;
      float b_;
      float c_;
    };

     4012:         unsigned char [:, :, :] rgb_array_,

     4013:         int frame,

    +4014:         float hue_=1.0/6.0,

      if (unlikely(6.0 == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 4014, __pyx_L1_error)
      }
      __pyx_k__19 = (1.0 / 6.0);

    +4015:         float sat_=1.0/6.0,

      if (unlikely(6.0 == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 4015, __pyx_L1_error)
      }
      __pyx_k__20 = (1.0 / 6.0);

    +4016:         float value_=1.0/8.0,

      if (unlikely(8.0 == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 4016, __pyx_L1_error)
      }
      __pyx_k__21 = (1.0 / 8.0);

     4017:         float a_=ONE_255,

     4018:         float b_=ONE_TWELVE,

     4019:         float c_=ONE_TWELVE):

     4020:     """

     4021:     CREATE A BASIC PLASMA EFFECT ON THE TOP OF A PYGAME SURFACE

     4022:

     4023:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4024:      please refer to pygame function pixels3d or array3d to convert an image into a

     4025:      3d array (library surfarray)

     4026:

     4027:     e.g:

     4028:     plasma_config(surface, frame_number)

     4029:

     4030:     :param a_           : float; default value 1.0/255.0 control the plasma equation

     4031:     :param b_           : float; default value 1.0/12.0 control the plasma equation

     4032:     :param c_           : float; default value 1.0/12.0 control the plasma equation

     4033:     :param value_       : float; default value 1.0/8.0 value factor

     4034:     :param sat_         : float; default value 1.0/6.0 saturation value

     4035:     :param hue_         : float; default value 1.0/6.0 hue value factor

     4036:     :param rgb_array_   : numpy.ndarray shape( w, h, 3) containing all the RGB color values

     4037:     :param frame        : integer; Variable that need to change over time

     4038:     :return             : void

     4039:     """

     4040:

     4041:     cdef Py_ssize_t width, height

    +4042:     width, height = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_width = __pyx_t_2;
      __pyx_v_height = __pyx_t_3;

     4043:

     4044:     cdef:

     4045:         float xx, yy, t

     4046:         float h, s, v

    +4047:         int i = 0, x, y

      __pyx_v_i = 0;

     4048:         float f, p, q, t_

     4049:         float hue, r, g, b

     4050:         unsigned char *rr

     4051:         unsigned char *gg

     4052:         unsigned char *bb

     4053:

    +4054:     t = <float>frame

      __pyx_v_t = ((float)__pyx_v_frame);

     4055:

    +4056:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4057:         for x in prange(width, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_f) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_h) lastprivate(__pyx_v_hue) lastprivate(__pyx_v_i) lastprivate(__pyx_v_p) lastprivate(__pyx_v_q) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_s) lastprivate(__pyx_v_t_) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_f) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_h) lastprivate(__pyx_v_hue) lastprivate(__pyx_v_i) lastprivate(__pyx_v_p) lastprivate(__pyx_v_q) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_s) lastprivate(__pyx_v_t_) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((float)__PYX_NAN());
                                __pyx_v_bb = ((unsigned char *)1);
                                __pyx_v_f = ((float)__PYX_NAN());
                                __pyx_v_g = ((float)__PYX_NAN());
                                __pyx_v_gg = ((unsigned char *)1);
                                __pyx_v_h = ((float)__PYX_NAN());
                                __pyx_v_hue = ((float)__PYX_NAN());
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_p = ((float)__PYX_NAN());
                                __pyx_v_q = ((float)__PYX_NAN());
                                __pyx_v_r = ((float)__PYX_NAN());
                                __pyx_v_rr = ((unsigned char *)1);
                                __pyx_v_s = ((float)__PYX_NAN());
                                __pyx_v_t_ = ((float)__PYX_NAN());
                                __pyx_v_v = ((float)__PYX_NAN());
                                __pyx_v_xx = ((float)__PYX_NAN());
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_yy = ((float)__PYX_NAN());

    +4058:             for y in range(height):

                                __pyx_t_5 = __pyx_v_height;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_y = __pyx_t_7;

     4059:

    +4060:                 xx = <float>x * <float>0.5

                                  __pyx_v_xx = (((float)__pyx_v_x) * ((float)0.5));

    +4061:                 yy = <float>y * <float>0.5

                                  __pyx_v_yy = (((float)__pyx_v_y) * ((float)0.5));

     4062:

     4063:                 hue = <float>4.0 + <float>sin((xx * <float>0.5 + yy * <float>0.5) * a_) \

    +4064:                       + <float>sin((xx * b_ + t) * c_)

                                  __pyx_v_hue = ((((float)4.0) + ((float)sin((((__pyx_v_xx * ((float)0.5)) + (__pyx_v_yy * ((float)0.5))) * __pyx_v_a_)))) + ((float)sin((((__pyx_v_xx * __pyx_v_b_) + __pyx_v_t) * __pyx_v_c_))));

     4065:

    +4066:                 h, s, v = hue * hue_, hue * sat_, hue * value_

                                  __pyx_t_8 = (__pyx_v_hue * __pyx_v_hue_);
                                  __pyx_t_9 = (__pyx_v_hue * __pyx_v_sat_);
                                  __pyx_t_10 = (__pyx_v_hue * __pyx_v_value_);
                                  __pyx_v_h = __pyx_t_8;
                                  __pyx_v_s = __pyx_t_9;
                                  __pyx_v_v = __pyx_t_10;

     4067:

    +4068:                 i = <int>(h * <float>6.0)

                                  __pyx_v_i = ((int)(__pyx_v_h * ((float)6.0)));

    +4069:                 f = (h * <float>6.0) - i

                                  __pyx_v_f = ((__pyx_v_h * ((float)6.0)) - __pyx_v_i);

    +4070:                 p = v*(<float>1.0 - s)

                                  __pyx_v_p = (__pyx_v_v * (((float)1.0) - __pyx_v_s));

    +4071:                 q = v*(<float>1.0 - s * f)

                                  __pyx_v_q = (__pyx_v_v * (((float)1.0) - (__pyx_v_s * __pyx_v_f)));

    +4072:                 t_ = v*(<float>1.0 - s * (<float>1.0 - f))

                                  __pyx_v_t_ = (__pyx_v_v * (((float)1.0) - (__pyx_v_s * (((float)1.0) - __pyx_v_f))));

    +4073:                 i = i % 6

                                  __pyx_v_i = __Pyx_mod_long(__pyx_v_i, 6);

     4074:

    +4075:                 if i == 0:

                                  __pyx_t_11 = ((__pyx_v_i == 0) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4076:                     r, g, b =  v, t, p

                                    __pyx_t_10 = __pyx_v_v;
                                    __pyx_t_9 = __pyx_v_t;
                                    __pyx_t_8 = __pyx_v_p;
                                    __pyx_v_r = __pyx_t_10;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_8;

    +4077:                 if i == 1:

                                  __pyx_t_11 = ((__pyx_v_i == 1) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4078:                      r, g, b = q, v, p

                                    __pyx_t_8 = __pyx_v_q;
                                    __pyx_t_9 = __pyx_v_v;
                                    __pyx_t_10 = __pyx_v_p;
                                    __pyx_v_r = __pyx_t_8;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_10;

    +4079:                 if i == 2:

                                  __pyx_t_11 = ((__pyx_v_i == 2) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4080:                      r, g, b = p, v, t

                                    __pyx_t_10 = __pyx_v_p;
                                    __pyx_t_9 = __pyx_v_v;
                                    __pyx_t_8 = __pyx_v_t;
                                    __pyx_v_r = __pyx_t_10;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_8;

    +4081:                 if i == 3:

                                  __pyx_t_11 = ((__pyx_v_i == 3) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4082:                      r, g, b = p, q, v

                                    __pyx_t_8 = __pyx_v_p;
                                    __pyx_t_9 = __pyx_v_q;
                                    __pyx_t_10 = __pyx_v_v;
                                    __pyx_v_r = __pyx_t_8;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_10;

    +4083:                 if i == 4:

                                  __pyx_t_11 = ((__pyx_v_i == 4) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4084:                      r, g, b = t_, p, v

                                    __pyx_t_10 = __pyx_v_t_;
                                    __pyx_t_9 = __pyx_v_p;
                                    __pyx_t_8 = __pyx_v_v;
                                    __pyx_v_r = __pyx_t_10;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_8;

    +4085:                 if i == 5:

                                  __pyx_t_11 = ((__pyx_v_i == 5) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4086:                      r, g, b = v, p, q

                                    __pyx_t_8 = __pyx_v_v;
                                    __pyx_t_9 = __pyx_v_p;
                                    __pyx_t_10 = __pyx_v_q;
                                    __pyx_v_r = __pyx_t_8;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_10;

     4087:

    +4088:                 if s == 0.0:

                                  __pyx_t_11 = ((__pyx_v_s == 0.0) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4089:                      r, g, b = v, v, v

                                    __pyx_t_10 = __pyx_v_v;
                                    __pyx_t_9 = __pyx_v_v;
                                    __pyx_t_8 = __pyx_v_v;
                                    __pyx_v_r = __pyx_t_10;
                                    __pyx_v_g = __pyx_t_9;
                                    __pyx_v_b = __pyx_t_8;

     4090:

    +4091:                 rr = &rgb_array_[x, y, 0]

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_13 = __pyx_v_y;
                                  __pyx_t_14 = 0;
                                  __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

    +4092:                 gg = &rgb_array_[x, y, 1]

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_13 = __pyx_v_y;
                                  __pyx_t_12 = 1;
                                  __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))));

    +4093:                 bb = &rgb_array_[x, y, 2]

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_13 = __pyx_v_y;
                                  __pyx_t_14 = 2;
                                  __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

     4094:

    +4095:                 if rr[0] < 256:

                                  __pyx_t_11 = (((__pyx_v_rr[0]) < 0x100) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4096:                     rr[0] = <unsigned char>(min(rr[0] + r * <float>128.0, <float>255.0))

                                    __pyx_t_8 = ((float)255.0);
                                    __pyx_t_9 = ((__pyx_v_rr[0]) + (__pyx_v_r * ((float)128.0)));
                                    if (((__pyx_t_8 < __pyx_t_9) != 0)) {
                                      __pyx_t_10 = __pyx_t_8;
                                    } else {
                                      __pyx_t_10 = __pyx_t_9;
                                    }
                                    (__pyx_v_rr[0]) = ((unsigned char)__pyx_t_10);

     4097:

    +4098:                 if gg[0] < 256:

                                  __pyx_t_11 = (((__pyx_v_gg[0]) < 0x100) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }

    +4099:                     gg[0] = <unsigned char>(min(gg[0] + g * <float>128.0, <float>255.0))

                                    __pyx_t_10 = ((float)255.0);
                                    __pyx_t_8 = ((__pyx_v_gg[0]) + (__pyx_v_g * ((float)128.0)));
                                    if (((__pyx_t_10 < __pyx_t_8) != 0)) {
                                      __pyx_t_9 = __pyx_t_10;
                                    } else {
                                      __pyx_t_9 = __pyx_t_8;
                                    }
                                    (__pyx_v_gg[0]) = ((unsigned char)__pyx_t_9);

     4100:

    +4101:                 if bb[0] < 256:

                                  __pyx_t_11 = (((__pyx_v_bb[0]) < 0x100) != 0);
                                  if (__pyx_t_11) {
    /* … */
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +4102:                     bb[0] = <unsigned char>(min(bb[0] + b * <float>128.0, <float>255.0))

                                    __pyx_t_9 = ((float)255.0);
                                    __pyx_t_10 = ((__pyx_v_bb[0]) + (__pyx_v_b * ((float)128.0)));
                                    if (((__pyx_t_9 < __pyx_t_10) != 0)) {
                                      __pyx_t_8 = __pyx_t_9;
                                    } else {
                                      __pyx_t_8 = __pyx_t_10;
                                    }
                                    (__pyx_v_bb[0]) = ((unsigned char)__pyx_t_8);

     4103:

     4104:

     4105: @cython.boundscheck(False)

     4106: @cython.wraparound(False)

     4107: @cython.nonecheck(False)

     4108: @cython.cdivision(True)

    +4109: cdef inline void shader_plasma_c(surface_, float frame, unsigned int [::1] palette_):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_plasma_c(PyObject *__pyx_v_surface_, float __pyx_v_frame, __Pyx_memviewslice __pyx_v_palette_) {
      Py_ssize_t __pyx_v_width;
      Py_ssize_t __pyx_v_height;
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_ii;
      int __pyx_v_c;
      __Pyx_memviewslice __pyx_v_rgb_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned char *__pyx_v_rr;
      unsigned char *__pyx_v_gg;
      unsigned char *__pyx_v_bb;
      float __pyx_v_color_;
      float __pyx_v_w2;
      float __pyx_v_h2;
      Py_ssize_t __pyx_v_length;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_plasma_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_plasma_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_, 1);
      __Pyx_RefNannyFinishContext();
    }

     4110:

     4111:     """

     4112:     CREATE A PLASMA EFFECT INPLACE

     4113:

     4114:     e.g:

     4115:     plasma(surface, frame_number)

     4116:

     4117:     :param surface_: pygame Surface

     4118:     :param frame   : float; frame number

     4119:     :param palette_: color palette

     4120:     :return        : void

     4121:     """

     4122:     cdef Py_ssize_t width, height

    +4123:     width, height = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 4123, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4123, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 4123, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 4123, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4123, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4123, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_width = __pyx_t_6;
      __pyx_v_height = __pyx_t_7;

     4124:

     4125:     cdef:

     4126:         int x, y, ii,c

     4127:

    +4128:         unsigned char [:, :, :] rgb_array_ = pixels3d(surface_)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rgb_array_ = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     4129:

     4130:         unsigned char *rr

     4131:         unsigned char *gg

     4132:         unsigned char *bb

     4133:         float color_

    +4134:         float w2 = <float>width * <float>HALF

      __pyx_v_w2 = (((float)__pyx_v_width) * ((float)0.5));

    +4135:         float h2 = <float>height * <float>HALF

      __pyx_v_h2 = (((float)__pyx_v_height) * ((float)0.5));

    +4136:         Py_ssize_t length = len(palette_)

      __pyx_t_9 = __Pyx_MemoryView_Len(__pyx_v_palette_);
      __pyx_v_length = __pyx_t_9;

     4137:

    +4138:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L7:;
          }
      }

     4139:

    +4140:         for y in prange(height, schedule='static', num_threads=THREADS):

            __pyx_t_7 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_bb) lastprivate(__pyx_v_c) lastprivate(__pyx_v_color_) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_7 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_bb) lastprivate(__pyx_v_c) lastprivate(__pyx_v_color_) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_bb = ((unsigned char *)1);
                                __pyx_v_c = ((int)0xbad0bad0);
                                __pyx_v_color_ = ((float)__PYX_NAN());
                                __pyx_v_gg = ((unsigned char *)1);
                                __pyx_v_ii = ((int)0xbad0bad0);
                                __pyx_v_rr = ((unsigned char *)1);
                                __pyx_v_x = ((int)0xbad0bad0);

    +4141:             for x in range(width):

                                __pyx_t_11 = __pyx_v_width;
                                __pyx_t_12 = __pyx_t_11;
                                for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                                  __pyx_v_x = __pyx_t_13;

     4142:

    +4143:                 rr = &rgb_array_[x, y, 0]

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_16 = 0;
                                  __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

    +4144:                 gg = &rgb_array_[x, y, 1]

                                  __pyx_t_16 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_14 = 1;
                                  __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));

    +4145:                 bb = &rgb_array_[x, y, 2]

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_16 = 2;
                                  __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

     4146:

     4147:                 color_ = <float>128.0 + (<float>128.0 * <float>sin(x * ONE_255 + frame)) \

     4148:                     + <float>128.0 + (<float>128.0 * <float>sin(frame * ONE_32 + y * ONE_64)) \

     4149:                     + <float>128.0 + (<float>128.0 * <float>sin(

     4150:                     sqrt((x - w2) * (x - w2) + (y - h2) * (y - h2)) * ONE_255)) \

    +4151:                     + <float>128.0 + (<float>128.0 * <float>sin(

                                  __pyx_v_color_ = (((((((((float)128.0) + (((float)128.0) * ((float)sin(((__pyx_v_x * 0.00392156862745098) + __pyx_v_frame))))) + ((float)128.0)) + (((float)128.0) * ((float)sin(((__pyx_v_frame * 0.03125) + (__pyx_v_y * 0.015625)))))) + ((float)128.0)) + (((float)128.0) * ((float)sin((sqrt((((__pyx_v_x - __pyx_v_w2) * (__pyx_v_x - __pyx_v_w2)) + ((__pyx_v_y - __pyx_v_h2) * (__pyx_v_y - __pyx_v_h2)))) * 0.00392156862745098))))) + ((float)128.0)) + (((float)128.0) * ((float)sin((((float)sqrt((((__pyx_v_x * __pyx_v_x) + (__pyx_v_y * __pyx_v_y)) + __pyx_v_frame))) * ((float)0.015625))))));

     4152:                     <float>sqrt(x * x + y * y + frame) * <float>ONE_64))

     4153:

    +4154:                 c = min(<int>(color_ / <float>8.0), <int>length)

                                  __pyx_t_17 = ((int)__pyx_v_length);
                                  __pyx_t_18 = ((int)(__pyx_v_color_ / ((float)8.0)));
                                  if (((__pyx_t_17 < __pyx_t_18) != 0)) {
                                    __pyx_t_19 = __pyx_t_17;
                                  } else {
                                    __pyx_t_19 = __pyx_t_18;
                                  }
                                  __pyx_v_c = __pyx_t_19;

     4155:

    +4156:                 ii = palette_[c]

                                  __pyx_t_16 = __pyx_v_c;
                                  __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette_.data) + __pyx_t_16)) )));

     4157:

    +4158:                 rr[0] = (ii >> 16) & 255

                                  (__pyx_v_rr[0]) = ((__pyx_v_ii >> 16) & 0xFF);

    +4159:                 gg[0] = (ii >> 8) & 255

                                  (__pyx_v_gg[0]) = ((__pyx_v_ii >> 8) & 0xFF);

    +4160:                 bb[0] = ii & 255

                                  (__pyx_v_bb[0]) = (__pyx_v_ii & 0xFF);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4161:

     4162:

     4163: @cython.boundscheck(False)

     4164: @cython.wraparound(False)

     4165: @cython.nonecheck(False)

     4166: @cython.cdivision(True)

    +4167: cdef inline float [:, :, :, ::1] rgb_to_hsl_model_c():

    static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_rgb_to_hsl_model_c(void) {
      __Pyx_memviewslice __pyx_v_rgb_to_hsl = { 0, 0, { 0 }, { 0 }, { 0 } };
      struct hsl __pyx_v_hsl_;
      int __pyx_v_r;
      int __pyx_v_g;
      int __pyx_v_b;
      __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_hsl_model_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
      __pyx_r.data = NULL;
      __pyx_r.memview = NULL;
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_hsl_model_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      goto __pyx_L2;
      __pyx_L0:;
      if (unlikely(!__pyx_r.memview)) {
        PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
      }
      __pyx_L2:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_to_hsl, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     4168:     """

     4169:     CONVERT RGB INTO HSL MODEL

     4170:

     4171:     The array can be used when the rgb to hsl is extensively used

     4172:

     4173:     All the values will be stored into an array shape (r, g, b, 3) type float

     4174:     :return: Numpy.ndarray shape (r, g, b, 3) type float

     4175:     """

    +4176:     cdef float [:, :, :, ::1] rgb_to_hsl = numpy.empty((256, 256, 256, 3), float32)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_tuple__22);
        __Pyx_GIVEREF(__pyx_tuple__22);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__22);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4176, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rgb_to_hsl = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;
    /* … */
      __pyx_tuple__22 = PyTuple_Pack(4, __pyx_int_256, __pyx_int_256, __pyx_int_256, __pyx_int_3); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 4176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__22);
      __Pyx_GIVEREF(__pyx_tuple__22);

     4177:     cdef hsl hsl_

     4178:     cdef int r, g, b

    +4179:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4180:         for r in prange(0, 256, schedule='static', num_threads=THREADS):

            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) firstprivate(__pyx_v_r) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) firstprivate(__pyx_v_r) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                            {
                                __pyx_v_r = (int)(0 + 1 * __pyx_t_8);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((int)0xbad0bad0);
                                __pyx_v_g = ((int)0xbad0bad0);

    +4181:             for g in range(0, 256):

                                for (__pyx_t_5 = 0; __pyx_t_5 < 0x100; __pyx_t_5+=1) {
                                  __pyx_v_g = __pyx_t_5;

    +4182:                 for b in range(0, 256):

                                  for (__pyx_t_10 = 0; __pyx_t_10 < 0x100; __pyx_t_10+=1) {
                                    __pyx_v_b = __pyx_t_10;

    +4183:                     hsl_ = struct_rgb_to_hsl(

                                    __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

     4184:                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)

    +4185:                     rgb_to_hsl[r, g, b, 0] = min(<float>(hsl_.h * <float>255.0), <float>255.0)

                                    __pyx_t_11 = ((float)255.0);
                                    __pyx_t_12 = ((float)(__pyx_v_hsl_.h * ((float)255.0)));
                                    if (((__pyx_t_11 < __pyx_t_12) != 0)) {
                                      __pyx_t_13 = __pyx_t_11;
                                    } else {
                                      __pyx_t_13 = __pyx_t_12;
                                    }
                                    __pyx_t_14 = __pyx_v_r;
                                    __pyx_t_15 = __pyx_v_g;
                                    __pyx_t_16 = __pyx_v_b;
                                    __pyx_t_17 = 0;
                                    *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_14 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_13;

    +4186:                     rgb_to_hsl[r, g, b, 1] = min(<float>(hsl_.s * <float>255.0), <float>255.0)

                                    __pyx_t_13 = ((float)255.0);
                                    __pyx_t_11 = ((float)(__pyx_v_hsl_.s * ((float)255.0)));
                                    if (((__pyx_t_13 < __pyx_t_11) != 0)) {
                                      __pyx_t_12 = __pyx_t_13;
                                    } else {
                                      __pyx_t_12 = __pyx_t_11;
                                    }
                                    __pyx_t_17 = __pyx_v_r;
                                    __pyx_t_16 = __pyx_v_g;
                                    __pyx_t_15 = __pyx_v_b;
                                    __pyx_t_14 = 1;
                                    *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_17 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_14)) )) = __pyx_t_12;

    +4187:                     rgb_to_hsl[r, g, b, 2] = min(<float>(hsl_.l * <float>255.0), <float>255.0)

                                    __pyx_t_12 = ((float)255.0);
                                    __pyx_t_13 = ((float)(__pyx_v_hsl_.l * ((float)255.0)));
                                    if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                                      __pyx_t_11 = __pyx_t_12;
                                    } else {
                                      __pyx_t_11 = __pyx_t_13;
                                    }
                                    __pyx_t_14 = __pyx_v_r;
                                    __pyx_t_15 = __pyx_v_g;
                                    __pyx_t_16 = __pyx_v_b;
                                    __pyx_t_17 = 2;
                                    *((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl.data + __pyx_t_14 * __pyx_v_rgb_to_hsl.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_to_hsl.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_to_hsl.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_11;
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4188:

    +4189:     return asarray(rgb_to_hsl, dtype=float32)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rgb_to_hsl, 4, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_float(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;
      goto __pyx_L0;

     4190:

     4191:

     4192:

     4193: @cython.boundscheck(False)

     4194: @cython.wraparound(False)

     4195: @cython.nonecheck(False)

     4196: @cython.cdivision(True)

    +4197: cdef inline unsigned char [:, :, :, ::1] hsl_to_rgb_model_c():

    static CYTHON_INLINE __Pyx_memviewslice __pyx_f_12PygameShader_6shader_hsl_to_rgb_model_c(void) {
      __Pyx_memviewslice __pyx_v_hsl_to_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      struct rgb __pyx_v_rgb_;
      int __pyx_v_h;
      int __pyx_v_s;
      int __pyx_v_l;
      __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("hsl_to_rgb_model_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
      __pyx_r.data = NULL;
      __pyx_r.memview = NULL;
      __Pyx_AddTraceback("PygameShader.shader.hsl_to_rgb_model_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      goto __pyx_L2;
      __pyx_L0:;
      if (unlikely(!__pyx_r.memview)) {
        PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
      }
      __pyx_L2:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_hsl_to_rgb, 1);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     4198:     """

     4199:     CONVERT HSL INTO RGB MODEL

     4200:

     4201:     The array can be used when the hsl to rgb is extensively used

     4202:

     4203:     All the values will be stored into an array shape (r, g, b, 3) type float

     4204:     :return: Numpy.ndarray shape (r, g, b, 3) type float

     4205:     """

    +4206:     cdef unsigned char [:, :, :, ::1] hsl_to_rgb = numpy.empty((256, 256, 256, 3), uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_tuple__22, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4206, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_tuple__22);
        __Pyx_GIVEREF(__pyx_tuple__22);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__22);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4206, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4206, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_hsl_to_rgb = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;

     4207:     cdef rgb rgb_

     4208:     cdef int r, g, b

     4209:     cdef int h, s, l

     4210:

    +4211:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4212:         for h in prange(0, 256, schedule='static', num_threads=THREADS):

            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_h) lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
    /* … */
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x100 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_h) lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                            {
                                __pyx_v_h = (int)(0 + 1 * __pyx_t_8);
                                /* Initialize private variables to invalid values */
                                __pyx_v_l = ((int)0xbad0bad0);
                                __pyx_v_s = ((int)0xbad0bad0);

    +4213:             for s in range(0, 256):

                                /* "PygameShader/shader.pyx":4213
     *     with nogil:
     *         for h in prange(0, 256, schedule='static', num_threads=THREADS):
     *             for s in range(0, 256):             # <<<<<<<<<<<<<<
     *                 for l in range(0, 256):
     *                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *
     */
                                for (__pyx_t_5 = 0; __pyx_t_5 < 0x100; __pyx_t_5+=1) {
                                  __pyx_v_s = __pyx_t_5;

    +4214:                 for l in range(0, 256):

                                  for (__pyx_t_10 = 0; __pyx_t_10 < 0x100; __pyx_t_10+=1) {
                                    __pyx_v_l = __pyx_t_10;

    +4215:                     rgb_ = struct_hsl_to_rgb(h * <float>ONE_255, s *

                                    __pyx_v_rgb_ = struct_hsl_to_rgb((__pyx_v_h * ((float)0.00392156862745098)), (__pyx_v_s * ((float)0.00392156862745098)), (__pyx_v_l * ((float)0.00392156862745098)));

     4216:                                              <float>ONE_255, l * <float>ONE_255)

    +4217:                     hsl_to_rgb[h, s, l, 0] =\

                                    __pyx_t_14 = __pyx_v_h;
                                    __pyx_t_15 = __pyx_v_s;
                                    __pyx_t_16 = __pyx_v_l;
                                    __pyx_t_17 = 0;
                                    *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_14 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_13;

    +4218:                         min(<unsigned char> (rgb_.r * <float>255.0), <unsigned char>255)

                                    __pyx_t_11 = ((unsigned char)0xFF);
                                    __pyx_t_12 = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));
                                    if (((__pyx_t_11 < __pyx_t_12) != 0)) {
                                      __pyx_t_13 = __pyx_t_11;
                                    } else {
                                      __pyx_t_13 = __pyx_t_12;
                                    }

    +4219:                     hsl_to_rgb[h, s, l, 1] = \

                                    __pyx_t_17 = __pyx_v_h;
                                    __pyx_t_16 = __pyx_v_s;
                                    __pyx_t_15 = __pyx_v_l;
                                    __pyx_t_14 = 1;
                                    *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_17 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_14)) )) = __pyx_t_12;

    +4220:                         min(<unsigned char> (rgb_.g * <float>255.0), <unsigned char>255)

                                    __pyx_t_13 = ((unsigned char)0xFF);
                                    __pyx_t_11 = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));
                                    if (((__pyx_t_13 < __pyx_t_11) != 0)) {
                                      __pyx_t_12 = __pyx_t_13;
                                    } else {
                                      __pyx_t_12 = __pyx_t_11;
                                    }

    +4221:                     hsl_to_rgb[h, s, l, 2] = \

                                    __pyx_t_14 = __pyx_v_h;
                                    __pyx_t_15 = __pyx_v_s;
                                    __pyx_t_16 = __pyx_v_l;
                                    __pyx_t_17 = 2;
                                    *((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_to_rgb.data + __pyx_t_14 * __pyx_v_hsl_to_rgb.strides[0]) ) + __pyx_t_15 * __pyx_v_hsl_to_rgb.strides[1]) ) + __pyx_t_16 * __pyx_v_hsl_to_rgb.strides[2]) )) + __pyx_t_17)) )) = __pyx_t_11;
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +4222:                         min(<unsigned char> (rgb_.b * <float>255.0), <unsigned char>255)

                                    __pyx_t_12 = ((unsigned char)0xFF);
                                    __pyx_t_13 = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                                    if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                                      __pyx_t_11 = __pyx_t_12;
                                    } else {
                                      __pyx_t_11 = __pyx_t_13;
                                    }

     4223:

    +4224:     return asarray(hsl_to_rgb, dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_hsl_to_rgb, 4, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_d_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 4224, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;
      goto __pyx_L0;

     4225:

     4226: @cython.boundscheck(False)

     4227: @cython.wraparound(False)

     4228: @cython.nonecheck(False)

     4229: @cython.cdivision(True)

    +4230: cdef inline void shader_hsl_surface24bit_inplace_c(unsigned char [:, :, :] rgb_array, float shift_):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, float __pyx_v_shift_) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      struct hsl __pyx_v_hsl_;
      struct rgb __pyx_v_rgb_;
      float __pyx_v_h_;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_hsl_surface24bit_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     4231:

     4232:     """

     4233:     ROTATE THE HUE OF THE GAME DISPLAY OR GIVEN TEXTURE

     4234:

     4235:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4236:     please refer to pygame function pixels3d or array3d to convert an image into a

     4237:     3d array (library surfarray)

     4238:

     4239:     e.g:

     4240:     hsl(surface, 0.2)

     4241:

     4242:     :param rgb_array    : numpy.ndarray of shape(w, h, 3) of unsigned char, rgb values

     4243:     :param shift_       : float; Hue value in range [-1.0 ... 1.0]

     4244:     :return             : void

     4245:     """

     4246:

     4247:     cdef Py_ssize_t w, h

    +4248:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     4249:

     4250:     cdef:

    +4251:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4252:         hsl hsl_

     4253:         rgb rgb_

     4254:         float h_

     4255:         unsigned char *r

     4256:         unsigned char *g

     4257:         unsigned char *b

     4258:

     4259:

    +4260:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4261:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_h_ = ((float)__PYX_NAN());
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);

    +4262:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

    +4263:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +4264:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +4265:                 b = &rgb_array[i, j, 2]

                                  /* "PygameShader/shader.pyx":4265
     *                 r = &rgb_array[i, j, 0]
     *                 g = &rgb_array[i, j, 1]
     *                 b = &rgb_array[i, j, 2]             # <<<<<<<<<<<<<<
     *                 hsl_ = struct_rgb_to_hsl(
     *                     r[0] * <float>ONE_255, g[0] *
     */
                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +4266:                 hsl_ = struct_rgb_to_hsl(

                                  __pyx_v_hsl_ = struct_rgb_to_hsl(((__pyx_v_r[0]) * ((float)0.00392156862745098)), ((__pyx_v_g[0]) * ((float)0.00392156862745098)), ((__pyx_v_b[0]) * ((float)0.00392156862745098)));

     4267:                     r[0] * <float>ONE_255, g[0] *

     4268:                     <float>ONE_255, b[0] * <float>ONE_255)

     4269:

     4270:                 #h_ = min((hsl_.h + shift_), 1.0)

     4271:                 #h_ = max(h_, 0.0)

    +4272:                 h_ = hsl_.h + shift_

                                  __pyx_v_h_ = (__pyx_v_hsl_.h + __pyx_v_shift_);

    +4273:                 rgb_ = struct_hsl_to_rgb(h_, hsl_.s, hsl_.l)

                                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_h_, __pyx_v_hsl_.s, __pyx_v_hsl_.l);

     4274:

    +4275:                 r[0] = <unsigned char>(rgb_.r * <float>255.0)

                                  (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

    +4276:                 g[0] = <unsigned char>(rgb_.g * <float>255.0)

                                  (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

    +4277:                 b[0] = <unsigned char>(rgb_.b * <float>255.0)

                                  (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4278:

     4279:

     4280:

     4281: @cython.boundscheck(False)

     4282: @cython.wraparound(False)

     4283: @cython.nonecheck(False)

     4284: @cython.cdivision(True)

    +4285: cdef inline void shader_hsl_surface24bit_fast_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_hsl_surface24bit_fast_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_hsl_model_, __Pyx_memviewslice __pyx_v_rgb_model_) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_h_;
      unsigned char __pyx_v_h__;
      unsigned char __pyx_v_s__;
      unsigned char __pyx_v_l__;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_hsl_surface24bit_fast_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     4286:         unsigned char [:, :, :] rgb_array,

     4287:         float shift_,

     4288:         float [:, :, :, ::1] hsl_model_,

     4289:         unsigned char [:, :, :, ::1] rgb_model_):

     4290:

     4291:     """

     4292:     ROTATE THE HUE OF AN IMAGE USING STORED HSL TO RGB AND RGB TO HSL VALUES

     4293:

     4294:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4295:     please refer to pygame function pixels3d or array3d to convert an image into a

     4296:     3d array (library surfarray)

     4297:

     4298:     e.g:

     4299:     hsl(surface, 0.2, hsl_model, rgb_model)

     4300:

     4301:     :param rgb_array    : numpy.ndarray of shape(w, h, 3) of unsigned char, rgb values

     4302:     :param shift_       : float; Hue value in range [-1.0 ... 1.0]

     4303:     :param hsl_model_   : numpy.ndarray shape (r, g, b, 3) of hsl values r, g & b

     4304:     in range [0 ... 255]

     4305:     :param rgb_model_   : numpy.ndarray shape (h, s, l, 3) of hsl values h, s & l

     4306:     in range [0.0 ... 1.0]

     4307:     :return: void

     4308:     """

     4309:

     4310:

     4311:

     4312:     cdef Py_ssize_t w, h

    +4313:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     4314:

     4315:     cdef:

    +4316:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4317:

     4318:         float h_

     4319:         unsigned char h__, s__, l__

     4320:

     4321:         unsigned char *r

     4322:         unsigned char *g

     4323:         unsigned char *b

     4324:

     4325:

    +4326:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4327:         for j in prange(h, schedule='dynamic', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_h__) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l__) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s__) schedule(dynamic)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h_) lastprivate(__pyx_v_h__) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l__) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s__) schedule(dynamic) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_h_ = ((float)__PYX_NAN());
                                __pyx_v_h__ = ((unsigned char)'?');
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_l__ = ((unsigned char)'?');
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_s__ = ((unsigned char)'?');

    +4328:             for i in range(w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

     4329:

    +4330:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +4331:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +4332:                 b = &rgb_array[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

     4333:

    +4334:                 h_ = hsl_model_[r[0], g[0], b[0], 0]

                                  __pyx_t_11 = (__pyx_v_r[0]);
                                  __pyx_t_12 = (__pyx_v_g[0]);
                                  __pyx_t_13 = (__pyx_v_b[0]);
                                  __pyx_t_10 = 0;
                                  __pyx_v_h_ = (*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_11 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) )));

     4335:

    +4336:                 h__ = <unsigned char> (<float>min((h_ * ONE_255 + shift_), <float>1.0) * \

                                  __pyx_t_14 = ((float)1.0);
                                  __pyx_t_15 = ((__pyx_v_h_ * 0.00392156862745098) + __pyx_v_shift_);
                                  if (((__pyx_t_14 < __pyx_t_15) != 0)) {
                                    __pyx_t_16 = __pyx_t_14;
                                  } else {
                                    __pyx_t_16 = __pyx_t_15;
                                  }
    /* … */
                                  __pyx_v_h__ = ((unsigned char)(((float)__pyx_t_16) * ((float)255.0)));

     4337:                     <float>255.0)

     4338:

    +4339:                 s__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 1]

                                  __pyx_t_13 = (__pyx_v_r[0]);
                                  __pyx_t_12 = (__pyx_v_g[0]);
                                  __pyx_t_11 = (__pyx_v_b[0]);
                                  __pyx_t_10 = 1;
                                  __pyx_v_s__ = ((unsigned char)(*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_13 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) ))));

    +4340:                 l__ = <unsigned char> hsl_model_[r[0], g[0], b[0], 2]

                                  __pyx_t_11 = (__pyx_v_r[0]);
                                  __pyx_t_12 = (__pyx_v_g[0]);
                                  __pyx_t_13 = (__pyx_v_b[0]);
                                  __pyx_t_10 = 2;
                                  __pyx_v_l__ = ((unsigned char)(*((float *) ( /* dim=3 */ ((char *) (((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_hsl_model_.data + __pyx_t_11 * __pyx_v_hsl_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_hsl_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_hsl_model_.strides[2]) )) + __pyx_t_10)) ))));

     4341:

    +4342:                 r[0] = (&rgb_model_[h__, s__, l__, 0])[0]

                                  __pyx_t_13 = __pyx_v_h__;
                                  __pyx_t_12 = __pyx_v_s__;
                                  __pyx_t_11 = __pyx_v_l__;
                                  __pyx_t_10 = 0;
                                  (__pyx_v_r[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_13 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);

    +4343:                 g[0] = (&rgb_model_[h__, s__, l__, 1])[0]

                                  __pyx_t_11 = __pyx_v_h__;
                                  __pyx_t_12 = __pyx_v_s__;
                                  __pyx_t_13 = __pyx_v_l__;
                                  __pyx_t_10 = 1;
                                  (__pyx_v_g[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_11 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);

    +4344:                 b[0] = (&rgb_model_[h__, s__, l__, 2])[0]

                                  __pyx_t_13 = __pyx_v_h__;
                                  __pyx_t_12 = __pyx_v_s__;
                                  __pyx_t_11 = __pyx_v_l__;
                                  __pyx_t_10 = 2;
                                  (__pyx_v_b[0]) = ((&(*((unsigned char *) ( /* dim=3 */ ((char *) (((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_model_.data + __pyx_t_13 * __pyx_v_rgb_model_.strides[0]) ) + __pyx_t_12 * __pyx_v_rgb_model_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_model_.strides[2]) )) + __pyx_t_10)) ))))[0]);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4345:

     4346:

     4347:

     4348: @cython.boundscheck(False)

     4349: @cython.wraparound(False)

     4350: @cython.nonecheck(False)

     4351: @cython.cdivision(True)

    +4352: cdef inline void shader_brightness24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c *__pyx_optional_args) {
      float __pyx_v_shift_ = ((float)0.0);
      Py_ssize_t __pyx_v_width;
      CYTHON_UNUSED Py_ssize_t __pyx_v_height;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_l;
      struct hsl __pyx_v_hsl_;
      struct rgb __pyx_v_rgb_;
      CYTHON_UNUSED int __pyx_v_exclude_color;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_brightness24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_shift_ = __pyx_optional_args->shift_;
        }
      }
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_inplace_c {
      int __pyx_n;
      float shift_;
    };

     4353:         unsigned char [:, :, :] rgb_array_, float shift_=0):

     4354:     """

     4355:     SHADER BRIGHTNESS

     4356:

     4357:     This shader control the pygame display brightness level

     4358:     It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb

     4359:

     4360:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4361:     please refer to pygame function pixels3d or array3d to convert an image into

     4362:     a 3d array (library surfarray)

     4363:

     4364:     e.g:

     4365:     brightness(surface, 0.2)

     4366:

     4367:     :param rgb_array_: numpy ndarray shape (w, h, 3) containing RGB pixels values

     4368:     :param shift_    : float; values in range [-1.0 ... 1.0], 0 no change,

     4369:     -1 lowest brightness, +1 highest brightness

     4370:     :return          : void

     4371:     """

     4372:

     4373:     cdef Py_ssize_t width, height

    +4374:     width, height = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_width = __pyx_t_2;
      __pyx_v_height = __pyx_t_3;

     4375:

     4376:     cdef:

    +4377:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4378:         unsigned char *r

     4379:         unsigned char *g

     4380:         unsigned char *b

     4381:         float l, h, s

     4382:         hsl hsl_

     4383:         rgb rgb_

     4384:         float high, low, high_

     4385:         unsigned char exclude_r, exclude_g, exclude_b

    +4386:         bint exclude_color = False

      __pyx_v_exclude_color = 0;

     4387:

    +4388:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4389:         for j in prange(height, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_l = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char *)1);

    +4390:             for i in range(width):

                                __pyx_t_5 = __pyx_v_width;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

     4391:

    +4392:                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_t_11 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_12 = __pyx_v_i;
                                  __pyx_t_13 = __pyx_v_j;
                                  __pyx_t_14 = 1;
                                  __pyx_t_15 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 2;
                                  __pyx_t_19 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_v_r = __pyx_t_11;
                                  __pyx_v_g = __pyx_t_15;
                                  __pyx_v_b = __pyx_t_19;

     4393:

    +4394:                 hsl_ = struct_rgb_to_hsl(

                                  __pyx_v_hsl_ = struct_rgb_to_hsl(((__pyx_v_r[0]) * ((float)0.00392156862745098)), ((__pyx_v_g[0]) * ((float)0.00392156862745098)), ((__pyx_v_b[0]) * ((float)0.00392156862745098)));

     4395:                     r[0] * <float>ONE_255, g[0] *

     4396:                     <float>ONE_255, b[0] * <float>ONE_255)

     4397:

    +4398:                 l = min((hsl_.l + shift_), <float>1.0)

                                  __pyx_t_20 = ((float)1.0);
                                  __pyx_t_21 = (__pyx_v_hsl_.l + __pyx_v_shift_);
                                  if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                    __pyx_t_22 = __pyx_t_20;
                                  } else {
                                    __pyx_t_22 = __pyx_t_21;
                                  }
                                  __pyx_v_l = __pyx_t_22;

    +4399:                 l = max(l, <float>0.0)

                                  __pyx_t_22 = ((float)0.0);
                                  __pyx_t_20 = __pyx_v_l;
                                  if (((__pyx_t_22 > __pyx_t_20) != 0)) {
                                    __pyx_t_21 = __pyx_t_22;
                                  } else {
                                    __pyx_t_21 = __pyx_t_20;
                                  }
                                  __pyx_v_l = __pyx_t_21;

     4400:

    +4401:                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)

                                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

     4402:

    +4403:                 r[0] = <unsigned char> (rgb_.r * 255.0)

                                  (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

    +4404:                 g[0] = <unsigned char> (rgb_.g * 255.0)

                                  (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

    +4405:                 b[0] = <unsigned char> (rgb_.b * 255.0)

                                  (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4406:

     4407:

     4408:

     4409: @cython.boundscheck(False)

     4410: @cython.wraparound(False)

     4411: @cython.nonecheck(False)

     4412: @cython.cdivision(True)

    +4413: cdef inline void shader_brightness24_exclude_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c *__pyx_optional_args) {
      float __pyx_v_shift_ = ((float)0.0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_brightness24_exclude_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_exclude_inplace_c {
      int __pyx_n;
      float shift_;
      PyObject *color_;
    };

    +4414:         unsigned char [:, :, :] rgb_array_, float shift_=0.0, color_=(0, 0, 0)):

      PyObject *__pyx_v_color_ = ((PyObject *)__pyx_tuple__9);
      Py_ssize_t __pyx_v_width;
      Py_ssize_t __pyx_v_height;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_r;
      unsigned char __pyx_v_g;
      unsigned char __pyx_v_b;
      float __pyx_v_l;
      struct hsl __pyx_v_hsl_;
      struct rgb __pyx_v_rgb_;
      unsigned char __pyx_v_rr;
      unsigned char __pyx_v_gg;
      unsigned char __pyx_v_bb;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_brightness24_exclude_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_shift_ = __pyx_optional_args->shift_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_color_ = __pyx_optional_args->color_;
          }
        }
      }

     4415:     """

     4416:     SHADER BRIGHTNESS (EXCLUDE A SPECIFIC COLOR FROM THE PROCESS, DEFAULT BLACK COLOR)

     4417:

     4418:     This shader control the pygame display brightness level

     4419:     It uses two external functions coded in C, struct_rgb_to_hsl & struct_hsl_to_rgb

     4420:

     4421:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4422:      please refer to pygame function pixels3d or array3d to convert an image into a

     4423:      3d array (library surfarray)

     4424:

     4425:     e.g:

     4426:     brightness_exclude(surface, 0.2)

     4427:

     4428:     :param rgb_array_: numpy ndarray shape (w, h, 3) containing RGB pixels values

     4429:     :param shift_    : float; values in range [-1.0 ... 1.0], 0 no change,

     4430:     -1 lowest brightness, +1 highest brightness

     4431:     :param color_    : tuple; Color to exclude from the brightness process

     4432:     :return          : void

     4433:     """

     4434:

     4435:     cdef Py_ssize_t width, height

    +4436:     width, height = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_width = __pyx_t_2;
      __pyx_v_height = __pyx_t_3;

     4437:

     4438:     cdef:

    +4439:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4440:         unsigned char r

     4441:         unsigned char g

     4442:         unsigned char b

     4443:         float l, h, s

     4444:         hsl hsl_

     4445:         rgb rgb_

     4446:         float high, low, high_

    +4447:         unsigned char rr=color_[0], gg=color_[1], bb=color_[2]

      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rr = __pyx_t_5;
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_gg = __pyx_t_5;
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_color_, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_As_unsigned_char(__pyx_t_4); if (unlikely((__pyx_t_5 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 4447, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_bb = __pyx_t_5;

     4448:

    +4449:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4450:         for j in range(height): #, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_height;
            __pyx_t_2 = __pyx_t_3;
            for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_2; __pyx_t_6+=1) {
              __pyx_v_j = __pyx_t_6;

    +4451:             for i in range(width):

              __pyx_t_7 = __pyx_v_width;
              __pyx_t_8 = __pyx_t_7;
              for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
                __pyx_v_i = __pyx_t_9;

     4452:

    +4453:                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]

                __pyx_t_10 = __pyx_v_i;
                __pyx_t_11 = __pyx_v_j;
                __pyx_t_12 = 0;
                __pyx_t_5 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));
                __pyx_t_12 = __pyx_v_i;
                __pyx_t_11 = __pyx_v_j;
                __pyx_t_10 = 1;
                __pyx_t_13 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
                __pyx_t_10 = __pyx_v_i;
                __pyx_t_11 = __pyx_v_j;
                __pyx_t_12 = 2;
                __pyx_t_14 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));
                __pyx_v_r = __pyx_t_5;
                __pyx_v_g = __pyx_t_13;
                __pyx_v_b = __pyx_t_14;

     4454:

    +4455:                 if not ((r==rr) and (g==gg) and (b==bb)):

                __pyx_t_16 = ((__pyx_v_r == __pyx_v_rr) != 0);
                if (__pyx_t_16) {
                } else {
                  __pyx_t_15 = __pyx_t_16;
                  goto __pyx_L11_bool_binop_done;
                }
                __pyx_t_16 = ((__pyx_v_g == __pyx_v_gg) != 0);
                if (__pyx_t_16) {
                } else {
                  __pyx_t_15 = __pyx_t_16;
                  goto __pyx_L11_bool_binop_done;
                }
                __pyx_t_16 = ((__pyx_v_b == __pyx_v_bb) != 0);
                __pyx_t_15 = __pyx_t_16;
                __pyx_L11_bool_binop_done:;
                __pyx_t_16 = ((!__pyx_t_15) != 0);
                if (__pyx_t_16) {
    /* … */
                }
              }
            }
          }

     4456:

    +4457:                     hsl_ = struct_rgb_to_hsl(

                  __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

     4458:                         r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)

     4459:

    +4460:                     l = min((hsl_.l + shift_), <float>1.0)

                  __pyx_t_17 = ((float)1.0);
                  __pyx_t_18 = (__pyx_v_hsl_.l + __pyx_v_shift_);
                  if (((__pyx_t_17 < __pyx_t_18) != 0)) {
                    __pyx_t_19 = __pyx_t_17;
                  } else {
                    __pyx_t_19 = __pyx_t_18;
                  }
                  __pyx_v_l = __pyx_t_19;

    +4461:                     l = max(l, <float>0.0)

                  __pyx_t_19 = ((float)0.0);
                  __pyx_t_17 = __pyx_v_l;
                  if (((__pyx_t_19 > __pyx_t_17) != 0)) {
                    __pyx_t_18 = __pyx_t_19;
                  } else {
                    __pyx_t_18 = __pyx_t_17;
                  }
                  __pyx_v_l = __pyx_t_18;

     4462:

    +4463:                     rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)

                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

     4464:

    +4465:                     rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0)

                  __pyx_t_12 = __pyx_v_i;
                  __pyx_t_11 = __pyx_v_j;
                  __pyx_t_10 = 0;
                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

    +4466:                     rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0)

                  __pyx_t_10 = __pyx_v_i;
                  __pyx_t_11 = __pyx_v_j;
                  __pyx_t_12 = 1;
                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

    +4467:                     rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0)

                  __pyx_t_12 = __pyx_v_i;
                  __pyx_t_11 = __pyx_v_j;
                  __pyx_t_10 = 2;
                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));

     4468:

     4469:

     4470:

     4471: @cython.boundscheck(False)

     4472: @cython.wraparound(False)

     4473: @cython.nonecheck(False)

     4474: @cython.cdivision(True)

    +4475: cdef inline void shader_brightness24_bpf_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness24_bpf_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c *__pyx_optional_args) {
      float __pyx_v_shift_ = ((float)0.0);
      unsigned char __pyx_v_bpf_treshold_ = ((unsigned char)64);
      Py_ssize_t __pyx_v_width;
      CYTHON_UNUSED Py_ssize_t __pyx_v_height;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char __pyx_v_r;
      unsigned char __pyx_v_g;
      unsigned char __pyx_v_b;
      float __pyx_v_l;
      struct hsl __pyx_v_hsl_;
      struct rgb __pyx_v_rgb_;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_brightness24_bpf_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_shift_ = __pyx_optional_args->shift_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_bpf_treshold_ = __pyx_optional_args->bpf_treshold_;
          }
        }
      }
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_brightness24_bpf_c {
      int __pyx_n;
      float shift_;
      unsigned char bpf_treshold_;
    };

     4476:         unsigned char [:, :, :] rgb_array_,

     4477:         float shift_=0.0,

     4478:         unsigned char bpf_treshold_=64):

     4479:     """

     4480:

     4481:     :param rgb_array_: numpy ndarray shape (w, h, 3) containing RGB pixels values

     4482:     :param shift_    : float; values in range [-1.0 ... 1.0], 0 no change,

     4483:     -1 lowest brightness, +1 highest brightness

     4484:     :param bpf_treshold_ : integer; Bright pass filter threshold value

     4485:     :return          : void

     4486:     """

     4487:

     4488:

     4489:     cdef Py_ssize_t width, height

    +4490:     width, height = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_width = __pyx_t_2;
      __pyx_v_height = __pyx_t_3;

     4491:

     4492:     cdef:

    +4493:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4494:         unsigned char r

     4495:         unsigned char g

     4496:         unsigned char b

     4497:         float l, h, s

     4498:         hsl hsl_

     4499:         rgb rgb_

     4500:         float high, low, high_

     4501:

     4502:

    +4503:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4504:         for j in prange(height, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char)'?');
                                __pyx_v_g = ((unsigned char)'?');
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_l = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char)'?');

    +4505:             for i in range(width):

                                __pyx_t_5 = __pyx_v_width;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_i = __pyx_t_7;

     4506:

    +4507:                 r, g, b = rgb_array_[i, j, 0], rgb_array_[i, j, 1], rgb_array_[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_t_11 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 1;
                                  __pyx_t_12 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )));
                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 2;
                                  __pyx_t_13 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));
                                  __pyx_v_r = __pyx_t_11;
                                  __pyx_v_g = __pyx_t_12;
                                  __pyx_v_b = __pyx_t_13;

     4508:

    +4509:                 if r + g + b < bpf_treshold_:

                                  __pyx_t_14 = ((((__pyx_v_r + __pyx_v_g) + __pyx_v_b) < __pyx_v_bpf_treshold_) != 0);
                                  if (__pyx_t_14) {
    /* … */
                                  }

    +4510:                     continue

                                    goto __pyx_L10_continue;

     4511:

    +4512:                 hsl_ = struct_rgb_to_hsl(

                                  __pyx_v_hsl_ = struct_rgb_to_hsl((__pyx_v_r * ((float)0.00392156862745098)), (__pyx_v_g * ((float)0.00392156862745098)), (__pyx_v_b * ((float)0.00392156862745098)));

     4513:                     r * <float>ONE_255, g * <float>ONE_255, b * <float>ONE_255)

     4514:

    +4515:                 l = min((hsl_.l + shift_), <float>1.0)

                                  __pyx_t_15 = ((float)1.0);
                                  __pyx_t_16 = (__pyx_v_hsl_.l + __pyx_v_shift_);
                                  if (((__pyx_t_15 < __pyx_t_16) != 0)) {
                                    __pyx_t_17 = __pyx_t_15;
                                  } else {
                                    __pyx_t_17 = __pyx_t_16;
                                  }
                                  __pyx_v_l = __pyx_t_17;

    +4516:                 l = max(l, <float>0.0)

                                  __pyx_t_17 = ((float)0.0);
                                  __pyx_t_15 = __pyx_v_l;
                                  if (((__pyx_t_17 > __pyx_t_15) != 0)) {
                                    __pyx_t_16 = __pyx_t_17;
                                  } else {
                                    __pyx_t_16 = __pyx_t_15;
                                  }
                                  __pyx_v_l = __pyx_t_16;

     4517:

    +4518:                 rgb_ = struct_hsl_to_rgb(hsl_.h, hsl_.s, l)

                                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_hsl_.s, __pyx_v_l);

     4519:

    +4520:                 rgb_array_[i, j, 0] = <unsigned char> (rgb_.r * 255.0 )

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.r * 255.0));

    +4521:                 rgb_array_[i, j, 1] = <unsigned char> (rgb_.g * 255.0 )

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.g * 255.0));

    +4522:                 rgb_array_[i, j, 2] = <unsigned char> (rgb_.b * 255.0 )

                                  __pyx_t_10 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_8 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)(__pyx_v_rgb_.b * 255.0));
                                  __pyx_L10_continue:;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4523:

     4524:

     4525:

     4526: @cython.boundscheck(False)

     4527: @cython.wraparound(False)

     4528: @cython.nonecheck(False)

     4529: @cython.cdivision(True)

    +4530: cdef inline void shader_brightness_24_inplace1_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_brightness_24_inplace1_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_shift_, __Pyx_memviewslice __pyx_v_rgb_to_hsl_model) {
      CYTHON_UNUSED Py_ssize_t __pyx_v_width;
      Py_ssize_t __pyx_v_height;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_l;
      float __pyx_v_h;
      float __pyx_v_s;
      struct rgb __pyx_v_rgb_;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_brightness_24_inplace1_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     4531:         unsigned char [:, :, :] rgb_array_, float shift_, float [:, :, :, :] rgb_to_hsl_model):

     4532:     """

     4533:     SHADER BRIGHTNESS USING STORED RGB TO HSL VALUES (SLOWEST VERSION)

     4534:

     4535:     This method is fetching all the HSL values from an array instead

     4536:     In theory this method should be faster than the direct calculation therefore the size of the

     4537:     array degrade the performance somehow.

     4538:

     4539:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4540:     please refer to pygame function pixels3d or array3d to convert an image into a

     4541:     3d array (library surfarray)

     4542:

     4543:     e.g:

     4544:     brightness_model(surface, 0.2 rgb_to_hsl_model)

     4545:

     4546:     :param rgb_array_      : numpy.ndarray containing RGB values array shapes (w, h, 3) uint8

     4547:     :param shift_          : float; value in range[-1.0 ... 1.0]

     4548:     :param rgb_to_hsl_model: Array shape (r, g, b, 3) containing all pre-calculated HSL values

     4549:     :return                : void

     4550:     """

     4551:

     4552:     cdef Py_ssize_t width, height

    +4553:     width, height = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_width = __pyx_t_2;
      __pyx_v_height = __pyx_t_3;

     4554:

     4555:     cdef:

    +4556:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4557:         unsigned char *r

     4558:         unsigned char *g

     4559:         unsigned char *b

     4560:         float l, h, s

     4561:

     4562:         rgb rgb_

     4563:         float high, low, high_

     4564:

    +4565:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     4566:

    +4567:         for i in prange(width, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_h) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_l) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_h = ((float)__PYX_NAN());
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_l = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_s = ((float)__PYX_NAN());

    +4568:             for j in range(height):

                                __pyx_t_5 = __pyx_v_height;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_j = __pyx_t_7;

     4569:

    +4570:                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]

                                  __pyx_t_8 = __pyx_v_i;
                                  __pyx_t_9 = __pyx_v_j;
                                  __pyx_t_10 = 0;
                                  __pyx_t_11 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_8 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_12 = __pyx_v_i;
                                  __pyx_t_13 = __pyx_v_j;
                                  __pyx_t_14 = 1;
                                  __pyx_t_15 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 2;
                                  __pyx_t_19 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_v_r = __pyx_t_11;
                                  __pyx_v_g = __pyx_t_15;
                                  __pyx_v_b = __pyx_t_19;

     4571:

    +4572:                 h = rgb_to_hsl_model[r[0], g[0], b[0], 0]

                                  __pyx_t_20 = (__pyx_v_r[0]);
                                  __pyx_t_21 = (__pyx_v_g[0]);
                                  __pyx_t_22 = (__pyx_v_b[0]);
                                  __pyx_t_18 = 0;
                                  __pyx_v_h = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

    +4573:                 s = rgb_to_hsl_model[r[0], g[0], b[0], 1]

                                  __pyx_t_22 = (__pyx_v_r[0]);
                                  __pyx_t_21 = (__pyx_v_g[0]);
                                  __pyx_t_20 = (__pyx_v_b[0]);
                                  __pyx_t_18 = 1;
                                  __pyx_v_s = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

    +4574:                 l = rgb_to_hsl_model[r[0], g[0], b[0], 2]

                                  __pyx_t_20 = (__pyx_v_r[0]);
                                  __pyx_t_21 = (__pyx_v_g[0]);
                                  __pyx_t_22 = (__pyx_v_b[0]);
                                  __pyx_t_18 = 2;
                                  __pyx_v_l = (*((float *) ( /* dim=3 */ (( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_to_hsl_model.data + __pyx_t_20 * __pyx_v_rgb_to_hsl_model.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_to_hsl_model.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_to_hsl_model.strides[2]) ) + __pyx_t_18 * __pyx_v_rgb_to_hsl_model.strides[3]) )));

     4575:

    +4576:                 l = min((l + shift_), <float>1.0)

                                  __pyx_t_23 = ((float)1.0);
                                  __pyx_t_24 = (__pyx_v_l + __pyx_v_shift_);
                                  if (((__pyx_t_23 < __pyx_t_24) != 0)) {
                                    __pyx_t_25 = __pyx_t_23;
                                  } else {
                                    __pyx_t_25 = __pyx_t_24;
                                  }
                                  __pyx_v_l = __pyx_t_25;

    +4577:                 l = max(l, <float>0.0)

                                  __pyx_t_25 = ((float)0.0);
                                  __pyx_t_23 = __pyx_v_l;
                                  if (((__pyx_t_25 > __pyx_t_23) != 0)) {
                                    __pyx_t_24 = __pyx_t_25;
                                  } else {
                                    __pyx_t_24 = __pyx_t_23;
                                  }
                                  __pyx_v_l = __pyx_t_24;

     4578:

    +4579:                 rgb_ = struct_hsl_to_rgb(h, s, l)

                                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_h, __pyx_v_s, __pyx_v_l);

    +4580:                 r[0] = <unsigned char> (rgb_.r * <float>255.0)

                                  (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

    +4581:                 g[0] = <unsigned char> (rgb_.g * <float>255.0)

                                  (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

    +4582:                 b[0] = <unsigned char> (rgb_.b * <float>255.0)

                                  (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4583:

     4584:

     4585:

     4586:

     4587: @cython.boundscheck(False)

     4588: @cython.wraparound(False)

     4589: @cython.nonecheck(False)

     4590: @cython.cdivision(True)

    +4591: cdef inline void shader_saturation_array24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_saturation_array24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_shift_) {
      Py_ssize_t __pyx_v_width;
      CYTHON_UNUSED Py_ssize_t __pyx_v_height;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_s;
      struct hsl __pyx_v_hsl_;
      struct rgb __pyx_v_rgb_;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_saturation_array24_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_WriteUnraisable("PygameShader.shader.shader_saturation_array24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

     4592:         unsigned char [:, :, :] rgb_array_, float shift_):

     4593:     """

     4594:     SHADER SATURATION

     4595:

     4596:     This shader control the saturation level of the pygame display or surface/texture

     4597:

     4598:     The Array (rgb_array) must be a numpy array shape (w, h, 3)

     4599:     containing RGB pixels, please refer to pygame

     4600:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     4601:

     4602:     e.g:

     4603:     saturation(surface, 0.2)

     4604:

     4605:     :param rgb_array_: numpy.ndarray shape (w, h, 3) containing RGB values uint8

     4606:     :param shift_    : float; value in range[-1.0...1.0], control the saturation level

     4607:     :return          : void

     4608:     """

     4609:

    +4610:     assert -1.0 <= shift_ <= 1.0, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (-1.0 <= __pyx_v_shift_);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_shift_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_shift_must_be_in_range);
          __PYX_ERR(1, 4610, __pyx_L1_error)
        }
      }
      #endif

     4611:         "Argument shift must be in range[-1.0 ... 1.0]"

     4612:

     4613:     cdef Py_ssize_t width, height

    +4614:     width, height = rgb_array_.shape[:2]

      __pyx_t_2 = __pyx_v_rgb_array_.shape;
      __pyx_t_3 = (__pyx_t_2[0]);
      __pyx_t_4 = (__pyx_t_2[1]);
      __pyx_v_width = __pyx_t_3;
      __pyx_v_height = __pyx_t_4;

     4615:

     4616:     cdef:

    +4617:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4618:         unsigned char *r

     4619:         unsigned char *g

     4620:         unsigned char *b

     4621:         float s

     4622:         hsl hsl_

     4623:         rgb rgb_

     4624:

     4625:

    +4626:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4627:         for j in prange(height, schedule='static', num_threads=THREADS):

            __pyx_t_4 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static)
    /* … */
            __pyx_t_4 = __pyx_v_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_hsl_) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_s = ((float)__PYX_NAN());

    +4628:             for i in range(width):

                                __pyx_t_6 = __pyx_v_width;
                                __pyx_t_7 = __pyx_t_6;
                                for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                                  __pyx_v_i = __pyx_t_8;

    +4629:                 r, g, b = &rgb_array_[i, j, 0], &rgb_array_[i, j, 1], &rgb_array_[i, j, 2]

                                  __pyx_t_9 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_11 = 0;
                                  __pyx_t_12 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_13 = __pyx_v_i;
                                  __pyx_t_14 = __pyx_v_j;
                                  __pyx_t_15 = 1;
                                  __pyx_t_16 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_t_17 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_19 = 2;
                                  __pyx_t_20 = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_.strides[2]) ))));
                                  __pyx_v_r = __pyx_t_12;
                                  __pyx_v_g = __pyx_t_16;
                                  __pyx_v_b = __pyx_t_20;

    +4630:                 hsl_ = struct_rgb_to_hsl(<float>r[0] * <float>ONE_255,

                                  __pyx_v_hsl_ = struct_rgb_to_hsl((((float)(__pyx_v_r[0])) * ((float)0.00392156862745098)), (((float)(__pyx_v_g[0])) * ((float)0.00392156862745098)), (((float)(__pyx_v_b[0])) * ((float)0.00392156862745098)));

     4631:                                          <float>g[0] * <float>ONE_255,

     4632:                                          <float>b[0] * <float>ONE_255)

     4633:

    +4634:                 s = min((hsl_.s + shift_), <float>0.5)

                                  __pyx_t_21 = ((float)0.5);
                                  __pyx_t_22 = (__pyx_v_hsl_.s + __pyx_v_shift_);
                                  if (((__pyx_t_21 < __pyx_t_22) != 0)) {
                                    __pyx_t_23 = __pyx_t_21;
                                  } else {
                                    __pyx_t_23 = __pyx_t_22;
                                  }
                                  __pyx_v_s = __pyx_t_23;

    +4635:                 s = max(s, <float>0.0)

                                  __pyx_t_23 = ((float)0.0);
                                  __pyx_t_21 = __pyx_v_s;
                                  if (((__pyx_t_23 > __pyx_t_21) != 0)) {
                                    __pyx_t_22 = __pyx_t_23;
                                  } else {
                                    __pyx_t_22 = __pyx_t_21;
                                  }
                                  __pyx_v_s = __pyx_t_22;

    +4636:                 rgb_ = struct_hsl_to_rgb(hsl_.h, s, hsl_.l)

                                  __pyx_v_rgb_ = struct_hsl_to_rgb(__pyx_v_hsl_.h, __pyx_v_s, __pyx_v_hsl_.l);

    +4637:                 r[0] = <unsigned char>(rgb_.r * <float>255.0)

                                  (__pyx_v_r[0]) = ((unsigned char)(__pyx_v_rgb_.r * ((float)255.0)));

    +4638:                 g[0] = <unsigned char>(rgb_.g * <float>255.0)

                                  (__pyx_v_g[0]) = ((unsigned char)(__pyx_v_rgb_.g * ((float)255.0)));

    +4639:                 b[0] = <unsigned char>(rgb_.b * <float>255.0)

                                  (__pyx_v_b[0]) = ((unsigned char)(__pyx_v_rgb_.b * ((float)255.0)));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4640:

     4641:

     4642:

     4643:

     4644:

     4645: @cython.boundscheck(False)

     4646: @cython.wraparound(False)

     4647: @cython.nonecheck(False)

     4648: @cython.cdivision(True)

     4649: # e.g

     4650: # heatwave_vertical(

     4651: #         surface_, numpy.full((w, h), 255, dtype=numpy.uint8),

     4652: #         b*random.uniform(55.0, 100), 0, sigma_=random.uniform(0.4, 1), mu_=b*2)

    +4653: cdef inline void shader_heatwave24_vertical_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_heatwave24_vertical_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_mask, float __pyx_v_amplitude_, float __pyx_v_center_, float __pyx_v_sigma_, float __pyx_v_mu_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_yy;
      int __pyx_v_h_1;
      __Pyx_memviewslice __pyx_v_f_gauss = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_heatwave24_vertical_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_heatwave24_vertical_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_f_gauss, 1);
      __Pyx_RefNannyFinishContext();
    }

     4654:         unsigned char [:, :, :] rgb_array_,

     4655:         unsigned char [:, :] mask,

     4656:         float amplitude_,

     4657:         float center_,

     4658:         float sigma_,

     4659:         float mu_):

     4660:     """

     4661:     APPLY A GAUSSIAN TRANSFORMATION TO AN ARRAY

     4662:

     4663:     This effect can be use for simulate air turbulence or heat flow/convection

     4664:

     4665:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels, please refer to pygame

     4666:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     4667:

     4668:

     4669:     :param rgb_array_: numpy.ndarray shape (width, height, 3) uint8 containing RGB pixels

     4670:     :param mask      : numpy.ndarray shape (x, y) uint8, (values 255 or 0).

     4671:     Apply transformation to the original array

     4672:     if the value @(x, y) is 255 else remain unchanged.

     4673:     :param amplitude_: Control the maximum of the gaussian equation.

     4674:     No transformation if factor_ equal zero

     4675:     :param center_   : Control the center of the gaussian equation (if center_ equal zero,

     4676:      the Gauss equation is centered

     4677:     at x=0 and maximum is 0.4 with amplitude_ = 1.0)

     4678:     :param sigma_    : float; sigma value of the gauss equation

     4679:     :param mu_       : float; mu value of the gauss equation

     4680:     :return          : void

     4681:     """

     4682:     # TODO MASK

     4683:

     4684:     cdef Py_ssize_t w, h

    +4685:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     4686:

     4687:     cdef:

    +4688:         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=False)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(1, 4688, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4688, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +4689:         int x = 0, y = 0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     4690:         int yy

    +4691:         int h_1 = <int>h - 1

      __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

     4692:         unsigned char *r

    +4693:         float [::1] f_gauss = linspace(-4, 4, w, dtype=float32)

      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_linspace); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_neg_4);
      __Pyx_GIVEREF(__pyx_int_neg_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_4);
      __Pyx_INCREF(__pyx_int_4);
      __Pyx_GIVEREF(__pyx_int_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_float(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 4693, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_f_gauss = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     4694:

     4695:

    +4696:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     4697:

    +4698:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_10; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_yy = ((int)0xbad0bad0);

     4699:

    +4700:             for y in range(h):

                                __pyx_t_11 = __pyx_v_h;
                                __pyx_t_12 = __pyx_t_11;
                                for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                                  __pyx_v_y = __pyx_t_13;

     4701:

    +4702:                 yy =<int>(gauss(f_gauss[x], center_, sigma_, mu_) * amplitude_ + y)

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_16.__pyx_n = 2;
                                  __pyx_t_16.sigma = __pyx_v_sigma_;
                                  __pyx_t_16.mu = __pyx_v_mu_;
                                  __pyx_t_15 = __pyx_f_12PygameShader_6shader_gauss((*((float *) ( /* dim=0 */ ((char *) (((float *) __pyx_v_f_gauss.data) + __pyx_t_14)) ))), __pyx_v_center_, &__pyx_t_16);
                                  __pyx_v_yy = ((int)((__pyx_t_15 * __pyx_v_amplitude_) + __pyx_v_y));

     4703:

     4704:                 # printf("\n %i ", yy)

    +4705:                 if yy > h_1:

                                  __pyx_t_17 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                  if (__pyx_t_17) {
    /* … */
                                  }

    +4706:                     yy = h_1

                                    __pyx_v_yy = __pyx_v_h_1;

     4707:

    +4708:                 if yy < 0:

                                  __pyx_t_17 = ((__pyx_v_yy < 0) != 0);
                                  if (__pyx_t_17) {
    /* … */
                                  }

    +4709:                     yy = 0

                                    __pyx_v_yy = 0;

     4710:

    +4711:                 rgb_array_[x, y, 0] = rgb_array_copy[x, yy, 0]

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_18 = __pyx_v_yy;
                                  __pyx_t_19 = 0;
                                  __pyx_t_20 = __pyx_v_x;
                                  __pyx_t_21 = __pyx_v_y;
                                  __pyx_t_22 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_20 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[2]) )));

    +4712:                 rgb_array_[x, y, 1] = rgb_array_copy[x, yy, 1]

                                  __pyx_t_19 = __pyx_v_x;
                                  __pyx_t_18 = __pyx_v_yy;
                                  __pyx_t_14 = 1;
                                  __pyx_t_22 = __pyx_v_x;
                                  __pyx_t_21 = __pyx_v_y;
                                  __pyx_t_20 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_20 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[2]) )));

    +4713:                 rgb_array_[x, y, 2] = rgb_array_copy[x, yy, 2]

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_18 = __pyx_v_yy;
                                  __pyx_t_19 = 2;
                                  __pyx_t_20 = __pyx_v_x;
                                  __pyx_t_21 = __pyx_v_y;
                                  __pyx_t_22 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_20 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_21 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_18 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_19 * __pyx_v_rgb_array_copy.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4714:

     4715:

     4716:

     4717:

     4718: @cython.boundscheck(False)

     4719: @cython.wraparound(False)

     4720: @cython.nonecheck(False)

     4721: @cython.cdivision(False)

     4722: # e.g horizontal_glitch(surface, 0.5, 0.08, frame % 20)

    +4723: cdef inline void shader_horizontal_glitch24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_horizontal_glitch24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_rad1_, float __pyx_v_frequency_, float __pyx_v_amplitude_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_rad;
      float __pyx_v_angle;
      float __pyx_v_angle1;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_ii;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_horizontal_glitch24_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_horizontal_glitch24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_RefNannyFinishContext();
    }

     4724:         unsigned char [:, :, :] rgb_array_,

     4725:         float rad1_,

     4726:         float frequency_,

     4727:         float amplitude_):

     4728:

     4729:     """

     4730:     SHADER GLITCH EFFECT

     4731:

     4732:     Deform the pygame display to create a glitch appearance

     4733:

     4734:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4735:     please refer to pygame function pixels3d or array3d to convert an image into a

     4736:     3d array (library surfarray)

     4737:

     4738:     :param rgb_array_: numpy.ndarray shape (w, h, 3) uint8 containing RGB pixels

     4739:     :param rad1_     : float; Angle in radians, this value control the angle variation over the time

     4740:     :param frequency_:  float; signal frequency, factor that amplify the angle variation

     4741:     :param amplitude_: float; cos amplitude value

     4742:     :return:

     4743:     """

     4744:     cdef Py_ssize_t w, h

    +4745:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     4746:

     4747:     cdef:

    +4748:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +4749:         float rad = <float>(3.14/180.0)

      __pyx_v_rad = ((float)(3.14 / 180.0));

    +4750:         float angle = 0

      __pyx_v_angle = 0.0;

    +4751:         float angle1 = 0

      __pyx_v_angle1 = 0.0;

    +4752:         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 4752, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 4752, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +4753:         int ii=0

      __pyx_v_ii = 0;

     4754:

    +4755:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L4_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L5:;
          }
      }

     4756:

    +4757:         for j in range(h):

            __pyx_t_3 = __pyx_v_h;
            __pyx_t_2 = __pyx_t_3;
            for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_2; __pyx_t_9+=1) {
              __pyx_v_j = __pyx_t_9;

     4758:

    +4759:             for i in range(w):

              __pyx_t_10 = __pyx_v_w;
              __pyx_t_11 = __pyx_t_10;
              for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                __pyx_v_i = __pyx_t_12;

     4760:

    +4761:                 ii = (i + <int>(<float>cos(angle) * amplitude_))

                __pyx_v_ii = (__pyx_v_i + ((int)(((float)cos(__pyx_v_angle)) * __pyx_v_amplitude_)));

    +4762:                 if ii > <int>w - 1:

                __pyx_t_13 = ((__pyx_v_ii > (((int)__pyx_v_w) - 1)) != 0);
                if (__pyx_t_13) {
    /* … */
                }

    +4763:                     ii = <int>w - 1

                  __pyx_v_ii = (((int)__pyx_v_w) - 1);

    +4764:                 if ii < 0:

                __pyx_t_13 = ((__pyx_v_ii < 0) != 0);
                if (__pyx_t_13) {
    /* … */
                }

    +4765:                     ii = 0

                  __pyx_v_ii = 0;

     4766:

    +4767:                 rgb_array_[i, j, 0],\

                __pyx_t_16 = __pyx_v_i;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_14 = 0;
                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_17;

    +4768:                 rgb_array_[i, j, 1],\

                __pyx_t_14 = __pyx_v_i;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_16 = 1;
                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_18;

    +4769:                 rgb_array_[i, j, 2] = rgb_array_copy[ii, j, 0],\

                __pyx_t_14 = __pyx_v_ii;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_16 = 0;
                __pyx_t_17 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[2]) )));
    /* … */
                __pyx_t_16 = __pyx_v_i;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_14 = 2;
                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_t_19;
              }

    +4770:                     rgb_array_copy[ii, j, 1], rgb_array_copy[ii, j, 2]

                __pyx_t_16 = __pyx_v_ii;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_14 = 1;
                __pyx_t_18 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[2]) )));
                __pyx_t_14 = __pyx_v_ii;
                __pyx_t_15 = __pyx_v_j;
                __pyx_t_16 = 2;
                __pyx_t_19 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[2]) )));

     4771:

    +4772:             angle1 = angle1 + frequency_ * rad

              __pyx_v_angle1 = (__pyx_v_angle1 + (__pyx_v_frequency_ * __pyx_v_rad));

    +4773:             angle = angle + (rad1_ * rad + rand() % angle1 - rand() % angle1)

              __pyx_t_12 = rand();
              if (unlikely(__pyx_v_angle1 == 0)) {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                #endif
                PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
                #ifdef WITH_THREAD
                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                #endif
                __PYX_ERR(1, 4773, __pyx_L4_error)
              }
              __pyx_t_20 = rand();
              if (unlikely(__pyx_v_angle1 == 0)) {
                #ifdef WITH_THREAD
                PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                #endif
                PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
                #ifdef WITH_THREAD
                __Pyx_PyGILState_Release(__pyx_gilstate_save);
                #endif
                __PYX_ERR(1, 4773, __pyx_L4_error)
              }
              __pyx_v_angle = (__pyx_v_angle + (((__pyx_v_rad1_ * __pyx_v_rad) + __Pyx_mod_float(__pyx_t_12, __pyx_v_angle1)) - __Pyx_mod_float(__pyx_t_20, __pyx_v_angle1)));
            }
          }

     4774:

     4775:

     4776:

     4777:

     4778: @cython.boundscheck(False)

     4779: @cython.wraparound(False)

     4780: @cython.nonecheck(False)

     4781: @cython.cdivision(True)

    +4782: cdef inline void shader_bpf24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bpf24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c *__pyx_optional_args) {
      int __pyx_v_threshold = ((int)0x80);
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_lum;
      float __pyx_v_c;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_bpf24_inplace_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold = __pyx_optional_args->threshold;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_WriteUnraisable("PygameShader.shader.shader_bpf24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_bpf24_inplace_c {
      int __pyx_n;
      int threshold;
      int transpose;
    };

     4783:         unsigned char [:, :, :] rgb_array_, int threshold = 128, bint transpose=False):

     4784:     """

     4785:     SHADER BRIGHT PASS FILTER (INPLACE)

     4786:

     4787:     Conserve only the brightest pixels in an array

     4788:

     4789:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4790:      please refer to pygame function pixels3d or array3d to convert an image into a

     4791:      3d array (library surfarray)

     4792:

     4793:     :param rgb_array_: numpy.ndarray shape (w, h, 3) uint8 containing RGB pixels

     4794:     :param threshold : integer; Bright pass threshold default 128

     4795:     :param transpose : bool; True| False transpose the final array

     4796:     :return          :  void

     4797:     """

     4798:

    +4799:     assert 0 <= threshold <= 255, "Argument threshold must be in range [0 ... 255]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (0 <= __pyx_v_threshold);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_threshold <= 0xFF);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
          __PYX_ERR(1, 4799, __pyx_L1_error)
        }
      }
      #endif

     4800:

     4801:     cdef:

     4802:         Py_ssize_t w, h

    +4803:     w, h = rgb_array_.shape[:2]

      __pyx_t_2 = __pyx_v_rgb_array_.shape;
      __pyx_t_3 = (__pyx_t_2[0]);
      __pyx_t_4 = (__pyx_t_2[1]);
      __pyx_v_w = __pyx_t_3;
      __pyx_v_h = __pyx_t_4;

     4804:

     4805:     cdef:

    +4806:         int i = 0, j = 0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4807:         float lum, c

     4808:         unsigned char *r

     4809:         unsigned char *g

     4810:         unsigned char *b

     4811:

    +4812:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4813:         for j in prange(0, h, schedule='static', num_threads=THREADS):

            __pyx_t_4 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_4 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_c = ((float)__PYX_NAN());
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_lum = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char *)1);

    +4814:             for i in range(0, w):

                                __pyx_t_6 = __pyx_v_w;
                                __pyx_t_7 = __pyx_t_6;
                                for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                                  __pyx_v_i = __pyx_t_8;

     4815:

     4816:                 # ITU-R BT.601 luma coefficients

    +4817:                 r = &rgb_array_[i, j, 0]

                                  __pyx_t_9 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_11 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));

    +4818:                 g = &rgb_array_[i, j, 1]

                                  __pyx_t_11 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_9 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_11 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_rgb_array_.strides[2]) ))));

    +4819:                 b = &rgb_array_[i, j, 2]

                                  __pyx_t_9 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_11 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_9 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[2]) ))));

     4820:

    +4821:                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114

                                  __pyx_v_lum = ((((__pyx_v_r[0]) * ((float)0.299)) + ((__pyx_v_g[0]) * ((float)0.587))) + ((__pyx_v_b[0]) * ((float)0.114)));

     4822:

    +4823:                 if lum > threshold:

                                  __pyx_t_1 = ((__pyx_v_lum > __pyx_v_threshold) != 0);
                                  if (__pyx_t_1) {
    /* … */
                                    goto __pyx_L12;
                                  }

    +4824:                     c = (lum - threshold) / lum

                                    __pyx_v_c = ((__pyx_v_lum - __pyx_v_threshold) / __pyx_v_lum);

    +4825:                     r[0] = <unsigned char>(r[0] * c)

                                    (__pyx_v_r[0]) = ((unsigned char)((__pyx_v_r[0]) * __pyx_v_c));

    +4826:                     g[0] = <unsigned char>(g[0] * c)

                                    (__pyx_v_g[0]) = ((unsigned char)((__pyx_v_g[0]) * __pyx_v_c));

    +4827:                     b[0] = <unsigned char>(b[0] * c)

                                    (__pyx_v_b[0]) = ((unsigned char)((__pyx_v_b[0]) * __pyx_v_c));

     4828:                 else:

    +4829:                     r[0], g[0], b[0] = 0, 0, 0

                                  /*else*/ {
                                    __pyx_t_12 = 0;
                                    __pyx_t_13 = 0;
                                    __pyx_t_14 = 0;
                                    (__pyx_v_r[0]) = __pyx_t_12;
                                    (__pyx_v_g[0]) = __pyx_t_13;
                                    (__pyx_v_b[0]) = __pyx_t_14;
                                  }
                                  __pyx_L12:;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     4830:

     4831:

     4832:

     4833: @cython.boundscheck(False)

     4834: @cython.wraparound(False)

     4835: @cython.nonecheck(False)

     4836: @cython.cdivision(True)

    +4837: cdef inline bpf24_c(

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_bpf24_c(__Pyx_memviewslice __pyx_v_input_array_, struct __pyx_opt_args_12PygameShader_6shader_bpf24_c *__pyx_optional_args) {
      int __pyx_v_threshold = ((int)0x80);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_lum;
      float __pyx_v_c;
      __Pyx_memviewslice __pyx_v_output_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bpf24_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_threshold = __pyx_optional_args->threshold;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_11);
      __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
      __Pyx_AddTraceback("PygameShader.shader.bpf24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_output_array_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +4838:         unsigned char [:, :, :] input_array_,

    struct __pyx_opt_args_12PygameShader_6shader_bpf24_c {
      int __pyx_n;
      int threshold;
      int transpose;
    };

     4839:         int threshold = 128,

     4840:         bint transpose=False):

     4841:     """

     4842:     SHADER BRIGHT PASS FILTER

     4843:

     4844:     Conserve only the brightest pixels in an array

     4845:

     4846:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     4847:     please refer to pygame function pixels3d or array3d to convert an image into a

     4848:     3d array (library surfarray)

     4849:

     4850:     :param input_array_: numpy.ndarray shape (w, h, 3) uint8 containing RGB pixels

     4851:     :param threshold   : float Bright pass threshold default 128

     4852:     :param transpose   : bool; True| False transpose the final array

     4853:     :return            :  Return the modified array shape (w, h, 3) uint8

     4854:     """

    +4855:     assert 0 <= threshold <= 255, "Argument threshold must be in range [0 ... 255]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (0 <= __pyx_v_threshold);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_threshold <= 0xFF);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
          __PYX_ERR(1, 4855, __pyx_L1_error)
        }
      }
      #endif

     4856:

     4857:     cdef:

     4858:         Py_ssize_t w, h

    +4859:     w, h = input_array_.shape[:2]

      __pyx_t_2 = __pyx_v_input_array_.shape;
      __pyx_t_3 = (__pyx_t_2[0]);
      __pyx_t_4 = (__pyx_t_2[1]);
      __pyx_v_w = __pyx_t_3;
      __pyx_v_h = __pyx_t_4;

     4860:

     4861:     cdef:

    +4862:         int i = 0, j = 0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

     4863:         float lum, c

    +4864:         unsigned char [:, :, :] output_array_ = numpy.zeros((h, w, 3), uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_numpy); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_6 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_9, __pyx_t_8};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_9, __pyx_t_8};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4864, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8);
        __pyx_t_9 = 0;
        __pyx_t_8 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4864, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(1, 4864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_output_array_ = __pyx_t_12;
      __pyx_t_12.memview = NULL;
      __pyx_t_12.data = NULL;

     4865:         unsigned char *r

     4866:         unsigned char *g

     4867:         unsigned char *b

     4868:

    +4869:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +4870:         for j in prange(0, h, schedule='static', num_threads=THREADS):

            __pyx_t_4 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_13 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_13 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_4 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_13 = (__pyx_t_4 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_13 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_lum) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_13; __pyx_t_3++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_3);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_c = ((float)__PYX_NAN());
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_lum = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char *)1);

    +4871:             for i in range(0, w):

                                __pyx_t_14 = __pyx_v_w;
                                __pyx_t_15 = __pyx_t_14;
                                for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_15; __pyx_t_10+=1) {
                                  __pyx_v_i = __pyx_t_10;

     4872:

     4873:                 # ITU-R BT.601 luma coefficients

    +4874:                 r = &input_array_[i, j, 0]

                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_16 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_input_array_.strides[2]) ))));

    +4875:                 g = &input_array_[i, j, 1]

                                  __pyx_t_18 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_16 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_18 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_input_array_.strides[2]) ))));

    +4876:                 b = &input_array_[i, j, 2]

                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_input_array_.data + __pyx_t_16 * __pyx_v_input_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_input_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_input_array_.strides[2]) ))));

     4877:

    +4878:                 lum = r[0] * <float>0.299 + g[0] * <float>0.587 + b[0] * <float>0.114

                                  __pyx_v_lum = ((((__pyx_v_r[0]) * ((float)0.299)) + ((__pyx_v_g[0]) * ((float)0.587))) + ((__pyx_v_b[0]) * ((float)0.114)));

     4879:

    +4880:                 if lum > threshold:

                                  __pyx_t_1 = ((__pyx_v_lum > __pyx_v_threshold) != 0);
                                  if (__pyx_t_1) {
    /* … */
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +4881:                     c = (lum - threshold) / lum

                                    __pyx_v_c = ((__pyx_v_lum - __pyx_v_threshold) / __pyx_v_lum);

    +4882:                     output_array_[j, i, 0] = <unsigned char>(r[0] * c)

                                    __pyx_t_18 = __pyx_v_j;
                                    __pyx_t_17 = __pyx_v_i;
                                    __pyx_t_16 = 0;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_18 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_r[0]) * __pyx_v_c));

    +4883:                     output_array_[j, i, 1] = <unsigned char>(g[0] * c)

                                    __pyx_t_16 = __pyx_v_j;
                                    __pyx_t_17 = __pyx_v_i;
                                    __pyx_t_18 = 1;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_16 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_g[0]) * __pyx_v_c));

    +4884:                     output_array_[j, i, 2] = <unsigned char>(b[0] * c)

                                    __pyx_t_18 = __pyx_v_j;
                                    __pyx_t_17 = __pyx_v_i;
                                    __pyx_t_16 = 2;
                                    *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_output_array_.data + __pyx_t_18 * __pyx_v_output_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_output_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_output_array_.strides[2]) )) = ((unsigned char)((__pyx_v_b[0]) * __pyx_v_c));

     4885:

    +4886:     return pygame.image.frombuffer(output_array_, (w, h), 'RGB')

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_image); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_output_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 4886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_9);
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_11, __pyx_t_6, __pyx_n_s_RGB};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[4] = {__pyx_t_9, __pyx_t_11, __pyx_t_6, __pyx_n_s_RGB};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_10, 3+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 4886, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_10, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_10, __pyx_t_6);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_10, __pyx_n_s_RGB);
        __pyx_t_11 = 0;
        __pyx_t_6 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4886, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

     4887:

     4888:

     4889:

     4890: @cython.boundscheck(False)

     4891: @cython.wraparound(False)

     4892: @cython.nonecheck(False)

     4893: @cython.cdivision(True)

    +4894: cdef inline void shader_bloom_effect_array24_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(PyObject *__pyx_v_surface_, int __pyx_v_threshold_, struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c *__pyx_optional_args) {
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_bloom_effect_array24_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_surface_cp);
      __Pyx_XDECREF(__pyx_v_s2);
      __Pyx_XDECREF(__pyx_v_s2_array);
      __Pyx_XDECREF(__pyx_v_b2_blurred);
      __Pyx_XDECREF(__pyx_v_s4);
      __Pyx_XDECREF(__pyx_v_s4_array);
      __Pyx_XDECREF(__pyx_v_b4_blurred);
      __Pyx_XDECREF(__pyx_v_s8);
      __Pyx_XDECREF(__pyx_v_s8_array);
      __Pyx_XDECREF(__pyx_v_b8_blurred);
      __Pyx_XDECREF(__pyx_v_s16);
      __Pyx_XDECREF(__pyx_v_s16_array);
      __Pyx_XDECREF(__pyx_v_b16_blurred);
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_shader_bloom_effect_array24_c {
      int __pyx_n;
      int fast_;
    };

     4895:         surface_,

     4896:         int threshold_,

    +4897:         bint fast_ = False):

      int __pyx_v_fast_ = ((int)0);
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      CYTHON_UNUSED int __pyx_v_bit_size;
      int __pyx_v_w2;
      int __pyx_v_h2;
      int __pyx_v_w4;
      int __pyx_v_h4;
      int __pyx_v_w8;
      int __pyx_v_h8;
      int __pyx_v_w16;
      int __pyx_v_h16;
      int __pyx_v_x2;
      int __pyx_v_x4;
      int __pyx_v_x8;
      int __pyx_v_x16;
      PyObject *__pyx_v_surface_cp = NULL;
      PyObject *__pyx_v_s2 = NULL;
      PyObject *__pyx_v_s2_array = NULL;
      PyObject *__pyx_v_b2_blurred = NULL;
      PyObject *__pyx_v_s4 = NULL;
      PyObject *__pyx_v_s4_array = NULL;
      PyObject *__pyx_v_b4_blurred = NULL;
      PyObject *__pyx_v_s8 = NULL;
      PyObject *__pyx_v_s8_array = NULL;
      PyObject *__pyx_v_b8_blurred = NULL;
      PyObject *__pyx_v_s16 = NULL;
      PyObject *__pyx_v_s16_array = NULL;
      PyObject *__pyx_v_b16_blurred = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_bloom_effect_array24_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_fast_ = __pyx_optional_args->fast_;
        }
      }

     4898:     """

     4899:     CREATE A BLOOM EFFECT

     4900:

     4901:     * Surface must be a pygame Surface 24-32 bit format

     4902:

     4903:     :param surface_     : pygame.Surface; Game display or texture

     4904:     :param threshold_   : integer; Threshold value uint8 in range [0 ... 255].

     4905:     The threshold value is used by a bright

     4906:      pass filter to determine the bright pixels above the given threshold.

     4907:       Below 128 the bloom effect will be more

     4908:      noticeable and above 128 a bit less.

     4909:     :param fast_        : bool; True | False; If True the bloom effect will be approximated

     4910:     and only the x16 subsurface

     4911:     will be processed to maximize the overall processing time, default is False).

     4912:     :return             : void

     4913:     """

     4914:

    +4915:     assert 0 <= threshold_ <= 255, "Argument threshold must be in range [0 ... 255]"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (0 <= __pyx_v_threshold_);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_threshold_ <= 0xFF);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_threshold_must_be_in_ra);
          __PYX_ERR(1, 4915, __pyx_L1_error)
        }
      }
      #endif

     4916:

     4917:     cdef:

     4918:         Py_ssize_t  w, h

     4919:         int bit_size

     4920:         int w2, h2, w4, h4, w8, h8, w16, h16

    +4921:         bint x2, x4, x8, x16 = False

      __pyx_v_x16 = 0;

     4922:

    +4923:     w, h = surface_.get_size()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 4923, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4923, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4923, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4923, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(1, 4923, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 4923, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4923, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 4923, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_w = __pyx_t_7;
      __pyx_v_h = __pyx_t_8;

    +4924:     bit_size = surface_.get_bitsize()

      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 4924, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_bit_size = __pyx_t_9;

     4925:

    +4926:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L7:;
          }
      }

    +4927:         w2, h2   = <int>w >> 1, <int>h >> 1

            __pyx_t_10 = (((int)__pyx_v_w) >> 1);
            __pyx_t_11 = (((int)__pyx_v_h) >> 1);
            __pyx_v_w2 = __pyx_t_10;
            __pyx_v_h2 = __pyx_t_11;

    +4928:         w4, h4   = w2 >> 1, h2 >> 1

            __pyx_t_11 = (__pyx_v_w2 >> 1);
            __pyx_t_10 = (__pyx_v_h2 >> 1);
            __pyx_v_w4 = __pyx_t_11;
            __pyx_v_h4 = __pyx_t_10;

    +4929:         w8, h8   = w4 >> 1, h4 >> 1

            __pyx_t_10 = (__pyx_v_w4 >> 1);
            __pyx_t_11 = (__pyx_v_h4 >> 1);
            __pyx_v_w8 = __pyx_t_10;
            __pyx_v_h8 = __pyx_t_11;

    +4930:         w16, h16 = w8 >> 1, h8 >> 1

            __pyx_t_11 = (__pyx_v_w8 >> 1);
            __pyx_t_10 = (__pyx_v_h8 >> 1);
            __pyx_v_w16 = __pyx_t_11;
            __pyx_v_h16 = __pyx_t_10;
          }

     4931:

    +4932:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L10;
            }
            __pyx_L10:;
          }
      }

    +4933:         if w2 > 0 and h2 > 0:

            __pyx_t_12 = ((__pyx_v_w2 > 0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_1 = __pyx_t_12;
              goto __pyx_L12_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_h2 > 0) != 0);
            __pyx_t_1 = __pyx_t_12;
            __pyx_L12_bool_binop_done:;
            if (__pyx_t_1) {
    /* … */
              goto __pyx_L11;
            }

    +4934:             x2 = True

              __pyx_v_x2 = 1;

     4935:         else:

    +4936:             x2 = False

            /*else*/ {
              __pyx_v_x2 = 0;
            }
            __pyx_L11:;

     4937:

    +4938:         if w4 > 0 and h4 > 0:

            __pyx_t_12 = ((__pyx_v_w4 > 0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_1 = __pyx_t_12;
              goto __pyx_L15_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_h4 > 0) != 0);
            __pyx_t_1 = __pyx_t_12;
            __pyx_L15_bool_binop_done:;
            if (__pyx_t_1) {
    /* … */
              goto __pyx_L14;
            }

    +4939:             x4 = True

              __pyx_v_x4 = 1;

     4940:         else:

    +4941:             x4 = False

            /*else*/ {
              __pyx_v_x4 = 0;
            }
            __pyx_L14:;

     4942:

    +4943:         if w8 > 0 and h8 > 0:

            __pyx_t_12 = ((__pyx_v_w8 > 0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_1 = __pyx_t_12;
              goto __pyx_L18_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_h8 > 0) != 0);
            __pyx_t_1 = __pyx_t_12;
            __pyx_L18_bool_binop_done:;
            if (__pyx_t_1) {
    /* … */
              goto __pyx_L17;
            }

    +4944:             x8 = True

              __pyx_v_x8 = 1;

     4945:         else:

    +4946:             x8 = False

            /*else*/ {
              __pyx_v_x8 = 0;
            }
            __pyx_L17:;

     4947:

    +4948:         if w16 > 0 and h16 > 0:

            __pyx_t_12 = ((__pyx_v_w16 > 0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_1 = __pyx_t_12;
              goto __pyx_L21_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_h16 > 0) != 0);
            __pyx_t_1 = __pyx_t_12;
            __pyx_L21_bool_binop_done:;
            if (__pyx_t_1) {
    /* … */
              goto __pyx_L20;
            }

    +4949:             x16 = True

              __pyx_v_x16 = 1;

     4950:         else:

    +4951:             x16 = False

            /*else*/ {
              __pyx_v_x16 = 0;
            }
            __pyx_L20:;
          }

     4952:

     4953:     # SUBSURFACE DOWNSCALE CANNOT

     4954:     # BE PERFORMED AND WILL RAISE AN EXCEPTION

    +4955:     if not x2:

      __pyx_t_1 = ((!(__pyx_v_x2 != 0)) != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +4956:         return

        goto __pyx_L0;

     4957:

    +4958:     if fast_:

      __pyx_t_1 = (__pyx_v_fast_ != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +4959:         x2, x4, x8 = False, False, False

        __pyx_t_1 = 0;
        __pyx_t_12 = 0;
        __pyx_t_13 = 0;
        __pyx_v_x2 = __pyx_t_1;
        __pyx_v_x4 = __pyx_t_12;
        __pyx_v_x8 = __pyx_t_13;

     4960:

    +4961:     surface_cp = bpf24_c(pixels3d(surface_), threshold=threshold_)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4961, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_15.__pyx_n = 1;
      __pyx_t_15.threshold = __pyx_v_threshold_;
      __pyx_t_2 = __pyx_f_12PygameShader_6shader_bpf24_c(__pyx_t_14, &__pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
      __pyx_t_14.memview = NULL;
      __pyx_t_14.data = NULL;
      __pyx_v_surface_cp = __pyx_t_2;
      __pyx_t_2 = 0;

     4962:

     4963:

     4964:     # FIRST SUBSURFACE DOWNSCALE x2

     4965:     # THIS IS THE MOST EXPENSIVE IN TERM OF PROCESSING TIME

    +4966:     if x2:

      __pyx_t_13 = (__pyx_v_x2 != 0);
      if (__pyx_t_13) {
    /* … */
      }

    +4967:         s2 = scale(surface_cp, (w2, h2))

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_scale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_w2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4967, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_5);
        __pyx_t_3 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_16};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_16};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_v_surface_cp);
          PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_t_16);
          PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_16);
          __pyx_t_16 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4967, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_s2 = __pyx_t_2;
        __pyx_t_2 = 0;

    +4968:         s2_array = numpy.array(s2.get_view('3'), dtype=numpy.uint8)

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s2, __pyx_n_s_get_view); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_16 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_2 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_16, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_3);
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_numpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4968, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_s2_array = __pyx_t_5;
        __pyx_t_5 = 0;

    +4969:         shader_blur5x5_array24_inplace_c(s2_array)

        __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s2_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4969, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
        __pyx_t_14.memview = NULL;
        __pyx_t_14.data = NULL;

     4970:         # b2_blurred = frombuffer(numpy.array(s2_array.transpose(1, 0, 2),

     4971:         # order='C', copy=False), (w2, h2), 'RGB')

    +4972:         b2_blurred = make_surface(s2_array)

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4972, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_s2_array) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_s2_array);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4972, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_b2_blurred = __pyx_t_5;
        __pyx_t_5 = 0;

    +4973:         s2 = smoothscale(b2_blurred, (w, h))

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_b2_blurred, __pyx_t_16};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_b2_blurred, __pyx_t_16};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_b2_blurred);
          __Pyx_GIVEREF(__pyx_v_b2_blurred);
          PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_9, __pyx_v_b2_blurred);
          __Pyx_GIVEREF(__pyx_t_16);
          PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_9, __pyx_t_16);
          __pyx_t_16 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF_SET(__pyx_v_s2, __pyx_t_5);
        __pyx_t_5 = 0;

    +4974:         surface_.blit(s2, (0, 0), special_flags=BLEND_RGB_ADD)

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_s2);
        __Pyx_GIVEREF(__pyx_v_s2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s2);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_tuple__12);
        __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_16) < 0) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;

     4975:

     4976:     # SECOND SUBSURFACE DOWNSCALE x4

     4977:     # THIS IS THE SECOND MOST EXPENSIVE IN TERM OF PROCESSING TIME

    +4978:     if x4:

      __pyx_t_13 = (__pyx_v_x4 != 0);
      if (__pyx_t_13) {
    /* … */
      }

    +4979:         s4 = scale(surface_cp, (w4, h4))

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_scale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4979, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
        __pyx_t_2 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_4};
          __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_4};
          __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4979, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_v_surface_cp);
          PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4979, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_s4 = __pyx_t_16;
        __pyx_t_16 = 0;

    +4980:         s4_array = numpy.array(s4.get_view('3'), dtype=numpy.uint8)

        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_numpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_array_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_s4, __pyx_n_s_get_view); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        __pyx_t_16 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_3);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16);
        __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4980, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_v_s4_array = __pyx_t_5;
        __pyx_t_5 = 0;

    +4981:         shader_blur5x5_array24_inplace_c(s4_array)

        __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s4_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4981, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
        __pyx_t_14.memview = NULL;
        __pyx_t_14.data = NULL;

     4982:         # b4_blurred = frombuffer(numpy.array(s4_array.transpose(1, 0, 2),

     4983:         # order='C', copy=False), (w4, h4), 'RGB')

    +4984:         b4_blurred = make_surface(s4_array)

        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
          }
        }
        __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_2, __pyx_v_s4_array) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_v_s4_array);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_v_b4_blurred = __pyx_t_5;
        __pyx_t_5 = 0;

    +4985:         s4 = smoothscale(b4_blurred, (w, h))

        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4985, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
        __pyx_t_2 = 0;
        __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_b4_blurred, __pyx_t_4};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_b4_blurred, __pyx_t_4};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4985, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_INCREF(__pyx_v_b4_blurred);
          __Pyx_GIVEREF(__pyx_v_b4_blurred);
          PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_b4_blurred);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4985, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF_SET(__pyx_v_s4, __pyx_t_5);
        __pyx_t_5 = 0;

    +4986:         surface_.blit(s4, (0, 0), special_flags=BLEND_RGB_ADD)

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_INCREF(__pyx_v_s4);
        __Pyx_GIVEREF(__pyx_v_s4);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_s4);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_tuple__12);
        __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_special_flags, __pyx_t_4) < 0) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4986, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

     4987:

     4988:     # THIRD SUBSURFACE DOWNSCALE x8

    +4989:     if x8:

      __pyx_t_13 = (__pyx_v_x8 != 0);
      if (__pyx_t_13) {
    /* … */
      }

    +4990:         s8 = scale(surface_cp, (w8, h8))

        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_scale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4990, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_w8); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4990, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4990, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4990, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
        __pyx_t_16 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4990, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_v_surface_cp);
          PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_9, __pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_9, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4990, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_s8 = __pyx_t_4;
        __pyx_t_4 = 0;

    +4991:         s8_array = numpy.array(s8.get_view('3'), dtype=numpy.uint8)

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_s8, __pyx_n_s_get_view); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
          }
        }
        __pyx_t_4 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_3, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_kp_s_3);
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4991, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_s8_array = __pyx_t_5;
        __pyx_t_5 = 0;

    +4992:         shader_blur5x5_array24_inplace_c(s8_array)

        __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s8_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 4992, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
        __pyx_t_14.memview = NULL;
        __pyx_t_14.data = NULL;

     4993:         # b8_blurred = frombuffer(numpy.array(s8_array.transpose(1, 0, 2),

     4994:         # order='C', copy=False), (w8, h8), 'RGB')

    +4995:         b8_blurred = make_surface(s8_array)

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_16 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_5 = (__pyx_t_16) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_16, __pyx_v_s8_array) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_s8_array);
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_v_b8_blurred = __pyx_t_5;
        __pyx_t_5 = 0;

    +4996:         s8 = smoothscale(b8_blurred, (w, h))

        __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 4996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
        __pyx_t_16 = 0;
        __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_b8_blurred, __pyx_t_3};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_b8_blurred, __pyx_t_3};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4996, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          if (__pyx_t_2) {
            __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
          }
          __Pyx_INCREF(__pyx_v_b8_blurred);
          __Pyx_GIVEREF(__pyx_v_b8_blurred);
          PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_9, __pyx_v_b8_blurred);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_9, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4996, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_s8, __pyx_t_5);
        __pyx_t_5 = 0;

    +4997:         surface_.blit(s8, (0, 0), special_flags=BLEND_RGB_ADD)

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_s8);
        __Pyx_GIVEREF(__pyx_v_s8);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_s8);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_tuple__12);
        __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_special_flags, __pyx_t_3) < 0) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 4997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

     4998:

     4999:     # FOURTH SUBSURFACE DOWNSCALE x16

     5000:     # LESS SIGNIFICANT IN TERMS OF RENDERING AND PROCESSING TIME

    +5001:     if x16:

      __pyx_t_13 = (__pyx_v_x16 != 0);
      if (__pyx_t_13) {
    /* … */
      }

    +5002:         s16 = scale(surface_cp, (w16, h16))

        __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_scale); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_w16); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h16); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_16);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_16, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_2};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_surface_cp, __pyx_t_2};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_v_surface_cp);
          PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_v_surface_cp);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_v_s16 = __pyx_t_3;
        __pyx_t_3 = 0;

    +5003:         s16_array = numpy.array(s16.get_view('3'), dtype=numpy.uint8)

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array_2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_s16, __pyx_n_s_get_view); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_2, __pyx_kp_s_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_3);
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5003, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_s16_array = __pyx_t_5;
        __pyx_t_5 = 0;

    +5004:         shader_blur5x5_array24_inplace_c(s16_array)

        __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_s16_array, PyBUF_WRITABLE); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(1, 5004, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_14, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
        __pyx_t_14.memview = NULL;
        __pyx_t_14.data = NULL;

     5005:         # b16_blurred = frombuffer(numpy.array(s16_array.transpose(1, 0, 2),

     5006:         # order='C', copy=False), (w16, h16), 'RGB')

    +5007:         b16_blurred = make_surface(s16_array)

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5007, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_s16_array) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_s16_array);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5007, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_v_b16_blurred = __pyx_t_5;
        __pyx_t_5 = 0;

    +5008:         s16 = smoothscale(b16_blurred, (w, h))

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5008, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5008, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5008, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5008, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_16);
        __pyx_t_4 = 0;
        __pyx_t_16 = 0;
        __pyx_t_16 = NULL;
        __pyx_t_9 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_16)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_9 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_b16_blurred, __pyx_t_2};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_v_b16_blurred, __pyx_t_2};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5008, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__pyx_t_16) {
            __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_16); __pyx_t_16 = NULL;
          }
          __Pyx_INCREF(__pyx_v_b16_blurred);
          __Pyx_GIVEREF(__pyx_v_b16_blurred);
          PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_v_b16_blurred);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5008, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_s16, __pyx_t_5);
        __pyx_t_5 = 0;

    +5009:         surface_.blit(s16, (0, 0), special_flags=BLEND_RGB_ADD)

        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_s16);
        __Pyx_GIVEREF(__pyx_v_s16);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_s16);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
        __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_2) < 0) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5009, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     5010:

     5011:

     5012:     # if mask_ is not None:

     5013:     #     # Multiply mask surface pixels with mask values.

     5014:     #     # RGB pixels = 0 when mask value = 0.0, otherwise

     5015:     #     # modify RGB amplitude

     5016:     #     surface_cp = filtering24_c(surface_cp, mask_)

     5017:

     5018:

    +5019: cdef unsigned int [:, :, ::1] IMAGE_FISHEYE_MODEL = numpy.zeros((800, 1024, 2), uint32)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_33 = PyTuple_New(2); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_INCREF(__pyx_tuple__58);
      __Pyx_GIVEREF(__pyx_tuple__58);
      PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_tuple__58);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_t_33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_37 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_37.memview)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_IMAGE_FISHEYE_MODEL, 1);
      __pyx_v_12PygameShader_6shader_IMAGE_FISHEYE_MODEL = __pyx_t_37;
      __pyx_t_37.memview = NULL;
      __pyx_t_37.data = NULL;
    /* … */
      __pyx_tuple__58 = PyTuple_Pack(3, __pyx_int_800, __pyx_int_1024, __pyx_int_2); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 5019, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__58);
      __Pyx_GIVEREF(__pyx_tuple__58);

     5020:

     5021: @cython.boundscheck(False)

     5022: @cython.wraparound(False)

     5023: @cython.nonecheck(False)

     5024: @cython.cdivision(True)

    +5025: cdef inline shader_fisheye24_footprint_c(Py_ssize_t w, Py_ssize_t h):

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fisheye24_footprint_c(Py_ssize_t __pyx_v_w, Py_ssize_t __pyx_v_h) {
      __Pyx_memviewslice __pyx_v_image_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_y;
      int __pyx_v_x;
      CYTHON_UNUSED int __pyx_v_v;
      float __pyx_v_ny;
      float __pyx_v_ny2;
      float __pyx_v_nx;
      float __pyx_v_nx2;
      float __pyx_v_r;
      float __pyx_v_theta;
      float __pyx_v_nxn;
      float __pyx_v_nyn;
      float __pyx_v_nr;
      int __pyx_v_x2;
      int __pyx_v_y2;
      CYTHON_UNUSED float __pyx_v_s;
      float __pyx_v_c1;
      float __pyx_v_c2;
      float __pyx_v_w2;
      float __pyx_v_h2;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_fisheye24_footprint_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_AddTraceback("PygameShader.shader.shader_fisheye24_footprint_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_image_fisheye_model, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5026:

     5027:     """

     5028:     CREATE A FISHEYE MODEL TO HOLD THE PIXEL COORDINATES OF A SURFACE/ GAME DISPLAY

     5029:

     5030:     * The surface and the model must have the same dimensions.

     5031:

     5032:     Store the fisheye model into an external array image_fisheye_model shape (width, height, 2)

     5033:

     5034:     IMAGE_FISHEYE_MODEL contains the fisheye transformation coordinate (x2 & y2) that reference

     5035:     the final image pixel position (fisheye model)

     5036:     This method has to be call once before the main loop in order to calculate

     5037:     the projected position for each pixels.

     5038:

     5039:     :param w    : integer; width of the model

     5040:     :param h    : integer; height of the model

     5041:     :return     : Return a numpy.ndarray type (w, h, 2) representing the fisheye model (coordinates

     5042:     of all surface pixels passing through the fisheye lens model)

     5043:     """

     5044:

    +5045:     assert w > 0, "Argument w must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_w > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w_must_be_0);
          __PYX_ERR(1, 5045, __pyx_L1_error)
        }
      }
      #endif

    +5046:     assert h > 0, "Argument h must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_h > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h_must_be_0);
          __PYX_ERR(1, 5046, __pyx_L1_error)
        }
      }
      #endif

     5047:

     5048:     cdef:

    +5049:         unsigned int [:, :, :] image_fisheye_model = numpy.zeros((w, h, 2), numpy.uint)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_2);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5049, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_image_fisheye_model = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +5050:         int y=0, x=0, v

      __pyx_v_y = 0;
      __pyx_v_x = 0;

     5051:         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr

     5052:         int x2, y2

    +5053:         float s = <float>w * <float>h

      __pyx_v_s = (((float)__pyx_v_w) * ((float)__pyx_v_h));

    +5054:         float c1 = <float>2.0 / <float>h

      __pyx_v_c1 = (((float)2.0) / ((float)__pyx_v_h));

    +5055:         float c2 = <float>2.0 / <float>w

      __pyx_v_c2 = (((float)2.0) / ((float)__pyx_v_w));

    +5056:         float w2 = <float>w * <float>0.5

      __pyx_v_w2 = (((float)__pyx_v_w) * ((float)0.5));

    +5057:         float h2 = <float>h * <float>0.5

      __pyx_v_h2 = (((float)__pyx_v_h) * ((float)0.5));

     5058:

    +5059:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +5060:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_9 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
    /* … */
            __pyx_t_9 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_10);
                                /* Initialize private variables to invalid values */
                                __pyx_v_nr = ((float)__PYX_NAN());
                                __pyx_v_nx = ((float)__PYX_NAN());
                                __pyx_v_nx2 = ((float)__PYX_NAN());
                                __pyx_v_nxn = ((float)__PYX_NAN());
                                __pyx_v_ny = ((float)__PYX_NAN());
                                __pyx_v_ny2 = ((float)__PYX_NAN());
                                __pyx_v_nyn = ((float)__PYX_NAN());
                                __pyx_v_r = ((float)__PYX_NAN());
                                __pyx_v_theta = ((float)__PYX_NAN());
                                __pyx_v_v = ((int)0xbad0bad0);
                                __pyx_v_x2 = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_y2 = ((int)0xbad0bad0);

    +5061:             nx = x * c2 - <float>1.0

                                __pyx_v_nx = ((__pyx_v_x * __pyx_v_c2) - ((float)1.0));

    +5062:             nx2 = nx * nx

                                __pyx_v_nx2 = (__pyx_v_nx * __pyx_v_nx);

    +5063:             for y in range(h):

                                __pyx_t_12 = __pyx_v_h;
                                __pyx_t_13 = __pyx_t_12;
                                for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_13; __pyx_t_6+=1) {
                                  __pyx_v_y = __pyx_t_6;

    +5064:                 ny = <float>y * c1 - <float>1.0

                                  __pyx_v_ny = ((((float)__pyx_v_y) * __pyx_v_c1) - ((float)1.0));

    +5065:                 ny2 = ny * ny

                                  __pyx_v_ny2 = (__pyx_v_ny * __pyx_v_ny);

    +5066:                 r = <float>sqrt(nx2 + ny2)

                                  __pyx_v_r = ((float)sqrt((__pyx_v_nx2 + __pyx_v_ny2)));

    +5067:                 if 0.0 <= r <= 1.0:

                                  __pyx_t_14 = (0.0 <= __pyx_v_r);
                                  if (__pyx_t_14) {
                                    __pyx_t_14 = (__pyx_v_r <= 1.0);
                                  }
                                  __pyx_t_15 = (__pyx_t_14 != 0);
                                  if (__pyx_t_15) {
    /* … */
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +5068:                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.5

                                    __pyx_v_nr = (((__pyx_v_r + ((float)1.0)) - ((float)sqrt((1.0 - (__pyx_v_nx2 + __pyx_v_ny2))))) * ((float)0.5));

    +5069:                     if nr <= 1.0:

                                    __pyx_t_15 = ((__pyx_v_nr <= 1.0) != 0);
                                    if (__pyx_t_15) {
    /* … */
                                    }

    +5070:                         theta = <float>atan2(ny, nx)

                                      __pyx_v_theta = ((float)atan2(__pyx_v_ny, __pyx_v_nx));

    +5071:                         nxn = nr * <float>cos(theta)

                                      __pyx_v_nxn = (__pyx_v_nr * ((float)cos(__pyx_v_theta)));

    +5072:                         nyn = nr * <float>sin(theta)

                                      __pyx_v_nyn = (__pyx_v_nr * ((float)sin(__pyx_v_theta)));

    +5073:                         x2 = <int>(nxn * w2 + w2)

                                      __pyx_v_x2 = ((int)((__pyx_v_nxn * __pyx_v_w2) + __pyx_v_w2));

    +5074:                         y2 = <int>(nyn * h2 + h2)

                                      __pyx_v_y2 = ((int)((__pyx_v_nyn * __pyx_v_h2) + __pyx_v_h2));

    +5075:                         v = <int>(y2 * w + x2)

                                      __pyx_v_v = ((int)((__pyx_v_y2 * __pyx_v_w) + __pyx_v_x2));

    +5076:                         image_fisheye_model[x, y, 0] = x2

                                      __pyx_t_16 = __pyx_v_x;
                                      __pyx_t_17 = __pyx_v_y;
                                      __pyx_t_18 = 0;
                                      *((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_image_fisheye_model.data + __pyx_t_16 * __pyx_v_image_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_image_fisheye_model.strides[1]) ) + __pyx_t_18 * __pyx_v_image_fisheye_model.strides[2]) )) = __pyx_v_x2;

    +5077:                         image_fisheye_model[x, y, 1] = y2

                                      __pyx_t_18 = __pyx_v_x;
                                      __pyx_t_17 = __pyx_v_y;
                                      __pyx_t_16 = 1;
                                      *((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_image_fisheye_model.data + __pyx_t_18 * __pyx_v_image_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_image_fisheye_model.strides[1]) ) + __pyx_t_16 * __pyx_v_image_fisheye_model.strides[2]) )) = __pyx_v_y2;

     5078:

    +5079:     return asarray(ascontiguousarray(image_fisheye_model))

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_image_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     5080:

     5081: @cython.boundscheck(False)

     5082: @cython.wraparound(False)

     5083: @cython.nonecheck(False)

     5084: @cython.cdivision(True)

    +5085: cdef inline void shader_fisheye24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_fisheye24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_fisheye_model) {
      CYTHON_UNUSED Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int *__pyx_v_x2;
      unsigned int *__pyx_v_y2;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_fisheye24_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_fisheye24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_RefNannyFinishContext();
    }

     5086:         unsigned char [:, :, :] rgb_array_, unsigned int [:, :, :] fisheye_model):

     5087:     """

     5088:     THIS SHADER CAN BE USE TO DISPLAY THE GAME THROUGH A LENS EFFECT

     5089:

     5090:     Display a fisheye effect in real time given a numpy ndarray referencing the

     5091:     pixels RGB of a Pygame.Surface. In order to accomplish a real time

     5092:     calculation, this algorithm is using a pre-calculated transformation stored

     5093:     in the array fisheye_model.

     5094:     The function shader_fisheye24_footprint_c has to be called prior

     5095:     shader_fisheye24_inplace_c in order to store the transformation values.

     5096:

     5097:     This shader can be applied directly to the pygame display

     5098:

     5099:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     5100:      please refer to pygame

     5101:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     5102:

     5103:     :param rgb_array_       : numpy.ndarray shape (width, height, 3) containing RGB pixels

     5104:     :param fisheye_model    : numpy.ndarray shape (width, height, 2) int32, fisheye model

     5105:     containing the pixels

     5106:     coordinates after the fisheye transformation

     5107:     :return                 : void

     5108:     """

     5109:

     5110:     cdef:

     5111:         Py_ssize_t w, h

    +5112:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     5113:

     5114:     cdef:

     5115:         int x, y

    +5116:         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=False, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_False) < 0) __PYX_ERR(1, 5116, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5116, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5116, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     5117:         unsigned int *x2

     5118:         unsigned int *y2

     5119:

    +5120:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +5121:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_x2 = ((unsigned int *)1);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_y2 = ((unsigned int *)1);

    +5122:             for y in range(h):

                                __pyx_t_10 = __pyx_v_h;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_y = __pyx_t_12;

    +5123:                 x2 = &fisheye_model[x, y, 0]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  __pyx_v_x2 = (&(*((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fisheye_model.data + __pyx_t_13 * __pyx_v_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_fisheye_model.strides[1]) ) + __pyx_t_15 * __pyx_v_fisheye_model.strides[2]) ))));

    +5124:                 y2 = &fisheye_model[x, y, 1]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  __pyx_v_y2 = (&(*((unsigned int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_fisheye_model.data + __pyx_t_15 * __pyx_v_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_fisheye_model.strides[1]) ) + __pyx_t_13 * __pyx_v_fisheye_model.strides[2]) ))));

     5125:

    +5126:                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]

                                  __pyx_t_16 = (__pyx_v_x2[0]);
                                  __pyx_t_17 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 0;
                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_18 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));

    +5127:                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]

                                  __pyx_t_17 = (__pyx_v_x2[0]);
                                  __pyx_t_16 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 1;
                                  __pyx_t_18 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_14 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));

    +5128:                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]

                                  __pyx_t_16 = (__pyx_v_x2[0]);
                                  __pyx_t_17 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 2;
                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_18 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5129:

     5130:

     5131:

     5132: @cython.boundscheck(False)

     5133: @cython.wraparound(False)

     5134: @cython.nonecheck(False)

     5135: @cython.cdivision(True)

    +5136: cdef inline tuple shader_rain_footprint_inplace_c(Py_ssize_t w, Py_ssize_t h):

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_rain_footprint_inplace_c(Py_ssize_t __pyx_v_w, Py_ssize_t __pyx_v_h) {
      __Pyx_memviewslice __pyx_v_rain_fisheye_model = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_y;
      int __pyx_v_x;
      CYTHON_UNUSED int __pyx_v_v;
      float __pyx_v_ny;
      float __pyx_v_ny2;
      float __pyx_v_nx;
      float __pyx_v_nx2;
      float __pyx_v_r;
      float __pyx_v_theta;
      float __pyx_v_nxn;
      float __pyx_v_nyn;
      float __pyx_v_nr;
      int __pyx_v_x2;
      int __pyx_v_y2;
      CYTHON_UNUSED float __pyx_v_s;
      float __pyx_v_c1;
      float __pyx_v_c2;
      float __pyx_v_w2;
      float __pyx_v_h2;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rain_footprint_inplace_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_AddTraceback("PygameShader.shader.shader_rain_footprint_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rain_fisheye_model, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5137:     """

     5138:     CREATE A FISH EYE LENS DEFORMATION MAP/TEXTURE

     5139:

     5140:     * This function create a texture and its equivalent numpy.ndarray containing the coordinates

     5141:       for each pixels after deformation.

     5142:     * This method must be called once outside of your game main loop

     5143:     * The model can be re-use to display your video game animation without being re-calculated for

     5144:       each frame. This method allow a high fps rate

     5145:

     5146:     :param w    : integer; Width of the fish eye effect

     5147:     :param h    : integer; height of the fish eye effect

     5148:     :return     : Pygame Surface representing the fish-eye effect and the equivalent numpy.ndarray

     5149:     """

    +5150:     assert w > 0, "Argument w must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_w > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_w_must_be_0);
          __PYX_ERR(1, 5150, __pyx_L1_error)
        }
      }
      #endif

    +5151:     assert h > 0, "Argument h must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_h > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_h_must_be_0);
          __PYX_ERR(1, 5151, __pyx_L1_error)
        }
      }
      #endif

     5152:

     5153:     cdef:

    +5154:         unsigned int [:, :, ::1] rain_fisheye_model = numpy.zeros((w, h, 3), numpy.uint)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_5, __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
        __pyx_t_5 = 0;
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5154, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5154, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rain_fisheye_model = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +5155:         int y=0, x=0, v

      __pyx_v_y = 0;
      __pyx_v_x = 0;

     5156:         float ny, ny2, nx, nx2, r, theta, nxn, nyn, nr

     5157:         int x2, y2

    +5158:         float s = <float>w * <float>h

      __pyx_v_s = (((float)__pyx_v_w) * ((float)__pyx_v_h));

    +5159:         float c1 = <float>2.0 / <float>h

      __pyx_v_c1 = (((float)2.0) / ((float)__pyx_v_h));

    +5160:         float c2 = <float>2.0 / <float>w

      __pyx_v_c2 = (((float)2.0) / ((float)__pyx_v_w));

    +5161:         float w2 = <float>w * <float>0.5

      __pyx_v_w2 = (((float)__pyx_v_w) * ((float)0.5));

    +5162:         float h2 = <float>h * <float>0.5

      __pyx_v_h2 = (((float)__pyx_v_h) * ((float)0.5));

     5163:

    +5164:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +5165:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_9 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
    /* … */
            __pyx_t_9 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_nr) lastprivate(__pyx_v_nx) lastprivate(__pyx_v_nx2) lastprivate(__pyx_v_nxn) lastprivate(__pyx_v_ny) lastprivate(__pyx_v_ny2) lastprivate(__pyx_v_nyn) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) lastprivate(__pyx_v_v) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_10);
                                /* Initialize private variables to invalid values */
                                __pyx_v_nr = ((float)__PYX_NAN());
                                __pyx_v_nx = ((float)__PYX_NAN());
                                __pyx_v_nx2 = ((float)__PYX_NAN());
                                __pyx_v_nxn = ((float)__PYX_NAN());
                                __pyx_v_ny = ((float)__PYX_NAN());
                                __pyx_v_ny2 = ((float)__PYX_NAN());
                                __pyx_v_nyn = ((float)__PYX_NAN());
                                __pyx_v_r = ((float)__PYX_NAN());
                                __pyx_v_theta = ((float)__PYX_NAN());
                                __pyx_v_v = ((int)0xbad0bad0);
                                __pyx_v_x2 = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_y2 = ((int)0xbad0bad0);

    +5166:             nx = x * c2 - <float>1.0

                                __pyx_v_nx = ((__pyx_v_x * __pyx_v_c2) - ((float)1.0));

    +5167:             nx2 = nx * nx

                                __pyx_v_nx2 = (__pyx_v_nx * __pyx_v_nx);

    +5168:             for y in range(h):

                                __pyx_t_12 = __pyx_v_h;
                                __pyx_t_13 = __pyx_t_12;
                                for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_13; __pyx_t_6+=1) {
                                  __pyx_v_y = __pyx_t_6;

    +5169:                 ny = y * c1 - <float>1.0

                                  __pyx_v_ny = ((__pyx_v_y * __pyx_v_c1) - ((float)1.0));

    +5170:                 ny2 = ny * ny

                                  __pyx_v_ny2 = (__pyx_v_ny * __pyx_v_ny);

    +5171:                 r = <float>sqrt(nx2 + ny2)

                                  __pyx_v_r = ((float)sqrt((__pyx_v_nx2 + __pyx_v_ny2)));

    +5172:                 if 0.0 <= r <= 1.0:

                                  __pyx_t_14 = (0.0 <= __pyx_v_r);
                                  if (__pyx_t_14) {
                                    __pyx_t_14 = (__pyx_v_r <= 1.0);
                                  }
                                  __pyx_t_15 = (__pyx_t_14 != 0);
                                  if (__pyx_t_15) {
    /* … */
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +5173:                     nr = (r + <float>1.0 - <float>sqrt(1.0 - (nx2 + ny2))) * <float>0.45

                                    __pyx_v_nr = (((__pyx_v_r + ((float)1.0)) - ((float)sqrt((1.0 - (__pyx_v_nx2 + __pyx_v_ny2))))) * ((float)0.45));

    +5174:                     if nr <= 1.0:

                                    __pyx_t_15 = ((__pyx_v_nr <= 1.0) != 0);
                                    if (__pyx_t_15) {
    /* … */
                                    }

    +5175:                         theta = <float>atan2(ny, nx)

                                      __pyx_v_theta = ((float)atan2(__pyx_v_ny, __pyx_v_nx));

    +5176:                         nxn = nr * <float>cos(theta)

                                      __pyx_v_nxn = (__pyx_v_nr * ((float)cos(__pyx_v_theta)));

    +5177:                         nyn = nr * <float>sin(theta)

                                      __pyx_v_nyn = (__pyx_v_nr * ((float)sin(__pyx_v_theta)));

    +5178:                         x2 = <int>(nxn * w2 + w2)

                                      __pyx_v_x2 = ((int)((__pyx_v_nxn * __pyx_v_w2) + __pyx_v_w2));

    +5179:                         y2 = <int>(nyn * h2 + h2)

                                      __pyx_v_y2 = ((int)((__pyx_v_nyn * __pyx_v_h2) + __pyx_v_h2));

    +5180:                         v = <int>(y2 * w + x2)

                                      __pyx_v_v = ((int)((__pyx_v_y2 * __pyx_v_w) + __pyx_v_x2));

    +5181:                         rain_fisheye_model[x, y, 0] = x2

                                      __pyx_t_16 = __pyx_v_x;
                                      __pyx_t_17 = __pyx_v_y;
                                      __pyx_t_18 = 0;
                                      *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_16 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_18)) )) = __pyx_v_x2;

    +5182:                         rain_fisheye_model[x, y, 1] = y2

                                      __pyx_t_18 = __pyx_v_x;
                                      __pyx_t_17 = __pyx_v_y;
                                      __pyx_t_16 = 1;
                                      *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_18 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_16)) )) = __pyx_v_y2;

    +5183:                         rain_fisheye_model[x, y, 2] = 0

                                      __pyx_t_16 = __pyx_v_x;
                                      __pyx_t_17 = __pyx_v_y;
                                      __pyx_t_18 = 2;
                                      *((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_16 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_17 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_18)) )) = 0;

     5184:

    +5185:     return make_surface(asarray(rain_fisheye_model)), asarray(rain_fisheye_model)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_7 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_rain_fisheye_model, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5185, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_7);
      __pyx_t_7 = 0;
      goto __pyx_L0;

     5186:

     5187:

     5188: @cython.boundscheck(False)

     5189: @cython.wraparound(False)

     5190: @cython.nonecheck(False)

     5191: @cython.cdivision(True)

    +5192: cdef inline void shader_rain_fisheye24_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rain_fisheye24_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_rain_fisheye_model) {
      CYTHON_UNUSED Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int *__pyx_v_x2;
      unsigned int *__pyx_v_y2;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rain_fisheye24_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_rain_fisheye24_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_RefNannyFinishContext();
    }

     5193:         unsigned char [:, :, :] rgb_array_,

     5194:         unsigned int [:, :, ::1] rain_fisheye_model

     5195: ):

     5196:     """

     5197:     THIS SHADER CAN BE USED TO SIMULATE RAIN DROPLET OR BUBBLE DISPLAYED ON THE TOP OF

     5198:     THE SCREEN SURFACE.

     5199:

     5200:     Both array rgb_array_ and rain_fisheye_model must have the same size

     5201:

     5202:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     5203:     please refer to pygame

     5204:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     5205:

     5206:     1) Always call the method shader_rain_footprint_inplace_c before the main loop.

     5207:        The transformation model doesn't have to be calculated every frames.

     5208:        The above method will generate a pygame texture (24bit) containing the location

     5209:        of each pixels after deformation. It does also return a numpy.ndarray equivalent

     5210:        pixel format that can be used instead of the surface if needed.

     5211:

     5212:     It uses a fish eye lens deformation to reproduce the deformed background image onto

     5213:     the final image. The operation apply inplace and the surface referenced by the rgb_array_

     5214:     will be modified directly.

     5215:     The fish-eye lens deformation will recreate you game scene into the rain droplet or bubble

     5216:     and create the illusion of animation inside the bubble.

     5217:

     5218:     * This shader cannot be applied directly to the pygame display as the array passed to the

     5219:     function is a scaled format of the pygame.display (copy not referencing directly the

     5220:     surface pixels)

     5221:

     5222:     * This algorithm use a pre-calculated fish-eye lens deformation model to boost the overall

     5223:     fps performances, the texture pixel is then transformed with the model without any intensive

     5224:     math calculation.

     5225:

     5226:     :param rgb_array_           : numpy.ndarray type (w, h, 3) uint8 (unsigned char 0...255)

     5227:     Array referencing a

     5228:     pygame surface (compatible with 24bit format only RGB model)

     5229:     :param rain_fisheye_model   : numpy.ndarray type (w, h, 3) unsigned int containing the

     5230:     the coordinate for each pixels

     5231:     :return                     : void

     5232:     """

     5233:

     5234:     cdef:

     5235:         Py_ssize_t w, h

    +5236:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     5237:

     5238:     cdef:

     5239:         int x, y

    +5240:         unsigned char [:, :, ::1] rgb_array_copy = numpy.array(rgb_array_, copy=True, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 5240, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5240, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5240, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     5241:         unsigned int *x2

     5242:         unsigned int *y2

     5243:

    +5244:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +5245:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_y) lastprivate(__pyx_v_y2) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_x2 = ((unsigned int *)1);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_y2 = ((unsigned int *)1);

    +5246:             for y in range(h):

                                __pyx_t_10 = __pyx_v_h;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_y = __pyx_t_12;

    +5247:                 x2 = &rain_fisheye_model[x, y, 0]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  __pyx_v_x2 = (&(*((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_13 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_15)) ))));

    +5248:                 y2 = &rain_fisheye_model[x, y, 1]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  __pyx_v_y2 = (&(*((unsigned int *) ( /* dim=2 */ ((char *) (((unsigned int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rain_fisheye_model.data + __pyx_t_15 * __pyx_v_rain_fisheye_model.strides[0]) ) + __pyx_t_14 * __pyx_v_rain_fisheye_model.strides[1]) )) + __pyx_t_13)) ))));

     5249:

    +5250:                 rgb_array_[x, y, 0] = rgb_array_copy[x2[0], y2[0], 0]

                                  __pyx_t_16 = (__pyx_v_x2[0]);
                                  __pyx_t_17 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 0;
                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_18 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));

    +5251:                 rgb_array_[x, y, 1] = rgb_array_copy[x2[0], y2[0], 1]

                                  __pyx_t_17 = (__pyx_v_x2[0]);
                                  __pyx_t_16 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 1;
                                  __pyx_t_18 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_14 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_18 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));

    +5252:                 rgb_array_[x, y, 2] = rgb_array_copy[x2[0], y2[0], 2]

                                  __pyx_t_16 = (__pyx_v_x2[0]);
                                  __pyx_t_17 = (__pyx_v_y2[0]);
                                  __pyx_t_13 = 2;
                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_15 = __pyx_v_y;
                                  __pyx_t_18 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_18 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_16 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_copy.strides[1]) )) + __pyx_t_13)) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5253:

     5254:

     5255:

     5256:

     5257:

     5258: @cython.boundscheck(False)

     5259: @cython.wraparound(False)

     5260: @cython.nonecheck(False)

     5261: @cython.cdivision(True)

    +5262: cdef inline void shader_tv_scanline_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_tv_scanline_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_frame_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_j;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      int __pyx_v_frame_2;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_tv_scanline_inplace_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     5263:         unsigned char [:, :, :] rgb_array_,

     5264:         int frame_):

     5265:     """

     5266:     SHADER CREATING A TV SCANLINE EFFECT ON PYGAME SURFACE

     5267:

     5268:     The space between each scanline can by adjusted with the frame_ value.

     5269:     The scanline intensity/colors is lower that the original pixel value

     5270:

     5271:     * This shader can be apply directly to the pygame display as long as rgb_array_ array reference

     5272:     directly the screen pixels

     5273:

     5274:     The Array (rgb_array) must be a numpy array shape (w, h, 3) containing RGB pixels,

     5275:     please refer to pygame

     5276:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     5277:

     5278:     :param rgb_array_   : numpy.ndarray shape (w, h, 3) containing RGB pixels

     5279:     :param frame_       : integer; Frame numbre (linear value)

     5280:     :return             : void

     5281:     """

     5282:

     5283:

     5284:     cdef:

     5285:         Py_ssize_t w, h

    +5286:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     5287:

     5288:     cdef:

     5289:         int x, y, j

     5290:         unsigned char *r

     5291:         unsigned char *g

     5292:         unsigned char *b

    +5293:         int frame_2 = frame_ >> 1

      __pyx_v_frame_2 = (__pyx_v_frame_ >> 1);

     5294:

    +5295:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +5296:         for y in prange(0, h, frame_, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            __pyx_t_4 = __pyx_v_frame_;
            if ((__pyx_t_4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 0 + __pyx_t_4 - __pyx_t_4/abs(__pyx_t_4)) / __pyx_t_4;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)        __pyx_t_4 = __pyx_v_frame_;
            if ((__pyx_t_4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 0 + __pyx_t_4 - __pyx_t_4/abs(__pyx_t_4)) / __pyx_t_4;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_5; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + __pyx_t_4 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_x = ((int)0xbad0bad0);

    +5297:             for x in range(w):

                                __pyx_t_6 = __pyx_v_w;
                                __pyx_t_7 = __pyx_t_6;
                                for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                                  __pyx_v_x = __pyx_t_8;

    +5298:                 for j in range(frame_2):

                                  __pyx_t_9 = __pyx_v_frame_2;
                                  __pyx_t_10 = __pyx_t_9;
                                  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
                                    __pyx_v_j = __pyx_t_11;

    +5299:                     if y + j < h - 1:

                                    __pyx_t_12 = (((__pyx_v_y + __pyx_v_j) < (__pyx_v_h - 1)) != 0);
                                    if (__pyx_t_12) {
    /* … */
                                      goto __pyx_L14;
                                    }

    +5300:                         r = &rgb_array_[x, y + j, 0]

                                      __pyx_t_13 = __pyx_v_x;
                                      __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                      __pyx_t_15 = 0;
                                      __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +5301:                         g = &rgb_array_[x, y + j, 1]

                                      __pyx_t_15 = __pyx_v_x;
                                      __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                      __pyx_t_13 = 1;
                                      __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

    +5302:                         b = &rgb_array_[x, y + j, 2]

                                      __pyx_t_13 = __pyx_v_x;
                                      __pyx_t_14 = (__pyx_v_y + __pyx_v_j);
                                      __pyx_t_15 = 2;
                                      __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

     5303:                     else:

    +5304:                         r = &rgb_array_[x, y, 0]

                                    /*else*/ {
                                      __pyx_t_15 = __pyx_v_x;
                                      __pyx_t_14 = __pyx_v_y;
                                      __pyx_t_13 = 0;
                                      __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));

    +5305:                         g = &rgb_array_[x, y, 1]

                                      __pyx_t_13 = __pyx_v_x;
                                      __pyx_t_14 = __pyx_v_y;
                                      __pyx_t_15 = 1;
                                      __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +5306:                         b = &rgb_array_[x, y, 2]

                                      __pyx_t_15 = __pyx_v_x;
                                      __pyx_t_14 = __pyx_v_y;
                                      __pyx_t_13 = 2;
                                      __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) ))));
                                    }
                                    __pyx_L14:;

    +5307:                     r[0] = <unsigned char> (r[0] * <float>0.65)

                                    (__pyx_v_r[0]) = ((unsigned char)((__pyx_v_r[0]) * ((float)0.65)));

    +5308:                     g[0] = <unsigned char> (g[0] * <float>0.65)

                                    (__pyx_v_g[0]) = ((unsigned char)((__pyx_v_g[0]) * ((float)0.65)));

    +5309:                     b[0] = <unsigned char> (b[0] * <float>0.65)

                                    (__pyx_v_b[0]) = ((unsigned char)((__pyx_v_b[0]) * ((float)0.65)));
                                  }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5310:

     5311:

     5312: @cython.binding(False)

     5313: @cython.boundscheck(False)

     5314: @cython.wraparound(False)

     5315: @cython.nonecheck(False)

     5316: @cython.cdivision(True)

    +5317: cdef inline void shader_rgb_split_inplace_c(object surface_, int offset_):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_rgb_split_inplace_c(PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_z;
      __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_red = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_green = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rgb_split_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __Pyx_XDECREF(__pyx_t_14);
      __Pyx_XDECREF(__pyx_t_15);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_rgb_split_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_red, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_green, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_blue, 1);
      __Pyx_RefNannyFinishContext();
    }

     5318:     """

     5319:     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)

     5320:     The transformation apply inplace

     5321:

     5322:     The original surface will be used and used for the subsurface blit operation.

     5323:     Each channels will be blit sequentially in the following order RGB

     5324:     Note that channel green and blue will be blit with an additional flag BLEND_RGB_ADD, to mix

     5325:     the channel with the lower layers.

     5326:

     5327:     * FPS BOOST

     5328:     In order to boost the fps frame rate the original surface to process can be downscale x2

     5329:     and rescale after processing.

     5330:

     5331:     * This shader can be apply directly to the pygame display by passing the screen equ

     5332:     surface to the

     5333:     method. This is true if the surface passed to the method is not a screen copy or a

     5334:     modified/altered

     5335:     surface (e.g downscale / upscale surface)

     5336:

     5337:     :param surface_ : pygame Surface to process (24bit format)

     5338:     :param offset_  : integer; offset to add to each channels RGB

     5339:     :return         : void

     5340:     """

     5341:     cdef:

     5342:         Py_ssize_t w, h

    +5343:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5343, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 5343, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5343, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 5343, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5343, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5343, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     5344:

     5345:     cdef:

     5346:         int i, j

    +5347:         int z = <int>h * <int>w * 3

      __pyx_v_z = ((((int)__pyx_v_h) * ((int)__pyx_v_w)) * 3);

    +5348:         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5348, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_rgb = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5349:         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5349, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5349, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_red = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5350:         unsigned char [:] green = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5350, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5350, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_green = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5351:         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __pyx_t_8 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5351, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5351, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_blue = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     5352:

     5353:

    +5354:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L7:;
          }
      }

     5355:

    +5356:         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):

            __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
            if ((4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j)            __pyx_t_11 = 8;
    /* … */
            __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
            if ((4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static, __pyx_t_11) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                            {
                                __pyx_v_i = (int)(0 + 4 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_j = ((int)0xbad0bad0);

    +5357:             j = (i >> 2) * 3

                                __pyx_v_j = ((__pyx_v_i >> 2) * 3);

    +5358:             red[j]     = rgb[i + 2]

                                __pyx_t_12 = (__pyx_v_i + 2);
                                __pyx_t_13 = __pyx_v_j;
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_red.data + __pyx_t_13 * __pyx_v_red.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

    +5359:             green[j+1] = rgb[i + 1]

                                __pyx_t_12 = (__pyx_v_i + 1);
                                __pyx_t_13 = (__pyx_v_j + 1);
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_green.data + __pyx_t_13 * __pyx_v_green.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

    +5360:             blue[j+2]  = rgb[i    ]

                                __pyx_t_12 = __pyx_v_i;
                                __pyx_t_13 = (__pyx_v_j + 2);
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_blue.data + __pyx_t_13 * __pyx_v_blue.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5361:

    +5362:     del rgb

      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);

    +5363:     surface_.blit(fromstring(bytes(red), (w, h), 'RGB'), (0, 0))

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_red, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5363, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_15);
      __pyx_t_4 = 0;
      __pyx_t_15 = 0;
      __pyx_t_15 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_14, __pyx_t_16, __pyx_n_s_RGB};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[4] = {__pyx_t_15, __pyx_t_14, __pyx_t_16, __pyx_n_s_RGB};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_15) {
          __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_15); __pyx_t_15 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_16);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_14 = 0;
        __pyx_t_16 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_tuple__12};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_2, __pyx_tuple__12};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 2+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_2);
        __Pyx_INCREF(__pyx_tuple__12);
        __Pyx_GIVEREF(__pyx_tuple__12);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_tuple__12);
        __pyx_t_2 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5363, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    +5364:     surface_.blit(fromstring(bytes(green), (w, h), 'RGB'), (offset_, offset_),

      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_green, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_16 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_16);
      __pyx_t_2 = 0;
      __pyx_t_16 = 0;
      __pyx_t_16 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_16)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_16);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_16, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_16) {
          __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_16); __pyx_t_16 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_t_14);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_3 = 0;
        __pyx_t_14 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
      __pyx_t_1 = 0;
      __pyx_t_14 = 0;
    /* … */
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +5365:                   special_flags=BLEND_RGB_ADD)

      __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_special_flags, __pyx_t_1) < 0) __PYX_ERR(1, 5365, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +5366:     surface_.blit(fromstring(bytes(blue), (w, h), 'RGB'), (offset_ << 1, offset_ << 1),

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_blue, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_16, __pyx_n_s_RGB};
        __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_4, __pyx_t_16, __pyx_n_s_RGB};
        __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_11, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_11, __pyx_t_16);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_4 = 0;
        __pyx_t_16 = 0;
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_offset_ << 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_v_offset_ << 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_16);
      __pyx_t_14 = 0;
      __pyx_t_16 = 0;
    /* … */
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    +5367:                   special_flags=BLEND_RGB_ADD)

      __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_special_flags, __pyx_t_14) < 0) __PYX_ERR(1, 5367, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

     5368:

     5369:

     5370:

     5371: @cython.binding(False)

     5372: @cython.boundscheck(False)

     5373: @cython.wraparound(False)

     5374: @cython.nonecheck(False)

     5375: @cython.cdivision(True)

    +5376: cdef shader_rgb_split_c(object surface_, int offset_):

    static PyObject *__pyx_f_12PygameShader_6shader_shader_rgb_split_c(PyObject *__pyx_v_surface_, int __pyx_v_offset_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_i;
      int __pyx_v_j;
      int __pyx_v_z;
      __Pyx_memviewslice __pyx_v_rgb = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_red = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_green = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_blue = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_v_new_surface = NULL;
      PyObject *__pyx_v_red_ = NULL;
      PyObject *__pyx_v_green_ = NULL;
      PyObject *__pyx_v_blue_ = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_rgb_split_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_8);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __Pyx_XDECREF(__pyx_t_14);
      __Pyx_AddTraceback("PygameShader.shader.shader_rgb_split_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_red, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_green, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_blue, 1);
      __Pyx_XDECREF(__pyx_v_new_surface);
      __Pyx_XDECREF(__pyx_v_red_);
      __Pyx_XDECREF(__pyx_v_green_);
      __Pyx_XDECREF(__pyx_v_blue_);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5377:     """

     5378:     THIS SHADER CREATE AN RGB SPLIT EFFECT (SUPERPOSED CHANNEL R, G, B WITH GIVEN OFFSET)

     5379:

     5380:     The final image has a different width and height since the offset value is removed to keep only

     5381:     the overlapping R, G, B channels

     5382:     Setting the Offset_ to zero will have no effect to the original image.

     5383:

     5384:     :param surface_ : pygame Surface to process (24bit format)

     5385:     :param offset_  : integer; offset to add to each channels RGB

     5386:     :return         : void

     5387:     """

     5388:

     5389:     cdef:

     5390:         Py_ssize_t w, h

    +5391:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5391, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5391, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 5391, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5391, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 5391, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5391, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5391, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     5392:

     5393:     cdef:

     5394:         int i, j

    +5395:         int z = <int>h * <int>w * 3

      __pyx_v_z = ((((int)__pyx_v_h) * ((int)__pyx_v_w)) * 3);

    +5396:         unsigned char [:] rgb   = numpy.frombuffer(surface_.get_buffer(), dtype=numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5396, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_rgb = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5397:         unsigned char [:] red   = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5397, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5397, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_red = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5398:         unsigned char [:] green = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
      __pyx_t_8 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5398, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5398, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_green = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

    +5399:         unsigned char [:] blue  = numpy.zeros(z, uint8, order='C')

      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_z); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_uint8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __pyx_t_8 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 5399, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_unsigned_char(__pyx_t_8, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5399, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_blue = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     5400:

     5401:     # Create a new surface (sizes - offset)

    +5402:     new_surface = Surface((w-offset_, h-offset_))

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_w - __pyx_v_offset_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyInt_FromSsize_t((__pyx_v_h - __pyx_v_offset_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_8 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5402, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_new_surface = __pyx_t_8;
      __pyx_t_8 = 0;

    +5403:     new_surface.convert()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_convert); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_8 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

     5404:

    +5405:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L7:;
          }
      }

     5406:

    +5407:         for i in prange(0, w * h * 4, 4,  schedule='static', num_threads=THREADS, chunksize=8):

            __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
            if ((4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j)            __pyx_t_11 = 8;
    /* … */
            __pyx_t_7 = ((__pyx_v_w * __pyx_v_h) * 4);
            if ((4 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_7 - 0 + 4 - 4/abs(4)) / 4;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static, __pyx_t_11) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_10; __pyx_t_6++){
                            {
                                __pyx_v_i = (int)(0 + 4 * __pyx_t_6);
                                /* Initialize private variables to invalid values */
                                __pyx_v_j = ((int)0xbad0bad0);

    +5408:             j = (i >> 2) * 3

                                __pyx_v_j = ((__pyx_v_i >> 2) * 3);

    +5409:             red[j]     = rgb[i + 2]

                                __pyx_t_12 = (__pyx_v_i + 2);
                                __pyx_t_13 = __pyx_v_j;
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_red.data + __pyx_t_13 * __pyx_v_red.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

    +5410:             green[j+1] = rgb[i + 1]

                                __pyx_t_12 = (__pyx_v_i + 1);
                                __pyx_t_13 = (__pyx_v_j + 1);
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_green.data + __pyx_t_13 * __pyx_v_green.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));

    +5411:             blue[j+2]  = rgb[i    ]

                                __pyx_t_12 = __pyx_v_i;
                                __pyx_t_13 = (__pyx_v_j + 2);
                                *((unsigned char *) ( /* dim=0 */ (__pyx_v_blue.data + __pyx_t_13 * __pyx_v_blue.strides[0]) )) = (*((unsigned char *) ( /* dim=0 */ (__pyx_v_rgb.data + __pyx_t_12 * __pyx_v_rgb.strides[0]) )));
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5412:

    +5413:     del rgb

      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb, 1);

     5414:

    +5415:     red_ = fromstring(bytes(red), (w, h), 'RGB')

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_red, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_3, __pyx_t_14, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_14);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_3 = 0;
        __pyx_t_14 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_red_ = __pyx_t_8;
      __pyx_t_8 = 0;

    +5416:     green_ = fromstring(bytes(green), (w, h), 'RGB')

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_green, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_14, __pyx_t_2, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_t_14, __pyx_t_2, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5416, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_2);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_14 = 0;
        __pyx_t_2 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5416, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_green_ = __pyx_t_8;
      __pyx_t_8 = 0;

    +5417:     blue_ = fromstring(bytes(blue), (w, h), 'RGB')

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_fromstring); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_blue, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_14 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_14);
      __pyx_t_4 = 0;
      __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_14, __pyx_t_2, __pyx_t_3, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[4] = {__pyx_t_14, __pyx_t_2, __pyx_t_3, __pyx_n_s_RGB};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5417, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_14) {
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14); __pyx_t_14 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_11, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_11, __pyx_t_3);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_2 = 0;
        __pyx_t_3 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5417, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_blue_ = __pyx_t_8;
      __pyx_t_8 = 0;

     5418:

    +5419:     new_surface.blit(red_, (-offset_, -offset_), special_flags=BLEND_RGB_ADD)

      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __Pyx_PyInt_From_int((-__pyx_v_offset_)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_PyInt_From_int((-__pyx_v_offset_)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
      __pyx_t_1 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_red_);
      __Pyx_GIVEREF(__pyx_v_red_);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_red_);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_special_flags, __pyx_t_1) < 0) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5419, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +5420:     new_surface.blit(green_, (0, 0), special_flags=BLEND_RGB_ADD)

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_green_);
      __Pyx_GIVEREF(__pyx_v_green_);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_green_);
      __Pyx_INCREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_8) < 0) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5420, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    +5421:     new_surface.blit(blue_, (offset_, offset_), special_flags=BLEND_RGB_ADD)

      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_new_surface, __pyx_n_s_blit); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_offset_); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_blue_);
      __Pyx_GIVEREF(__pyx_v_blue_);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_blue_);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_BLEND_RGB_ADD); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_special_flags, __pyx_t_4) < 0) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5421, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    +5422:     return new_surface

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_new_surface);
      __pyx_r = __pyx_v_new_surface;
      goto __pyx_L0;

     5423:

     5424:

    +5425: cpdef inline void putmask_c(

    static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_putmask_c(__Pyx_memviewslice __pyx_v_array_, CYTHON_UNUSED Py_ssize_t __pyx_v_rows_, Py_ssize_t __pyx_v_cols_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_putmask_c *__pyx_optional_args) {
      int __pyx_v_i;
      int __pyx_v_j;
      int *__pyx_v_r;
      int *__pyx_v_g;
      int *__pyx_v_b;
      if (__pyx_optional_args) {
      }
    /* … */
      /* function exit code */
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_136putmask_c[] = "\n    EQUIVALENT METHOD TO numpy.putmask BUT MUCH FASTER FOR OPERATION WITH OPERAND < V_\n\n    * Cython cpdef function, this function can be called directly and do not require a\n      hook function.\n\n    numpy.putmask(array_, array_<0, 0) --> putmask_c(array_, w, h, 0)\n\n    :param array_   : numpy.ndarray shape (w, h, 3) of integer\n    :param rows_    : integer;\n    :param cols_    : integer;\n    :param v_       : Value for filter < v_\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_137putmask_c(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      __Pyx_memviewslice __pyx_v_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      Py_ssize_t __pyx_v_rows_;
      Py_ssize_t __pyx_v_cols_;
      int __pyx_v_v_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("putmask_c (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_array,&__pyx_n_s_rows,&__pyx_n_s_cols,&__pyx_n_s_v,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_array)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rows)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, 1); __PYX_ERR(1, 5425, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cols)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, 2); __PYX_ERR(1, 5425, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_v);
              if (value) { values[3] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "putmask_c") < 0)) __PYX_ERR(1, 5425, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_array_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_int(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_array_.memview)) __PYX_ERR(1, 5426, __pyx_L3_error)
        __pyx_v_rows_ = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_rows_ == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
        __pyx_v_cols_ = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_cols_ == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
        if (values[3]) {
          __pyx_v_v_ = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_v_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5426, __pyx_L3_error)
        } else {
          __pyx_v_v_ = ((int)0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("putmask_c", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5425, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.putmask_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_136putmask_c(__pyx_self, __pyx_v_array_, __pyx_v_rows_, __pyx_v_cols_, __pyx_v_v_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_136putmask_c(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_array_, Py_ssize_t __pyx_v_rows_, Py_ssize_t __pyx_v_cols_, int __pyx_v_v_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("putmask_c", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_array_.memview)) { __Pyx_RaiseUnboundLocalError("array_"); __PYX_ERR(1, 5425, __pyx_L1_error) }
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.v_ = __pyx_v_v_;
      __pyx_f_12PygameShader_6shader_putmask_c(__pyx_v_array_, __pyx_v_rows_, __pyx_v_cols_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.putmask_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_array_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_putmask_c {
      int __pyx_n;
      int v_;
    };

     5426:         int [:, :, :] array_, Py_ssize_t rows_, Py_ssize_t cols_, int v_=0)nogil:

     5427:     """

     5428:     EQUIVALENT METHOD TO numpy.putmask BUT MUCH FASTER FOR OPERATION WITH OPERAND < V_

     5429:

     5430:     * Cython cpdef function, this function can be called directly and do not require a

     5431:       hook function.

     5432:

     5433:     numpy.putmask(array_, array_<0, 0) --> putmask_c(array_, w, h, 0)

     5434:

     5435:     :param array_   : numpy.ndarray shape (w, h, 3) of integer

     5436:     :param rows_    : integer;

     5437:     :param cols_    : integer;

     5438:     :param v_       : Value for filter < v_

     5439:     :return         : void

     5440:     """

     5441:     cdef:

     5442:         int i, j

     5443:         int *r

     5444:         int *g

     5445:         int *b

     5446:

    +5447:     for i in prange(0, rows_, schedule='static', num_threads=THREADS):

      __pyx_t_1 = __pyx_v_rows_;
      if ((1 == 0)) abort();
      {
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   (x)
              #define unlikely(x) (x)
          #endif
          __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
          if (__pyx_t_3 > 0)
          {
              #ifdef _OPENMP
              #pragma omp parallel
              #endif /* _OPENMP */
              {
                  #ifdef _OPENMP
                  #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
    /* … */
      __pyx_t_1 = __pyx_v_rows_;
      if ((1 == 0)) abort();
      {
          #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
              #undef likely
              #undef unlikely
              #define likely(x)   (x)
              #define unlikely(x) (x)
          #endif
          __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
          if (__pyx_t_3 > 0)
          {
              #ifdef _OPENMP
              #pragma omp parallel
              #endif /* _OPENMP */
              {
                  #ifdef _OPENMP
                  #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                  #endif /* _OPENMP */
                  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                      {
                          __pyx_v_i = (int)(0 + 1 * __pyx_t_2);
                          /* Initialize private variables to invalid values */
                          __pyx_v_b = ((int *)1);
                          __pyx_v_g = ((int *)1);
                          __pyx_v_j = ((int)0xbad0bad0);
                          __pyx_v_r = ((int *)1);

    +5448:         for j in range(0, cols_):

                          __pyx_t_4 = __pyx_v_cols_;
                          __pyx_t_5 = __pyx_t_4;
                          for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
                            __pyx_v_j = __pyx_t_6;

    +5449:             r = &array_[i, j, 0]

                            __pyx_t_7 = __pyx_v_i;
                            __pyx_t_8 = __pyx_v_j;
                            __pyx_t_9 = 0;
                            __pyx_v_r = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_7 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_array_.strides[2]) ))));

    +5450:             g = &array_[i, j, 1]

                            __pyx_t_9 = __pyx_v_i;
                            __pyx_t_8 = __pyx_v_j;
                            __pyx_t_7 = 1;
                            __pyx_v_g = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_9 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_7 * __pyx_v_array_.strides[2]) ))));

    +5451:             b = &array_[i, j, 2]

                            __pyx_t_7 = __pyx_v_i;
                            __pyx_t_8 = __pyx_v_j;
                            __pyx_t_9 = 2;
                            __pyx_v_b = (&(*((int *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array_.data + __pyx_t_7 * __pyx_v_array_.strides[0]) ) + __pyx_t_8 * __pyx_v_array_.strides[1]) ) + __pyx_t_9 * __pyx_v_array_.strides[2]) ))));

    +5452:             if r[0] < 0:

                            __pyx_t_10 = (((__pyx_v_r[0]) < 0) != 0);
                            if (__pyx_t_10) {
    /* … */
                            }
                          }
                      }
                  }
              }
          }
      }
      #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
          #undef likely
          #undef unlikely
          #define likely(x)   __builtin_expect(!!(x), 1)
          #define unlikely(x) __builtin_expect(!!(x), 0)
      #endif

    +5453:                 r[0] = 0

                              (__pyx_v_r[0]) = 0;

    +5454:                 g[0] = 0

                              (__pyx_v_g[0]) = 0;

    +5455:                 b[0] = 0

                              (__pyx_v_b[0]) = 0;

     5456:

     5457:             # if r[0] > 255:

     5458:             #     r[0] = 255

     5459:             # if g[0] > 255:

     5460:             #     g[0] = 255

     5461:             # if b[0] > 255:

     5462:             #     b[0] = 255

     5463:

     5464:

     5465:

     5466: @cython.binding(False)

     5467: @cython.boundscheck(False)

     5468: @cython.wraparound(False)

     5469: @cython.nonecheck(False)

     5470: @cython.cdivision(True)

    +5471: cdef inline tuple shader_ripple_c(

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_ripple_c(CYTHON_UNUSED Py_ssize_t __pyx_v_rows_, CYTHON_UNUSED Py_ssize_t __pyx_v_cols_, __Pyx_memviewslice __pyx_v_previous, __Pyx_memviewslice __pyx_v_current, __Pyx_memviewslice __pyx_v_array) {
      int __pyx_v_i;
      int __pyx_v_j;
      float __pyx_v_data;
      float *__pyx_v_c;
      float *__pyx_v_d;
      unsigned char *__pyx_v_e;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_ripple_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_XDECREF(__pyx_t_18);
      __Pyx_XDECREF(__pyx_t_19);
      __Pyx_AddTraceback("PygameShader.shader.shader_ripple_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5472:        Py_ssize_t rows_, Py_ssize_t cols_,

     5473:        float [:, ::1] previous,

     5474:        float [:, ::1] current,

     5475:        unsigned char [:, :, ::1] array,

     5476:        ):

     5477:     """

     5478:     THIS SHADER CREATE A WATER EFFECT ON A PYGAME SURFACE

     5479:     This version does not include any background deformation to keep a reasonable fps rate

     5480:

     5481:     * GLOBAL VARIABLE CONSIDERATION

     5482:     Set 3 arrays as global numpy arrays (not in the main loop, these arrays does not have

     5483:     to be created every frames).

     5484:

     5485:     current = numpy.zeros((width, height), dtype=numpy.float32)

     5486:     previous = numpy.zeros((width, height), dtype=numpy.float32)

     5487:     array = numpy.full((width, height, 3), 0, numpy.uint8)

     5488:

     5489:     * ADD A WATER DROP

     5490:     To add a water drop to the display just add an integer value to the array previous such as

     5491:     previous[random.randint(0, width - 1), random.randint(0, height - 1)] = 1024

     5492:     with width and height matching the size of the array (width, height = previous.get_size())

     5493:

     5494:     * PROCESSING TIME

     5495:     Then update the transformation. The function below will start the blurring process

     5496:     (flattening the

     5497:     values across the array to absorb the drop energy ; 1024 in the example above.

     5498:     Finally the arrays are swapped : current become previous and previous become current

     5499:     Note that:

     5500:     1) w & h must match the array size

     5501:     2) previous & current & array must be identical sizes otherwise an error will be thrown

     5502:

     5503:     previous, current, array = shader_ripple_c(w, h, previous, current, array)

     5504:

     5505:     * CREATING THE SURFACE

     5506:     The array is then transformed into a numpy.ndarray of type uint8 (unsigned char 0..255)

     5507:     The pygame make_surface method will convert the array type (w, h, 3) into a surface that can

     5508:     be blit to the active display.

     5509:     surf = make_surface(asarray(array, dtype=uint8))

     5510:

     5511:     * BLIT

     5512:

     5513:     The newly surface containing the drops can then be added to the current background or

     5514:     display (blit process).

     5515:     Both surface should have the same size for a more realistic effect

     5516:     The special_flag here is BLEND_RGBA_ADD but can be set to a different value to achieve the

     5517:     special effect needed (BLEND_RGB_MULT, BLEND_RGB_SUB) etc.

     5518:     Refer to blending modes to understand the math operation behind the flags

     5519:

     5520:     surface_.blit(surf, (0, 0), special_flags=pygame.BLEND_RGBA_ADD)

     5521:

     5522:     * BOOSTING THE FPS

     5523:     In order to boost the processing time, I downscale the surface prior processing and

     5524:     upscale it x2 when

     5525:     the process is done, this method provide an additional overall performance.

     5526:

     5527:     * NOTE this shader cannot be apply to the screen directly (screen referencing

     5528:     pygame.display.get_surface()),

     5529:

     5530:

     5531:     :param rows_        : integer; Array width

     5532:     :param cols_        : integer; Array height

     5533:     :param previous     : numpy.ndarray type (w, h) type float; array use for the transformation

     5534:     :param current      : numpy.ndarray type (w, h) type float; array use for the transformation

     5535:     :param array        : numpy.ndarray type (w, h, 3) type unsigned char

     5536:     :return             : Return a tuple containing 3 arrays

     5537:     """

     5538:

     5539:     cdef:

     5540:         int i, j, a, b

     5541:         float data

     5542:         float *c

     5543:         float *d

     5544:         unsigned char *e

     5545:         float r

     5546:

    +5547:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     5548:

    +5549:         for i in prange(1, rows_ - 1, schedule='static', num_threads=THREADS):

            __pyx_t_1 = (__pyx_v_rows_ - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_3 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static)
    /* … */
            __pyx_t_1 = (__pyx_v_rows_ - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_3 = (__pyx_t_1 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_3 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                            {
                                __pyx_v_i = (int)(1 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_c = ((float *)1);
                                __pyx_v_d = ((float *)1);
                                __pyx_v_data = ((float)__PYX_NAN());
                                __pyx_v_e = ((unsigned char *)1);
                                __pyx_v_j = ((int)0xbad0bad0);

    +5550:             for j in prange(1, cols_ - 1, schedule='static', num_threads=THREADS):

                                __pyx_t_4 = (__pyx_v_cols_ - 1);
                                if ((1 == 0)) abort();
                                {
                                    __pyx_t_6 = (__pyx_t_4 - 1 + 1 - 1/abs(1)) / 1;
                                    if (__pyx_t_6 > 0)
                                    {
                                        #if 0
                                        #pragma omp parallel
                                        #endif /* _OPENMP */
                                        {
                                            #if 0
                                            #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(static)
    /* … */
                                __pyx_t_4 = (__pyx_v_cols_ - 1);
                                if ((1 == 0)) abort();
                                {
                                    __pyx_t_6 = (__pyx_t_4 - 1 + 1 - 1/abs(1)) / 1;
                                    if (__pyx_t_6 > 0)
                                    {
                                        #if 0
                                        #pragma omp parallel
                                        #endif /* _OPENMP */
                                        {
                                            #if 0
                                            #pragma omp for lastprivate(__pyx_v_c) lastprivate(__pyx_v_d) lastprivate(__pyx_v_data) lastprivate(__pyx_v_e) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                                            #endif /* _OPENMP */
                                            for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_6; __pyx_t_5++){
                                                {
                                                    __pyx_v_j = (int)(1 + 1 * __pyx_t_5);
                                                    /* Initialize private variables to invalid values */
                                                    __pyx_v_c = ((float *)1);
                                                    __pyx_v_d = ((float *)1);
                                                    __pyx_v_data = ((float)__PYX_NAN());
                                                    __pyx_v_e = ((unsigned char *)1);

     5551:

     5552:                 # data = <int>(previous[i + 1, j] + previous[i - 1, j] +

     5553:                 #         previous[i, j - 1] + previous[i, j + 1])  >> 1

     5554:

    +5555:                 data = (previous[i + 1, j] + previous[i - 1, j] +

                                                    __pyx_t_7 = (__pyx_v_i + 1);
                                                    __pyx_t_8 = __pyx_v_j;
                                                    __pyx_t_9 = (__pyx_v_i - 1);
                                                    __pyx_t_10 = __pyx_v_j;

    +5556:                               previous[i, j - 1] + previous[i, j + 1]) * <float>0.5

                                                    __pyx_t_11 = __pyx_v_i;
                                                    __pyx_t_12 = (__pyx_v_j - 1);
    /* … */
                                                    __pyx_t_13 = __pyx_v_i;
                                                    __pyx_t_14 = (__pyx_v_j + 1);
    /* … */
                                                    __pyx_v_data = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_7 * __pyx_v_previous.strides[0]) )) + __pyx_t_8)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_9 * __pyx_v_previous.strides[0]) )) + __pyx_t_10)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_11 * __pyx_v_previous.strides[0]) )) + __pyx_t_12)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_13 * __pyx_v_previous.strides[0]) )) + __pyx_t_14)) )))) * ((float)0.5));

    +5557:                 c = &current[i, j]

                                                    __pyx_t_14 = __pyx_v_i;
                                                    __pyx_t_13 = __pyx_v_j;
                                                    __pyx_v_c = (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_current.data + __pyx_t_14 * __pyx_v_current.strides[0]) )) + __pyx_t_13)) ))));

    +5558:                 data = data - <float>c[0]

                                                    __pyx_v_data = (__pyx_v_data - ((float)(__pyx_v_c[0])));

    +5559:                 data = data - (data * <float>0.011)

                                                    __pyx_v_data = (__pyx_v_data - (__pyx_v_data * ((float)0.011)));

    +5560:                 c[0] = data

                                                    (__pyx_v_c[0]) = __pyx_v_data;

    +5561:                 d = &previous[i,j]

                                                    __pyx_t_13 = __pyx_v_i;
                                                    __pyx_t_14 = __pyx_v_j;
                                                    __pyx_v_d = (&(*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_previous.data + __pyx_t_13 * __pyx_v_previous.strides[0]) )) + __pyx_t_14)) ))));

    +5562:                 e = &array[i, j, 0]

                                                    __pyx_t_14 = __pyx_v_i;
                                                    __pyx_t_13 = __pyx_v_j;
                                                    __pyx_t_12 = 0;
                                                    __pyx_v_e = (&(*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_14 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_12)) ))));

    +5563:                 e[0] = <unsigned char> d[0] if d[0] > 0 else 0

                                                    if ((((__pyx_v_d[0]) > 0.0) != 0)) {
                                                      __pyx_t_15 = ((unsigned char)(__pyx_v_d[0]));
                                                    } else {
                                                      __pyx_t_15 = 0;
                                                    }
                                                    (__pyx_v_e[0]) = __pyx_t_15;

    +5564:                 array[i, j, 1] = e[0]

                                                    __pyx_t_12 = __pyx_v_i;
                                                    __pyx_t_13 = __pyx_v_j;
                                                    __pyx_t_14 = 1;
                                                    *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_12 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_e[0]);

    +5565:                 array[i, j, 2] = e[0]

                                                    __pyx_t_14 = __pyx_v_i;
                                                    __pyx_t_13 = __pyx_v_j;
                                                    __pyx_t_12 = 2;
                                                    *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_array.data + __pyx_t_14 * __pyx_v_array.strides[0]) ) + __pyx_t_13 * __pyx_v_array.strides[1]) )) + __pyx_t_12)) )) = (__pyx_v_e[0]);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5566:

    +5567:     return current, previous, array

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_current, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_previous, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_17);
      PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_18);
      PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_t_18);
      __pyx_t_16 = 0;
      __pyx_t_17 = 0;
      __pyx_t_18 = 0;
      __pyx_r = ((PyObject*)__pyx_t_19);
      __pyx_t_19 = 0;
      goto __pyx_L0;

     5568:

     5569:

     5570:

     5571: @cython.binding(False)

     5572: @cython.boundscheck(False)

     5573: @cython.wraparound(False)

     5574: @cython.nonecheck(False)

     5575: @cython.cdivision(False)

    +5576: cpdef tunnel_modeling32(Py_ssize_t screen_width, Py_ssize_t screen_height):

    static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_tunnel_modeling32(Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, CYTHON_UNUSED int __pyx_skip_dispatch) {
      __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_angles = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_shades = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_v_surface = NULL;
      int __pyx_v_s_width;
      int __pyx_v_s_height;
      __Pyx_memviewslice __pyx_v_scr_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_i;
      double __pyx_v_sqy;
      double __pyx_v_sqx;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_modeling32", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
      __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_angles, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_shades, 1);
      __Pyx_XDECREF(__pyx_v_surface);
      __PYX_XDEC_MEMVIEW(&__pyx_v_scr_data, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_138tunnel_modeling32[] = "\n    THIS METHOD CREATE A TUNNEL MODEL\n\n    * This method must be called before rendering the tunnel in order to create\n      all the necessary buffers that will be called during the rendering of the tunnel effect.\n      tunnel_modeling32 must be call once only before the main loop of your game.\n\n    * Cython cpdef function, this function can be called directly and do not require a\n      hook function.\n\n    * The default tunnel texture is internally loaded (the texture is 256x256 pixels 24-bit)\n      check the line :\n      surface = pygame.image.load(\"Assets\\Graphics\\Background\\space1.jpg\").convert()\n\n    * This algorithm uses a 256x256 texture but reshape it to 512x512 pixels for a\n    better effect definition\n\n    :param screen_width     : integer; Game display size (width in pixels)\n    :param screen_height    : integer; Game display size (height in pixels)\n    :return                 : return a tuple containing the following (distances, angles,\n    shades, scr_data)\n    distances is a numpy.ndarray buffer containing float values representing the distance\n    of each pixels\n    angles is a numpy.ndarray buffer containing float values representing the angle of each pixels\n    shades is a numpy.ndarray buffer containing float values representing the shade of each pixels\n    scr_data is a numpy.ndarray buffer containing uint8 values representing the BGR (not RGB)\n    values of each pixels\n\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_139tunnel_modeling32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      Py_ssize_t __pyx_v_screen_width;
      Py_ssize_t __pyx_v_screen_height;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_modeling32 (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_screen_width,&__pyx_n_s_screen_height,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_width)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_height)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_modeling32", 1, 2, 2, 1); __PYX_ERR(1, 5576, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tunnel_modeling32") < 0)) __PYX_ERR(1, 5576, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        }
        __pyx_v_screen_width = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_screen_width == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5576, __pyx_L3_error)
        __pyx_v_screen_height = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_screen_height == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5576, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("tunnel_modeling32", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5576, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_138tunnel_modeling32(__pyx_self, __pyx_v_screen_width, __pyx_v_screen_height);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_138tunnel_modeling32(CYTHON_UNUSED PyObject *__pyx_self, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_modeling32", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_tunnel_modeling32(__pyx_v_screen_width, __pyx_v_screen_height, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.tunnel_modeling32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5577:     """

     5578:     THIS METHOD CREATE A TUNNEL MODEL

     5579:

     5580:     * This method must be called before rendering the tunnel in order to create

     5581:       all the necessary buffers that will be called during the rendering of the tunnel effect.

     5582:       tunnel_modeling32 must be call once only before the main loop of your game.

     5583:

     5584:     * Cython cpdef function, this function can be called directly and do not require a

     5585:       hook function.

     5586:

     5587:     * The default tunnel texture is internally loaded (the texture is 256x256 pixels 24-bit)

     5588:       check the line :

     5589:       surface = pygame.image.load("Assets\\Graphics\\Background\\space1.jpg").convert()

     5590:

     5591:     * This algorithm uses a 256x256 texture but reshape it to 512x512 pixels for a

     5592:     better effect definition

     5593:

     5594:     :param screen_width     : integer; Game display size (width in pixels)

     5595:     :param screen_height    : integer; Game display size (height in pixels)

     5596:     :return                 : return a tuple containing the following (distances, angles,

     5597:     shades, scr_data)

     5598:     distances is a numpy.ndarray buffer containing float values representing the distance

     5599:     of each pixels

     5600:     angles is a numpy.ndarray buffer containing float values representing the angle of each pixels

     5601:     shades is a numpy.ndarray buffer containing float values representing the shade of each pixels

     5602:     scr_data is a numpy.ndarray buffer containing uint8 values representing the BGR (not RGB)

     5603:     values of each pixels

     5604:

     5605:     """

     5606:

    +5607:     assert screen_width > 0, "Argument screen_width must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_width > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_width_must_be_0);
          __PYX_ERR(1, 5607, __pyx_L1_error)
        }
      }
      #endif

    +5608:     assert screen_height > 0, "Argument screen_height must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_height > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_height_must_be_0);
          __PYX_ERR(1, 5608, __pyx_L1_error)
        }
      }
      #endif

     5609:

    +5610:     cdef int [:] distances = numpy.empty((screen_width * screen_height * 4), int32)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_2, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5610, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
        __pyx_t_2 = 0;
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5610, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5610, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_distances = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +5611:     cdef int [:] angles    = numpy.empty((screen_width * screen_height * 4), int32)

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5611, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_angles = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +5612:     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 4), int32)

      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_numpy); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyInt_FromSsize_t(((__pyx_v_screen_width * __pyx_v_screen_height) * 4)); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_7, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_6, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_6, __pyx_t_4);
        __pyx_t_7 = 0;
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5612, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_shades = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     5613:

    +5614:     surface = pygame.image.load("../Assets/space1.jpg").convert()

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pygame); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_kp_s_Assets_space1_jpg) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Assets_space1_jpg);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_convert); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_surface = __pyx_t_1;
      __pyx_t_1 = 0;

     5615:

    +5616:     cdef int s_width  = 512

      __pyx_v_s_width = 0x200;

    +5617:     cdef int s_height = 512

      __pyx_v_s_height = 0x200;

    +5618:     surface = smoothscale(surface, (s_width, s_height))

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_s_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_s_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface);
        __Pyx_GIVEREF(__pyx_v_surface);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_v_surface);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5618, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_1);
      __pyx_t_1 = 0;

    +5619:     cdef unsigned char [::1] scr_data = surface.get_buffer()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(1, 5619, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_scr_data = __pyx_t_9;
      __pyx_t_9.memview = NULL;
      __pyx_t_9.data = NULL;

     5620:

    +5621:     cdef  int x, y, i = 0

      __pyx_v_i = 0;

     5622:

     5623:

    +5624:     for y in range(0, screen_height * 2):

      __pyx_t_10 = (__pyx_v_screen_height * 2);
      __pyx_t_11 = __pyx_t_10;
      for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_11; __pyx_t_6+=1) {
        __pyx_v_y = __pyx_t_6;

    +5625:         sqy = pow(y - screen_height, 2)

        __pyx_v_sqy = pow((__pyx_v_y - __pyx_v_screen_height), 2.0);

    +5626:         for x in range(0, screen_width * 2):

        __pyx_t_12 = (__pyx_v_screen_width * 2);
        __pyx_t_13 = __pyx_t_12;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_x = __pyx_t_14;

    +5627:             sqx = pow(x - screen_width, 2)

          __pyx_v_sqx = pow((__pyx_v_x - __pyx_v_screen_width), 2.0);

    +5628:             if (sqx + sqy) == 0:

          __pyx_t_15 = (((__pyx_v_sqx + __pyx_v_sqy) == 0.0) != 0);
          if (__pyx_t_15) {
    /* … */
            goto __pyx_L7;
          }

    +5629:                 distances[i] = 1

            __pyx_t_16 = __pyx_v_i;
            *((int *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_16 * __pyx_v_distances.strides[0]) )) = 1;

     5630:             else:

    +5631:                 distances[i] = <int>(floor(

            __pyx_t_19 = ((int)floor((__pyx_t_17 / __pyx_t_18)));
    /* … */
            __pyx_t_16 = __pyx_v_i;
            *((int *) ( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_16 * __pyx_v_distances.strides[0]) )) = __Pyx_mod_int(__pyx_t_19, __pyx_v_s_height);
          }
          __pyx_L7:;

    +5632:                     32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height

          /*else*/ {
    /* … */
            __pyx_t_17 = (32.0 * ((float)__pyx_v_s_height));
    /* … */
            __pyx_t_18 = ((float)sqrt((__pyx_v_sqx + __pyx_v_sqy)));
            if (unlikely(__pyx_t_18 == 0)) {
              PyErr_SetString(PyExc_ZeroDivisionError, "float division");
              __PYX_ERR(1, 5632, __pyx_L1_error)
            }
    /* … */
            if (unlikely(__pyx_v_s_height == 0)) {
              PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
              __PYX_ERR(1, 5632, __pyx_L1_error)
            }

    +5633:             angles[i]    = <int>round_c(<float>s_width * atan2(y - screen_height,

          __pyx_t_20 = (((float)__pyx_v_s_width) * atan2((__pyx_v_y - __pyx_v_screen_height), (__pyx_v_x - __pyx_v_screen_width)));
    /* … */
          __pyx_t_16 = __pyx_v_i;
          *((int *) ( /* dim=0 */ (__pyx_v_angles.data + __pyx_t_16 * __pyx_v_angles.strides[0]) )) = ((int)round((__pyx_t_20 / ((float)__pyx_v_12PygameShader_6shader_M_PI))));

    +5634:                                                              x - screen_width) / (<float>M_PI))

          if (unlikely(((float)__pyx_v_12PygameShader_6shader_M_PI) == 0)) {
            PyErr_SetString(PyExc_ZeroDivisionError, "float division");
            __PYX_ERR(1, 5634, __pyx_L1_error)
          }

    +5635:             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)

          __pyx_t_21 = 0xFF;
          __pyx_t_20 = (sqrt((__pyx_v_sqx + __pyx_v_sqy)) * 10.0);
          if (((__pyx_t_21 < __pyx_t_20) != 0)) {
            __pyx_t_22 = __pyx_t_21;
          } else {
            __pyx_t_22 = __pyx_t_20;
          }
          __pyx_t_16 = __pyx_v_i;
          *((int *) ( /* dim=0 */ (__pyx_v_shades.data + __pyx_t_16 * __pyx_v_shades.strides[0]) )) = ((int)__pyx_t_22);

    +5636:             i = i + 1

          __pyx_v_i = (__pyx_v_i + 1);
        }
      }

     5637:

    +5638:     return distances, angles, shades, scr_data

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_distances, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_angles, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_shades, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_scr_data, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_7);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

     5639:

     5640:

     5641:

     5642:

     5643: @cython.binding(False)

     5644: @cython.boundscheck(False)

     5645: @cython.wraparound(False)

     5646: @cython.nonecheck(False)

     5647: @cython.cdivision(True)

    +5648: cpdef tunnel_render32(

    static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_tunnel_render32(int __pyx_v_t, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, int __pyx_v_screen_w2, int __pyx_v_screen_h2, __Pyx_memviewslice __pyx_v_distances, __Pyx_memviewslice __pyx_v_angles, __Pyx_memviewslice __pyx_v_shades, __Pyx_memviewslice __pyx_v_scr_data, __Pyx_memviewslice __pyx_v_dest_array, CYTHON_UNUSED int __pyx_skip_dispatch) {
      int __pyx_v_s_width;
      int __pyx_v_s_height;
      float __pyx_v_timer;
      int __pyx_v_shiftx;
      int __pyx_v_shifty;
      int __pyx_v_centerx;
      int __pyx_v_centery;
      int __pyx_v_stride;
      int __pyx_v_dest_ofs;
      int __pyx_v_src_ofs;
      int __pyx_v_u;
      int __pyx_v_v;
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_pix_ofs;
      int __pyx_v_shade;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_render32", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_XDECREF(__pyx_t_14);
      __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_140tunnel_render32[] = "\n    TUNNEL EFFECT RENDERING METHOD\n\n    * Always call the method tunnel_modeling32 outside of your game main loop\n    before calling this method (from\n      the main loop)\n\n    * Return a pygame surface containing the tunnel rendering effect, the image\n    is 32 bit (with per-pixel information)\n\n    * Cython cpdef function, this function can be called directly and do not\n    require a hook function.\n\n    * The parameter t must change overtime\n\n    :param t            : integer; linear value (frame number)\n    :param screen_width : integer; Game display size (width in pixels)\n    :param screen_height: integer; Game display size (height in pixels)\n    :param screen_w2    : integer; Game display width / 2.0\n    :param screen_h2    : integer; game display height / 2.0\n    :param distances    : numpy.ndarray buffer containing float values\n    representing the distance of each pixels\n    :param angles       : numpy.ndarray buffer containing float values\n    representing the angle of each pixels\n    :param shades       : numpy.ndarray buffer containing float values\n    representing the shade of each pixels\n    :param scr_data     : numpy.ndarray buffer containing float values\n    representing the BGR values  of each pixels\n    :param dest_array   : numpy.ndarray buffer containing float values\n    representing the RGB values of each pixels\n    :return             : Return a pygame.Surface (w, h) 32 bit with per-pixel information\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_141tunnel_render32(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_t;
      Py_ssize_t __pyx_v_screen_width;
      Py_ssize_t __pyx_v_screen_height;
      int __pyx_v_screen_w2;
      int __pyx_v_screen_h2;
      __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_angles = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_shades = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_scr_data = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_dest_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_render32 (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_t_2,&__pyx_n_s_screen_width,&__pyx_n_s_screen_height,&__pyx_n_s_screen_w2,&__pyx_n_s_screen_h2,&__pyx_n_s_distances,&__pyx_n_s_angles,&__pyx_n_s_shades,&__pyx_n_s_scr_data,&__pyx_n_s_dest_array,0};
        PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
            CYTHON_FALLTHROUGH;
            case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
            CYTHON_FALLTHROUGH;
            case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
            CYTHON_FALLTHROUGH;
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_t_2)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_width)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 1); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_height)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 2); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_w2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 3); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen_h2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 4); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 5); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_angles)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 6); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  7:
            if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shades)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 7); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  8:
            if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scr_data)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 8); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  9:
            if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dest_array)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, 9); __PYX_ERR(1, 5648, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tunnel_render32") < 0)) __PYX_ERR(1, 5648, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 10) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
          values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
          values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
          values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
          values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
          values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        }
        __pyx_v_t = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_t == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5649, __pyx_L3_error)
        __pyx_v_screen_width = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_screen_width == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5650, __pyx_L3_error)
        __pyx_v_screen_height = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_screen_height == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 5651, __pyx_L3_error)
        __pyx_v_screen_w2 = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_screen_w2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5652, __pyx_L3_error)
        __pyx_v_screen_h2 = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_screen_h2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5653, __pyx_L3_error)
        __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(1, 5654, __pyx_L3_error)
        __pyx_v_angles = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_angles.memview)) __PYX_ERR(1, 5655, __pyx_L3_error)
        __pyx_v_shades = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shades.memview)) __PYX_ERR(1, 5656, __pyx_L3_error)
        __pyx_v_scr_data = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scr_data.memview)) __PYX_ERR(1, 5657, __pyx_L3_error)
        __pyx_v_dest_array = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dest_array.memview)) __PYX_ERR(1, 5658, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("tunnel_render32", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5648, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_140tunnel_render32(__pyx_self, __pyx_v_t, __pyx_v_screen_width, __pyx_v_screen_height, __pyx_v_screen_w2, __pyx_v_screen_h2, __pyx_v_distances, __pyx_v_angles, __pyx_v_shades, __pyx_v_scr_data, __pyx_v_dest_array);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_140tunnel_render32(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_t, Py_ssize_t __pyx_v_screen_width, Py_ssize_t __pyx_v_screen_height, int __pyx_v_screen_w2, int __pyx_v_screen_h2, __Pyx_memviewslice __pyx_v_distances, __Pyx_memviewslice __pyx_v_angles, __Pyx_memviewslice __pyx_v_shades, __Pyx_memviewslice __pyx_v_scr_data, __Pyx_memviewslice __pyx_v_dest_array) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tunnel_render32", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_distances.memview)) { __Pyx_RaiseUnboundLocalError("distances"); __PYX_ERR(1, 5648, __pyx_L1_error) }
      if (unlikely(!__pyx_v_angles.memview)) { __Pyx_RaiseUnboundLocalError("angles"); __PYX_ERR(1, 5648, __pyx_L1_error) }
      if (unlikely(!__pyx_v_shades.memview)) { __Pyx_RaiseUnboundLocalError("shades"); __PYX_ERR(1, 5648, __pyx_L1_error) }
      if (unlikely(!__pyx_v_scr_data.memview)) { __Pyx_RaiseUnboundLocalError("scr_data"); __PYX_ERR(1, 5648, __pyx_L1_error) }
      if (unlikely(!__pyx_v_dest_array.memview)) { __Pyx_RaiseUnboundLocalError("dest_array"); __PYX_ERR(1, 5648, __pyx_L1_error) }
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_tunnel_render32(__pyx_v_t, __pyx_v_screen_width, __pyx_v_screen_height, __pyx_v_screen_w2, __pyx_v_screen_h2, __pyx_v_distances, __pyx_v_angles, __pyx_v_shades, __pyx_v_scr_data, __pyx_v_dest_array, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5648, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.tunnel_render32", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_angles, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_shades, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_scr_data, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_dest_array, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     5649:         int t,

     5650:         Py_ssize_t screen_width,

     5651:         Py_ssize_t screen_height,

     5652:         int screen_w2,

     5653:         int screen_h2,

     5654:         int [::1] distances,

     5655:         int [::1] angles,

     5656:         int [::1] shades,

     5657:         unsigned char [::1] scr_data,

     5658:         unsigned char [::1] dest_array):

     5659:

     5660:     """

     5661:     TUNNEL EFFECT RENDERING METHOD

     5662:

     5663:     * Always call the method tunnel_modeling32 outside of your game main loop

     5664:     before calling this method (from

     5665:       the main loop)

     5666:

     5667:     * Return a pygame surface containing the tunnel rendering effect, the image

     5668:     is 32 bit (with per-pixel information)

     5669:

     5670:     * Cython cpdef function, this function can be called directly and do not

     5671:     require a hook function.

     5672:

     5673:     * The parameter t must change overtime

     5674:

     5675:     :param t            : integer; linear value (frame number)

     5676:     :param screen_width : integer; Game display size (width in pixels)

     5677:     :param screen_height: integer; Game display size (height in pixels)

     5678:     :param screen_w2    : integer; Game display width / 2.0

     5679:     :param screen_h2    : integer; game display height / 2.0

     5680:     :param distances    : numpy.ndarray buffer containing float values

     5681:     representing the distance of each pixels

     5682:     :param angles       : numpy.ndarray buffer containing float values

     5683:     representing the angle of each pixels

     5684:     :param shades       : numpy.ndarray buffer containing float values

     5685:     representing the shade of each pixels

     5686:     :param scr_data     : numpy.ndarray buffer containing float values

     5687:     representing the BGR values  of each pixels

     5688:     :param dest_array   : numpy.ndarray buffer containing float values

     5689:     representing the RGB values of each pixels

     5690:     :return             : Return a pygame.Surface (w, h) 32 bit with per-pixel information

     5691:     """

     5692:

    +5693:     assert screen_width > 0, "Argument screen_width must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_width > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_width_must_be_0);
          __PYX_ERR(1, 5693, __pyx_L1_error)
        }
      }
      #endif

    +5694:     assert screen_height > 0, "Argument screen_height must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_height > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_height_must_be_0);
          __PYX_ERR(1, 5694, __pyx_L1_error)
        }
      }
      #endif

    +5695:     assert screen_w2 > 0, "Argument screen_w2 must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_w2 > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_w2_must_be_0);
          __PYX_ERR(1, 5695, __pyx_L1_error)
        }
      }
      #endif

    +5696:     assert screen_h2 > 0, "Argument screen_h2 must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_screen_h2 > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_screen_h2_must_be_0);
          __PYX_ERR(1, 5696, __pyx_L1_error)
        }
      }
      #endif

     5697:

     5698:     cdef:

    +5699:         int s_width  = 512

      __pyx_v_s_width = 0x200;

    +5700:         int s_height = 512

      __pyx_v_s_height = 0x200;

    +5701:         float timer = t * <float>1e-3

      __pyx_v_timer = (__pyx_v_t * ((float)1e-3));

    +5702:         int shiftx  = <int>floor(s_width * timer)

      __pyx_v_shiftx = ((int)floor((__pyx_v_s_width * __pyx_v_timer)));

    +5703:         int shifty  = <int>floor(s_height * <float>0.25 * timer)

      __pyx_v_shifty = ((int)floor(((__pyx_v_s_height * ((float)0.25)) * __pyx_v_timer)));

    +5704:         int centerx = <int>(screen_w2 +

      __pyx_v_centerx = ((int)(__pyx_v_screen_w2 + ((float)floor(((__pyx_v_screen_w2 >> 1) * ((float)sin((__pyx_v_timer * ((float)0.25)))))))));

     5705:                             <float>floor((screen_w2 >> 1) * <float>sin(timer * <float>0.25)))

    +5706:         int centery = <int>(screen_h2 + <float>floor(

      __pyx_v_centery = ((int)(__pyx_v_screen_h2 + ((float)floor(((__pyx_v_screen_h2 >> 1) * ((float)sin((__pyx_v_timer * ((float)0.5)))))))));

     5707:             (screen_h2 >> 1) * <float>sin(timer * <float>0.5)))

    +5708:         int stride  = <int>screen_width * 2

      __pyx_v_stride = (((int)__pyx_v_screen_width) * 2);

    +5709:         int dest_ofs = 0

      __pyx_v_dest_ofs = 0;

     5710:         int src_ofs

     5711:         int u, v, x, y

     5712:         int pix_ofs, shade

     5713:

     5714:     # with nogil:

     5715:     #     for y in range(0,  screen_height):

     5716:     #         srcOfs = y * stride + centerx + centery * stride

     5717:     #         for x in range(0, screen_width):

     5718:     #             u = (distances[srcOfs] + shiftx) & 0xff

     5719:     #             v = (angles[srcOfs] + shifty) & 0xff

     5720:     #             while v < 0:

     5721:     #               v = v + s_height

     5722:     #

     5723:     #             shade = <int>(shades[srcOfs] * ONE_255)

     5724:     #

     5725:     #             pixOfs = (u + (v << 9)) << 3

     5726:     #             dest_array[dest_ofs    ] = scr_data[pixOfs + 2] * shade

     5727:     #             dest_array[dest_ofs + 1] = scr_data[pixOfs + 1] * shade

     5728:     #             dest_array[dest_ofs + 2] = scr_data[pixOfs + 0] * shade

     5729:     #             dest_array[dest_ofs + 3] = 255 # scr_data[pixOfs + 4] * shade

     5730:     #

     5731:     #             dest_ofs = dest_ofs + 4

     5732:     #             srcOfs  = srcOfs + 1

     5733:     #

     5734:     # return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")

     5735:

    +5736:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     5737:

    +5738:         for y in prange(0, screen_height, schedule='static', num_threads=4):

            __pyx_t_1 = __pyx_v_screen_height;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_3 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_dest_ofs) lastprivate(__pyx_v_pix_ofs) lastprivate(__pyx_v_shade) lastprivate(__pyx_v_src_ofs) lastprivate(__pyx_v_u) lastprivate(__pyx_v_v) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(4)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_dest_ofs = ((int)0xbad0bad0);
                                __pyx_v_pix_ofs = ((int)0xbad0bad0);
                                __pyx_v_shade = ((int)0xbad0bad0);
                                __pyx_v_src_ofs = ((int)0xbad0bad0);
                                __pyx_v_u = ((int)0xbad0bad0);
                                __pyx_v_v = ((int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);

     5739:

    +5740:             for x in range(0, screen_width):

                                __pyx_t_4 = __pyx_v_screen_width;
                                __pyx_t_5 = __pyx_t_4;
                                for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
                                  __pyx_v_x = __pyx_t_6;

     5741:

    +5742:                 src_ofs = y * stride + centerx + centery * stride + x

                                  __pyx_v_src_ofs = ((((__pyx_v_y * __pyx_v_stride) + __pyx_v_centerx) + (__pyx_v_centery * __pyx_v_stride)) + __pyx_v_x);

    +5743:                 dest_ofs = (y * screen_height + x) << 2

                                  __pyx_v_dest_ofs = (((__pyx_v_y * __pyx_v_screen_height) + __pyx_v_x) << 2);

     5744:

    +5745:                 u = (distances[src_ofs] + shiftx) & 0xff

                                  __pyx_t_7 = __pyx_v_src_ofs;
                                  __pyx_v_u = (((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_distances.data) + __pyx_t_7)) ))) + __pyx_v_shiftx) & 0xff);

    +5746:                 v = (angles[src_ofs] + shifty) & 0xff

                                  __pyx_t_7 = __pyx_v_src_ofs;
                                  __pyx_v_v = (((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_angles.data) + __pyx_t_7)) ))) + __pyx_v_shifty) & 0xff);

     5747:

    +5748:                 shade = <int> (shades[src_ofs] * ONE_255)

                                  __pyx_t_7 = __pyx_v_src_ofs;
                                  __pyx_v_shade = ((int)((*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shades.data) + __pyx_t_7)) ))) * 0.00392156862745098));

     5749:

    +5750:                 pix_ofs = (u + (v << 9)) << 3

                                  __pyx_v_pix_ofs = ((__pyx_v_u + (__pyx_v_v << 9)) << 3);

     5751:

    +5752:                 dest_array[dest_ofs] = scr_data[pix_ofs + 2] * shade

                                  __pyx_t_7 = (__pyx_v_pix_ofs + 2);
                                  __pyx_t_8 = __pyx_v_dest_ofs;
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

    +5753:                 dest_array[dest_ofs + 1] = scr_data[pix_ofs + 1] * shade

                                  __pyx_t_7 = (__pyx_v_pix_ofs + 1);
                                  __pyx_t_8 = (__pyx_v_dest_ofs + 1);
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

    +5754:                 dest_array[dest_ofs + 2] = scr_data[pix_ofs + 0] * shade

                                  __pyx_t_7 = (__pyx_v_pix_ofs + 0);
                                  __pyx_t_8 = (__pyx_v_dest_ofs + 2);
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_8)) )) = ((*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_scr_data.data) + __pyx_t_7)) ))) * __pyx_v_shade);

    +5755:                 dest_array[dest_ofs + 3] = 255

                                  __pyx_t_7 = (__pyx_v_dest_ofs + 3);
                                  *((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_dest_array.data) + __pyx_t_7)) )) = 0xFF;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     5756:

    +5757:     return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGBA")

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_pygame); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_image); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __pyx_memoryview_fromslice(__pyx_v_dest_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_screen_width); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = PyInt_FromSsize_t(__pyx_v_screen_height); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5757, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13);
      __pyx_t_12 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_11, __pyx_t_14, __pyx_n_s_RGBA};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_t_11, __pyx_t_14, __pyx_n_s_RGBA};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5757, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_t_14);
        __Pyx_INCREF(__pyx_n_s_RGBA);
        __Pyx_GIVEREF(__pyx_n_s_RGBA);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_6, __pyx_n_s_RGBA);
        __pyx_t_11 = 0;
        __pyx_t_14 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5757, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_r = __pyx_t_9;
      __pyx_t_9 = 0;
      goto __pyx_L0;

     5758:

     5759:

     5760:

     5761:

     5762: # @cython.binding(True)

     5763: # @cython.boundscheck(True)

     5764: # @cython.wraparound(True)

     5765: # @cython.nonecheck(True)

     5766: # @cython.cdivision(False)

     5767: # cpdef tunnel_modeling24(int screen_width, int screen_height):

     5768: #

     5769: #     cdef int [:] distances = numpy.empty((screen_width * screen_height * 3), int32)

     5770: #     cdef int [:] angles    = numpy.empty((screen_width * screen_height * 3), int32)

     5771: #     cdef int [:] shades    = numpy.empty((screen_width * screen_height * 3), int32)

     5772: #

     5773: #     surface = pygame.image.load("Assets\\Graphics\\Background\\space1.jpg").convert()

     5774: #

     5775: #     cdef int s_width  = 512

     5776: #     cdef int s_height = 512

     5777: #     surface = pygame.transform.smoothscale(surface, (s_width, s_height))

     5778: #     cdef unsigned char [:] scr_data = numpy.frombuffer(

     5779: #     pygame.image.tostring(surface, 'RGB'), uint8).copy()

     5780: #

     5781: #     cdef  int x, y, i = 0

     5782: #

     5783: #     for y in range(0, screen_height * 2):

     5784: #         sqy = pow(y - screen_height, 2)

     5785: #         for x in range(0, screen_width * 2):

     5786: #             sqx = pow(x - screen_width, 2)

     5787: #

     5788: #             i /= 4

     5789: #             i *= 3

     5790: #             if (sqx + sqy) == 0:

     5791: #                 distances[i] = 1

     5792: #             else:

     5793: #                 distances[i] = <int>(

     5794: #                 floor(32 * <float>s_height / <float>sqrt(sqx + sqy))) % s_height

     5795: #             angles[i]    = <int>round(

     5796: #             <float>s_width * atan2(y - screen_height, x - screen_width) / M_PI)

     5797: #             shades[i]    = <int>min(sqrt(sqx + sqy)*10, 255)

     5798: #             i = i + 1

     5799: #

     5800: #     return distances, angles, shades, scr_data

     5801: #

     5802:

     5803: # @cython.binding(True)

     5804: # @cython.boundscheck(True)

     5805: # @cython.wraparound(True)

     5806: # @cython.nonecheck(True)

     5807: # @cython.cdivision(True)

     5808: # cpdef tunnel_render24(int t,

     5809: #                     int screen_width,

     5810: #                     int screen_height,

     5811: #                     int screen_w2,

     5812: #                     int screen_h2,

     5813: #                     int [:] distances,

     5814: #                     int [:] angles,

     5815: #                     int [:] shades,

     5816: #                     unsigned char [:] scr_data,

     5817: #                     unsigned char [:] dest_array):

     5818: #     cdef:

     5819: #         int s_width  = 512

     5820: #         int s_height = 512

     5821: #         float timer = t * 1e-3

     5822: #         int shiftx  = <int>floor(s_width * timer)

     5823: #         int shifty  = <int>floor(s_height * 0.25 * timer)

     5824: #         int centerx = <int>(screen_w2 + floor((screen_w2 >> 1) * sin(timer * 0.25)))

     5825: #         int centery = <int>(screen_h2 + floor((screen_h2 >> 1) * sin(timer * 0.5)))

     5826: #         int stride  = screen_width * 2

     5827: #         int destOfs = 0

     5828: #         int srcOfs

     5829: #         int u, v, x, y

     5830: #         int pixOfs, shade

     5831: #

     5832: #

     5833: #     with nogil:

     5834: #

     5835: #         for y in prange(0,  screen_height,  schedule='static', num_threads=THREADS):

     5836: #             for x in range(0, screen_width):

     5837: #

     5838: #

     5839: #                 srcOfs = (y * stride * 3 + centerx + centery * stride + x * 3)

     5840: #

     5841: #                 destOfs = (y * screen_height*3 + x * 3)

     5842: #

     5843: #

     5844: #                 u = (distances[srcOfs] + shiftx) & 0xff

     5845: #                 v = (angles[srcOfs] + shifty) & 0xff

     5846: #

     5847: #

     5848: #                 #shade = <int>(shades[srcOfs] * ONE_255)

     5849: #

     5850: #                 pixOfs = (u + (v << 9)) << 1

     5851: #

     5852: #                 dest_array[destOfs    ] = scr_data[pixOfs + 2] #* shade

     5853: #                 dest_array[destOfs + 1] = scr_data[pixOfs + 1] #* shade

     5854: #                 dest_array[destOfs + 2] = scr_data[pixOfs + 0] #* shade

     5855: #

     5856: #

     5857: #     return pygame.image.frombuffer(dest_array, (screen_width, screen_height), "RGB")

     5858:

     5859:

     5860:

     5861:

     5862:

     5863: @cython.binding(False)

     5864: @cython.boundscheck(False)

     5865: @cython.wraparound(False)

     5866: @cython.nonecheck(False)

     5867: @cython.cdivision(True)

    +5868: cpdef tuple heat_map(int wavelength, float gamma=1.0):

    static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_heat_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heat_map *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      struct rgb_color_int __pyx_v_rgb_c;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heat_map", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_142heat_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    This function return a tuple (R,G,B) corresponding to the\n    color wavelength (wavelength_to_rgb is an External C\n    routine with pre-defined wavelength such as :\n    Color   Wavelength(nm) Frequency(THz)\n    Red     620-750        484-400\n    Orange  590-620        508-484\n    Yellow  570-590        526-508\n    Green   495-570        606-526\n    Blue    450-495        668-606\n    Violet  380-450        789-668\n    e.g If the routine is called with a wavelength of 620, the returned color\n    will be a red gradient\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_143heat_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_wavelength;
      float __pyx_v_gamma;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heat_map (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heat_map") < 0)) __PYX_ERR(1, 5868, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5868, __pyx_L3_error)
        if (values[1]) {
          __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 5868, __pyx_L3_error)
        } else {
          __pyx_v_gamma = ((float)1.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("heat_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5868, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_142heat_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_142heat_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heat_map", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_heat_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5868, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.heat_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_heat_map {
      int __pyx_n;
      float gamma;
    };

     5869:     """

     5870:     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH

     5871:

     5872:     Cython cpdef function, this function can be called directly and do not require a

     5873:     hook function.

     5874:

     5875:     This function return a tuple (R,G,B) corresponding to the

     5876:     color wavelength (wavelength_to_rgb is an External C

     5877:     routine with pre-defined wavelength such as :

     5878:     Color   Wavelength(nm) Frequency(THz)

     5879:     Red     620-750        484-400

     5880:     Orange  590-620        508-484

     5881:     Yellow  570-590        526-508

     5882:     Green   495-570        606-526

     5883:     Blue    450-495        668-606

     5884:     Violet  380-450        789-668

     5885:     e.g If the routine is called with a wavelength of 620, the returned color

     5886:     will be a red gradient

     5887:

     5888:     :param wavelength   : integer; Wavelength

     5889:     :param gamma        : float; Gamma value

     5890:     :return             : tuple RGB values (0 ... 255)

     5891:     """

     5892:     cdef  rgb_color_int rgb_c

    +5893:     rgb_c = wavelength_to_rgb(wavelength, gamma)

      __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

    +5894:     return rgb_c.r, rgb_c.g, rgb_c.b

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;

     5895:

     5896: @cython.binding(False)

     5897: @cython.boundscheck(False)

     5898: @cython.wraparound(False)

     5899: @cython.nonecheck(False)

     5900: @cython.cdivision(True)

    +5901: cpdef tuple custom_map(int wavelength, int [:] color_array_, float gamma=1.0):

    static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_custom_map(int __pyx_v_wavelength, __Pyx_memviewslice __pyx_v_color_array_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_custom_map *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      struct rgb_color_int __pyx_v_rgb_c;
      int *__pyx_v_p;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("custom_map", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_144custom_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    This function return a tuple (R,G,B) corresponding to the\n    color wavelength define in color_array_\n    (wavelength_to_rgb_custom is an External C\n    routine with customize wavelength and allow the user to defined\n    a customize palette according to an input value)\n\n    example for a Fire palette\n    arr = numpy.array(\n        [0, 1,       # violet is not used\n         0, 1,       # blue is not used\n         0, 1,       # green is not used\n         2, 619,     # yellow, return a yellow gradient for values [2...619]\n         620, 650,   # orange return a orange gradient for values [620 ... 650]\n         651, 660    # red return a red gradient for values [651 ... 660]\n         ], numpy.int)\n\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :param color_array_ : numpy array containing the min and max of each color (red,\n    orange, yellow, green, blue, violet)\n    :return             : tuple RGB values (0 ... 255)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_145custom_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_wavelength;
      __Pyx_memviewslice __pyx_v_color_array_ = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_gamma;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("custom_map (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_color_array,&__pyx_n_s_gamma,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color_array)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("custom_map", 0, 2, 3, 1); __PYX_ERR(1, 5901, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
              if (value) { values[2] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "custom_map") < 0)) __PYX_ERR(1, 5901, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5901, __pyx_L3_error)
        __pyx_v_color_array_ = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_color_array_.memview)) __PYX_ERR(1, 5901, __pyx_L3_error)
        if (values[2]) {
          __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 5901, __pyx_L3_error)
        } else {
          __pyx_v_gamma = ((float)1.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("custom_map", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5901, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_144custom_map(__pyx_self, __pyx_v_wavelength, __pyx_v_color_array_, __pyx_v_gamma);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_144custom_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, __Pyx_memviewslice __pyx_v_color_array_, float __pyx_v_gamma) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("custom_map", 0);
      __Pyx_XDECREF(__pyx_r);
      if (unlikely(!__pyx_v_color_array_.memview)) { __Pyx_RaiseUnboundLocalError("color_array_"); __PYX_ERR(1, 5901, __pyx_L1_error) }
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_custom_map(__pyx_v_wavelength, __pyx_v_color_array_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5901, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.custom_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_color_array_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_custom_map {
      int __pyx_n;
      float gamma;
    };

     5902:     """

     5903:     RETURN AN RGB COLOR VALUE MATCHING A CUSTOM WAVELENGTH

     5904:

     5905:     Cython cpdef function, this function can be called directly and do not require a

     5906:     hook function.

     5907:

     5908:     This function return a tuple (R,G,B) corresponding to the

     5909:     color wavelength define in color_array_

     5910:     (wavelength_to_rgb_custom is an External C

     5911:     routine with customize wavelength and allow the user to defined

     5912:     a customize palette according to an input value)

     5913:

     5914:     example for a Fire palette

     5915:     arr = numpy.array(

     5916:         [0, 1,       # violet is not used

     5917:          0, 1,       # blue is not used

     5918:          0, 1,       # green is not used

     5919:          2, 619,     # yellow, return a yellow gradient for values [2...619]

     5920:          620, 650,   # orange return a orange gradient for values [620 ... 650]

     5921:          651, 660    # red return a red gradient for values [651 ... 660]

     5922:          ], numpy.int)

     5923:

     5924:

     5925:     :param wavelength   : integer; Wavelength

     5926:     :param gamma        : float; Gamma value

     5927:     :param color_array_ : numpy array containing the min and max of each color (red,

     5928:     orange, yellow, green, blue, violet)

     5929:     :return             : tuple RGB values (0 ... 255)

     5930:     """

     5931:     cdef  rgb_color_int rgb_c

     5932:     cdef int *p

    +5933:     p = &color_array_[0]

      __pyx_t_1 = 0;
      __pyx_v_p = (&(*((int *) ( /* dim=0 */ (__pyx_v_color_array_.data + __pyx_t_1 * __pyx_v_color_array_.strides[0]) ))));

    +5934:     rgb_c = wavelength_to_rgb_custom(wavelength, p, gamma)

      __pyx_v_rgb_c = wavelength_to_rgb_custom(__pyx_v_wavelength, __pyx_v_p, __pyx_v_gamma);

    +5935:     return rgb_c.r, rgb_c.g, rgb_c.b

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5935, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_r = ((PyObject*)__pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L0;

     5936:

     5937:

     5938:

     5939:

    +5940: cdef int i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +5941: HEATMAP = [heat_map(i, 1.0) for i in range(380, 750)]

      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      for (__pyx_t_7 = 0x17C; __pyx_t_7 < 0x2EE; __pyx_t_7+=1) {
        __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
        __pyx_t_38.__pyx_n = 1;
        __pyx_t_38.gamma = 1.0;
        __pyx_t_33 = __pyx_f_12PygameShader_6shader_heat_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_38); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5941, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_33))) __PYX_ERR(1, 5941, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      }
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_HEATMAP, __pyx_t_2) < 0) __PYX_ERR(1, 5941, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     5942:

    +5943: cdef float f_map = (<float>750.0 - <float>380.0 -<float>1.0) / (<float>255.0 * <float>3.0)

      __pyx_v_12PygameShader_6shader_f_map = (((((float)750.0) - ((float)380.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

     5944:

    +5945: cdef unsigned char[:, ::1] heatmap_array = numpy.zeros((750 - 380, 3), numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_tuple__59);
      __Pyx_GIVEREF(__pyx_tuple__59);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__59);
      __Pyx_GIVEREF(__pyx_t_32);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_32);
      __pyx_t_32 = 0;
      __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_2, NULL); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_heatmap_array, 1);
      __pyx_v_12PygameShader_6shader_heatmap_array = __pyx_t_39;
      __pyx_t_39.memview = NULL;
      __pyx_t_39.data = NULL;
    /* … */
      __pyx_tuple__59 = PyTuple_Pack(2, __pyx_int_370, __pyx_int_3); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 5945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__59);
      __Pyx_GIVEREF(__pyx_tuple__59);

     5946: cdef tuple t

    +5947: i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +5948: for t in HEATMAP:

      __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_HEATMAP); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      if (likely(PyList_CheckExact(__pyx_t_32)) || PyTuple_CheckExact(__pyx_t_32)) {
        __pyx_t_2 = __pyx_t_32; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
        __pyx_t_41 = NULL;
      } else {
        __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 5948, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      for (;;) {
        if (likely(!__pyx_t_41)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_32 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 5948, __pyx_L1_error)
            #else
            __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_32);
            #endif
          } else {
            if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_32 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 5948, __pyx_L1_error)
            #else
            __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 5948, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_32);
            #endif
          }
        } else {
          __pyx_t_32 = __pyx_t_41(__pyx_t_2);
          if (unlikely(!__pyx_t_32)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(1, 5948, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_32);
        }
        if (!(likely(PyTuple_CheckExact(__pyx_t_32))||((__pyx_t_32) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_32)->tp_name), 0))) __PYX_ERR(1, 5948, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
        __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_32));
        __Pyx_GIVEREF(__pyx_t_32);
        __pyx_t_32 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +5949:     heatmap_array[i, 0] = t[0]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 5949, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5949, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5949, __pyx_L1_error) }
        __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_44 = 0;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    +5950:     heatmap_array[i, 1] = t[1]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 5950, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5950, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5950, __pyx_L1_error) }
        __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_43 = 1;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    +5951:     heatmap_array[i, 2] = t[2]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 5951, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 5951, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundLocalError("heatmap_array"); __PYX_ERR(1, 5951, __pyx_L1_error) }
        __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_44 = 2;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    +5952:     i += 1

        __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

     5953:

     5954:

     5955:

     5956: @cython.binding(False)

     5957: @cython.boundscheck(False)

     5958: @cython.wraparound(False)

     5959: @cython.nonecheck(False)

     5960: @cython.cdivision(True)

    +5961: cpdef inline void heatmap_convert(object surface_, bint rgb_=True):

    static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_heatmap_convert(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert *__pyx_optional_args) {
      int __pyx_v_rgb_ = ((int)1);
      CYTHON_UNUSED unsigned int __pyx_v_w;
      CYTHON_UNUSED unsigned int __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int __pyx_v_s;
      int __pyx_v_i;
      CYTHON_UNUSED int __pyx_v_size;
      unsigned int __pyx_v_index;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      CYTHON_UNUSED short __pyx_v_bitsize;
      CYTHON_UNUSED short __pyx_v_bytesize;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap_convert", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_rgb_ = __pyx_optional_args->rgb_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_146heatmap_convert[] = "\n    TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface\n    :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_147heatmap_convert(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_rgb_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap_convert (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_rgb,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rgb);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "heatmap_convert") < 0)) __PYX_ERR(1, 5961, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        if (values[1]) {
          __pyx_v_rgb_ = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_rgb_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5961, __pyx_L3_error)
        } else {
          __pyx_v_rgb_ = ((int)1);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("heatmap_convert", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 5961, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_146heatmap_convert(__pyx_self, __pyx_v_surface_, __pyx_v_rgb_);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_146heatmap_convert(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_rgb_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("heatmap_convert", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1.__pyx_n = 1;
      __pyx_t_1.rgb_ = __pyx_v_rgb_;
      __pyx_f_12PygameShader_6shader_heatmap_convert(__pyx_v_surface_, 0, &__pyx_t_1);
      __pyx_t_2 = __Pyx_void_to_None(NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("PygameShader.shader.heatmap_convert", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_heatmap_convert {
      int __pyx_n;
      int rgb_;
    };

     5962:     """

     5963:     TRANSFORM AN IMAGE INTO A HEATMAP EQUIVALENT

     5964:

     5965:     Cython cpdef function, this function can be called directly and do not require a

     5966:     hook function.

     5967:

     5968:     :param surface_ : pygame.Surface

     5969:     :param rgb_     : boolean; True transformed the image into a RGB heatmap model of False (BGR)

     5970:     :return         : void

     5971:     """

     5972:

     5973:     cdef:

     5974:         unsigned int w, h

    +5975:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5975, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 5975, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5975, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5975, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5975, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 5975, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 5975, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5975, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5975, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     5976:

     5977:     cdef:

    +5978:         unsigned char [::1] rgb_array  = surface_.get_buffer()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5978, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 5978, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rgb_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     5979:         unsigned int s

     5980:         int i

    +5981:         int size = rgb_array.size

      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5981, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5981, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 5981, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_9;

    +5982:         unsigned int index = 0

      __pyx_v_index = 0;

     5983:         unsigned char *r

     5984:         unsigned char *g

     5985:         unsigned char *b

    +5986:         short int bitsize = surface_.get_bitsize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5986, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 5986, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bitsize = __pyx_t_10;

    +5987:         short int bytesize = surface_.get_bytesize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5987, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 5987, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bytesize = __pyx_t_10;

     5988:

    +5989:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L6_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L7:;
          }
      }

     5990:         # RGB

    +5991:         if rgb_:

            __pyx_t_11 = (__pyx_v_rgb_ != 0);
            if (__pyx_t_11) {
    /* … */
              goto __pyx_L8;
            }

    +5992:             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):

              __pyx_t_9 = __pyx_v_size;
              __pyx_t_10 = __pyx_v_bytesize;
              if ((__pyx_t_10 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_13 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                  if (__pyx_t_13 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)          __pyx_t_10 = __pyx_v_bytesize;
              if ((__pyx_t_10 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_13 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                  if (__pyx_t_13 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                          #endif /* _OPENMP */
                          for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_13; __pyx_t_12++){
                              {
                                  __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_12);
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_b = ((unsigned char *)1);
                                  __pyx_v_g = ((unsigned char *)1);
                                  __pyx_v_index = ((unsigned int)0xbad0bad0);
                                  __pyx_v_r = ((unsigned char *)1);
                                  __pyx_v_s = ((unsigned int)0xbad0bad0);

     5993:

    +5994:                 r = &rgb_array[i]

                                  __pyx_t_14 = __pyx_v_i;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

    +5995:                 g = &rgb_array[i + 1]

                                  __pyx_t_14 = (__pyx_v_i + 1);
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

    +5996:                 b = &rgb_array[i + 2]

                                  __pyx_t_14 = (__pyx_v_i + 2);
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

     5997:

    +5998:                 s = r[0] + g[0] + b[0]

                                  __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

    +5999:                 index = <int>(s * f_map)

                                  __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_map));

     6000:

    +6001:                 r[0] = <unsigned char>heatmap_array[index, 0]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6001, __pyx_L11_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 0;
                                  (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

    +6002:                 g[0] = <unsigned char>heatmap_array[index, 1]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6002, __pyx_L11_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 1;
                                  (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

    +6003:                 b[0] = <unsigned char>heatmap_array[index, 2]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6003, __pyx_L11_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 2;
                                  (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));
                                  goto __pyx_L14;
                                  __pyx_L11_error:;
                                  {
                                      #ifdef WITH_THREAD
                                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                      #endif
                                      #ifdef _OPENMP
                                      #pragma omp flush(__pyx_parallel_exc_type)
                                      #endif /* _OPENMP */
                                      if (!__pyx_parallel_exc_type) {
                                        __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                        __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                        __Pyx_GOTREF(__pyx_parallel_exc_type);
                                      }
                                      #ifdef WITH_THREAD
                                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                      #endif
                                  }
                                  __pyx_parallel_why = 4;
                                  goto __pyx_L13;
                                  __pyx_L13:;
                                  #ifdef _OPENMP
                                  #pragma omp critical(__pyx_parallel_lastprivates3)
                                  #endif /* _OPENMP */
                                  {
                                      __pyx_parallel_temp0 = __pyx_v_b;
                                      __pyx_parallel_temp1 = __pyx_v_g;
                                      __pyx_parallel_temp2 = __pyx_v_i;
                                      __pyx_parallel_temp3 = __pyx_v_index;
                                      __pyx_parallel_temp4 = __pyx_v_r;
                                      __pyx_parallel_temp5 = __pyx_v_s;
                                  }
                                  __pyx_L14:;
                                  #ifdef _OPENMP
                                  #pragma omp flush(__pyx_parallel_why)
                                  #endif /* _OPENMP */
                              }
                          }
                          #ifdef _OPENMP
                          Py_END_ALLOW_THREADS
                          #else
    {
    #ifdef WITH_THREAD
                          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                          #endif
                          #endif /* _OPENMP */
                          /* Clean up any temporaries */
                          #ifdef WITH_THREAD
                          __Pyx_PyGILState_Release(__pyx_gilstate_save);
                          #endif
                          #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                      }
                  }
                  if (__pyx_parallel_exc_type) {
                    /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                    __pyx_parallel_why = 4;
                  }
                  if (__pyx_parallel_why) {
                    __pyx_v_b = __pyx_parallel_temp0;
                    __pyx_v_g = __pyx_parallel_temp1;
                    __pyx_v_i = __pyx_parallel_temp2;
                    __pyx_v_index = __pyx_parallel_temp3;
                    __pyx_v_r = __pyx_parallel_temp4;
                    __pyx_v_s = __pyx_parallel_temp5;
                    switch (__pyx_parallel_why) {
                          case 4:
                      {
                          #ifdef WITH_THREAD
                          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                          #endif
                          __Pyx_GIVEREF(__pyx_parallel_exc_type);
                          __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                          __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                          #ifdef WITH_THREAD
                          __Pyx_PyGILState_Release(__pyx_gilstate_save);
                          #endif
                      }
                      goto __pyx_L6_error;
                    }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif

     6004:         # BGR

     6005:         else:

    +6006:             for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):

            /*else*/ {
              __pyx_t_9 = __pyx_v_size;
              __pyx_t_10 = __pyx_v_bytesize;
              if ((__pyx_t_10 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                  if (__pyx_t_12 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)          __pyx_t_10 = __pyx_v_bytesize;
              if ((__pyx_t_10 == 0)) abort();
              {
                  #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                      #undef likely
                      #undef unlikely
                      #define likely(x)   (x)
                      #define unlikely(x) (x)
                  #endif
                  __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                  if (__pyx_t_12 > 0)
                  {
                      #ifdef _OPENMP
                      #pragma omp parallel
                      #endif /* _OPENMP */
                      {
                          #ifdef _OPENMP
                          #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                          #endif /* _OPENMP */
                          for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13++){
                              {
                                  __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_13);
                                  /* Initialize private variables to invalid values */
                                  __pyx_v_b = ((unsigned char *)1);
                                  __pyx_v_g = ((unsigned char *)1);
                                  __pyx_v_index = ((unsigned int)0xbad0bad0);
                                  __pyx_v_r = ((unsigned char *)1);
                                  __pyx_v_s = ((unsigned int)0xbad0bad0);

     6007:

    +6008:                 r = &rgb_array[i]

                                  __pyx_t_14 = __pyx_v_i;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

    +6009:                 g = &rgb_array[i + 1]

                                  __pyx_t_14 = (__pyx_v_i + 1);
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

    +6010:                 b = &rgb_array[i + 2]

                                  __pyx_t_14 = (__pyx_v_i + 2);
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_14)) ))));

     6011:

    +6012:                 s = r[0] + g[0] + b[0]

                                  __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

    +6013:                 index = <int>(s * f_map)

                                  __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_map));

     6014:

    +6015:                 r[0] = <unsigned char>heatmap_array[index, 2]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6015, __pyx_L17_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 2;
                                  (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

    +6016:                 g[0] = <unsigned char>heatmap_array[index, 1]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6016, __pyx_L17_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 1;
                                  (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));

    +6017:                 b[0] = <unsigned char>heatmap_array[index, 0]

                                  if (unlikely(!__pyx_v_12PygameShader_6shader_heatmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("heatmap_array"); __PYX_ERR(1, 6017, __pyx_L17_error) }
                                  __pyx_t_15 = __pyx_v_index;
                                  __pyx_t_14 = 0;
                                  (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_heatmap_array.data + __pyx_t_15 * __pyx_v_12PygameShader_6shader_heatmap_array.strides[0]) )) + __pyx_t_14)) ))));
                                  goto __pyx_L20;
                                  __pyx_L17_error:;
                                  {
                                      #ifdef WITH_THREAD
                                      PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                      #endif
                                      #ifdef _OPENMP
                                      #pragma omp flush(__pyx_parallel_exc_type)
                                      #endif /* _OPENMP */
                                      if (!__pyx_parallel_exc_type) {
                                        __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                        __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                        __Pyx_GOTREF(__pyx_parallel_exc_type);
                                      }
                                      #ifdef WITH_THREAD
                                      __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                      #endif
                                  }
                                  __pyx_parallel_why = 4;
                                  goto __pyx_L19;
                                  __pyx_L19:;
                                  #ifdef _OPENMP
                                  #pragma omp critical(__pyx_parallel_lastprivates4)
                                  #endif /* _OPENMP */
                                  {
                                      __pyx_parallel_temp0 = __pyx_v_b;
                                      __pyx_parallel_temp1 = __pyx_v_g;
                                      __pyx_parallel_temp2 = __pyx_v_i;
                                      __pyx_parallel_temp3 = __pyx_v_index;
                                      __pyx_parallel_temp4 = __pyx_v_r;
                                      __pyx_parallel_temp5 = __pyx_v_s;
                                  }
                                  __pyx_L20:;
                                  #ifdef _OPENMP
                                  #pragma omp flush(__pyx_parallel_why)
                                  #endif /* _OPENMP */
                              }
                          }
                          #ifdef _OPENMP
                          Py_END_ALLOW_THREADS
                          #else
    {
    #ifdef WITH_THREAD
                          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                          #endif
                          #endif /* _OPENMP */
                          /* Clean up any temporaries */
                          #ifdef WITH_THREAD
                          __Pyx_PyGILState_Release(__pyx_gilstate_save);
                          #endif
                          #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                      }
                  }
                  if (__pyx_parallel_exc_type) {
                    /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                    __pyx_parallel_why = 4;
                  }
                  if (__pyx_parallel_why) {
                    __pyx_v_b = __pyx_parallel_temp0;
                    __pyx_v_g = __pyx_parallel_temp1;
                    __pyx_v_i = __pyx_parallel_temp2;
                    __pyx_v_index = __pyx_parallel_temp3;
                    __pyx_v_r = __pyx_parallel_temp4;
                    __pyx_v_s = __pyx_parallel_temp5;
                    switch (__pyx_parallel_why) {
                          case 4:
                      {
                          #ifdef WITH_THREAD
                          PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                          #endif
                          __Pyx_GIVEREF(__pyx_parallel_exc_type);
                          __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                          __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                          #ifdef WITH_THREAD
                          __Pyx_PyGILState_Release(__pyx_gilstate_save);
                          #endif
                      }
                      goto __pyx_L6_error;
                    }
                  }
              }
              #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                  #undef likely
                  #undef unlikely
                  #define likely(x)   __builtin_expect(!!(x), 1)
                  #define unlikely(x) __builtin_expect(!!(x), 0)
              #endif
            }
            __pyx_L8:;
          }

     6018:

     6019:

     6020:

     6021: @cython.binding(False)

     6022: @cython.boundscheck(False)

     6023: @cython.wraparound(False)

     6024: @cython.nonecheck(False)

     6025: @cython.cdivision(True)

    +6026: cpdef tuple blue_map(int wavelength, float gamma=1.0):

    static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_blue_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_blue_map *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      struct rgb_color_int __pyx_v_rgb_c;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blue_map", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_148blue_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_149blue_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_wavelength;
      float __pyx_v_gamma;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blue_map (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blue_map") < 0)) __PYX_ERR(1, 6026, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6026, __pyx_L3_error)
        if (values[1]) {
          __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6026, __pyx_L3_error)
        } else {
          __pyx_v_gamma = ((float)1.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("blue_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6026, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_148blue_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_148blue_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blue_map", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_blue_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6026, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.blue_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_blue_map {
      int __pyx_n;
      float gamma;
    };

     6027:     """

     6028:     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH

     6029:

     6030:     Cython cpdef function, this function can be called directly and do not require a

     6031:     hook function.

     6032:

     6033:     :param wavelength   : integer; Wavelength

     6034:     :param gamma        : float; Gamma value

     6035:     :return             : tuple RGB values (0 ... 255)

     6036:     """

     6037:     cdef  rgb_color_int rgb_c

    +6038:     rgb_c = wavelength_to_rgb(wavelength, gamma)

      __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

    +6039:     return rgb_c.r, rgb_c.g, rgb_c.b

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6039, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;

     6040:

    +6041: i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +6042: BLUEMAP = [ blue_map(i, 1.0) for i in range(450, 495) ]

      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      for (__pyx_t_7 = 0x1C2; __pyx_t_7 < 0x1EF; __pyx_t_7+=1) {
        __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
        __pyx_t_45.__pyx_n = 1;
        __pyx_t_45.gamma = 1.0;
        __pyx_t_32 = __pyx_f_12PygameShader_6shader_blue_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_45); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6042, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_32);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_32))) __PYX_ERR(1, 6042, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      }
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLUEMAP, __pyx_t_2) < 0) __PYX_ERR(1, 6042, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     6043:

    +6044: cdef float f_bluemap = (<float>495.0 - <float>450.0 - <float>1.0) / (<float>255.0 * <float>3.0)

      __pyx_v_12PygameShader_6shader_f_bluemap = (((((float)495.0) - ((float)450.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

     6045:

    +6046: cdef unsigned char[:, ::1] bluemap_array = numpy.zeros((495 - 450, 3), numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_tuple__60);
      __Pyx_GIVEREF(__pyx_tuple__60);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__60);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_33);
      __pyx_t_33 = 0;
      __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_32, __pyx_t_2, NULL); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_33, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_bluemap_array, 1);
      __pyx_v_12PygameShader_6shader_bluemap_array = __pyx_t_39;
      __pyx_t_39.memview = NULL;
      __pyx_t_39.data = NULL;
    /* … */
      __pyx_tuple__60 = PyTuple_Pack(2, __pyx_int_45, __pyx_int_3); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 6046, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__60);
      __Pyx_GIVEREF(__pyx_tuple__60);

     6047:

    +6048: i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +6049: for t in BLUEMAP:

      __Pyx_GetModuleGlobalName(__pyx_t_33, __pyx_n_s_BLUEMAP); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      if (likely(PyList_CheckExact(__pyx_t_33)) || PyTuple_CheckExact(__pyx_t_33)) {
        __pyx_t_2 = __pyx_t_33; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
        __pyx_t_41 = NULL;
      } else {
        __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_33); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 6049, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      for (;;) {
        if (likely(!__pyx_t_41)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_33 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_33); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6049, __pyx_L1_error)
            #else
            __pyx_t_33 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_33);
            #endif
          } else {
            if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_33 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_33); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6049, __pyx_L1_error)
            #else
            __pyx_t_33 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6049, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_33);
            #endif
          }
        } else {
          __pyx_t_33 = __pyx_t_41(__pyx_t_2);
          if (unlikely(!__pyx_t_33)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(1, 6049, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_33);
        }
        if (!(likely(PyTuple_CheckExact(__pyx_t_33))||((__pyx_t_33) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_33)->tp_name), 0))) __PYX_ERR(1, 6049, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
        __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_33));
        __Pyx_GIVEREF(__pyx_t_33);
        __pyx_t_33 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +6050:     bluemap_array[i, 0] = t[0]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6050, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6050, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6050, __pyx_L1_error) }
        __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_43 = 0;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    +6051:     bluemap_array[i, 1] = t[1]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6051, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6051, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6051, __pyx_L1_error) }
        __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_44 = 1;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    +6052:     bluemap_array[i, 2] = t[2]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6052, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6052, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundLocalError("bluemap_array"); __PYX_ERR(1, 6052, __pyx_L1_error) }
        __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_43 = 2;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    +6053:     i += 1

        __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

     6054:

     6055: @cython.binding(False)

     6056: @cython.boundscheck(False)

     6057: @cython.wraparound(False)

     6058: @cython.nonecheck(False)

     6059: @cython.cdivision(True)

    +6060: cpdef inline void bluescale(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_bluescale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      CYTHON_UNUSED unsigned int __pyx_v_w;
      CYTHON_UNUSED unsigned int __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int __pyx_v_s;
      int __pyx_v_i;
      CYTHON_UNUSED int __pyx_v_size;
      unsigned int __pyx_v_index;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      CYTHON_UNUSED short __pyx_v_bitsize;
      CYTHON_UNUSED short __pyx_v_bytesize;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bluescale", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.bluescale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_150bluescale[] = "\n    MAP AN IMAGE INTO A BLUE EQUIVALENT FORMAT\n    THIS ALGORITHM IS USING THE WAVELENGTH FROM 450-495 NM TO\n    REPRESENT THE IMAGE IN BLUE SHADES\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface to transform\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_151bluescale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bluescale (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_150bluescale(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_150bluescale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bluescale", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_bluescale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6060, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.bluescale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     6061:     """

     6062:     MAP AN IMAGE INTO A BLUE EQUIVALENT FORMAT

     6063:     THIS ALGORITHM IS USING THE WAVELENGTH FROM 450-495 NM TO

     6064:     REPRESENT THE IMAGE IN BLUE SHADES

     6065:

     6066:     Cython cpdef function, this function can be called directly and do not require a

     6067:     hook function.

     6068:

     6069:     :param surface_ : pygame.Surface to transform

     6070:     :return         : void

     6071:     """

     6072:

     6073:

     6074:     cdef:

     6075:         unsigned int w, h

    +6076:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 6076, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6076, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6076, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6076, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 6076, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 6076, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6076, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6076, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     6077:

     6078:     cdef:

    +6079:         unsigned char [::1] rgb_array  = surface_.get_buffer()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6079, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6079, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rgb_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     6080:         unsigned int s

     6081:         int i

    +6082:         int size = rgb_array.size

      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6082, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6082, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_9;

    +6083:         unsigned int index = 0

      __pyx_v_index = 0;

     6084:         unsigned char *r

     6085:         unsigned char *g

     6086:         unsigned char *b

    +6087:         short int bitsize = surface_.get_bitsize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6087, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bitsize = __pyx_t_10;

    +6088:         short int bytesize = surface_.get_bytesize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6088, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bytesize = __pyx_t_10;

     6089:

    +6090:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L6_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L7:;
          }
      }

    +6091:         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):

            __pyx_t_9 = __pyx_v_size;
            __pyx_t_10 = __pyx_v_bytesize;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)        __pyx_t_10 = __pyx_v_bytesize;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                            {
                                __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_11);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_index = ((unsigned int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_s = ((unsigned int)0xbad0bad0);

     6092:

    +6093:             r = &rgb_array[i]

                                __pyx_t_13 = __pyx_v_i;
                                __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

    +6094:             g = &rgb_array[i + 1]

                                __pyx_t_13 = (__pyx_v_i + 1);
                                __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

    +6095:             b = &rgb_array[i + 2]

                                __pyx_t_13 = (__pyx_v_i + 2);
                                __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

     6096:

    +6097:             s = r[0] + g[0] + b[0]

                                __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

    +6098:             index = <int>(s * f_bluemap)

                                __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_bluemap));

     6099:

    +6100:             r[0] = <unsigned char>bluemap_array[index, 2]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6100, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 2;
                                (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));

    +6101:             g[0] = <unsigned char>bluemap_array[index, 1]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6101, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 1;
                                (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));

    +6102:             b[0] = <unsigned char>bluemap_array[index, 0]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_bluemap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("bluemap_array"); __PYX_ERR(1, 6102, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 0;
                                (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_bluemap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_bluemap_array.strides[0]) )) + __pyx_t_13)) ))));
                                goto __pyx_L13;
                                __pyx_L10_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L12;
                                __pyx_L12:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates5)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_b;
                                    __pyx_parallel_temp1 = __pyx_v_g;
                                    __pyx_parallel_temp2 = __pyx_v_i;
                                    __pyx_parallel_temp3 = __pyx_v_index;
                                    __pyx_parallel_temp4 = __pyx_v_r;
                                    __pyx_parallel_temp5 = __pyx_v_s;
                                }
                                __pyx_L13:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_b = __pyx_parallel_temp0;
                  __pyx_v_g = __pyx_parallel_temp1;
                  __pyx_v_i = __pyx_parallel_temp2;
                  __pyx_v_index = __pyx_parallel_temp3;
                  __pyx_v_r = __pyx_parallel_temp4;
                  __pyx_v_s = __pyx_parallel_temp5;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L6_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     6103:

     6104:

     6105:

     6106: @cython.binding(False)

     6107: @cython.boundscheck(False)

     6108: @cython.wraparound(False)

     6109: @cython.nonecheck(False)

     6110: @cython.cdivision(True)

    +6111: cpdef tuple red_map(int wavelength, float gamma=1.0):

    static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_red_map(int __pyx_v_wavelength, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_red_map *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      struct rgb_color_int __pyx_v_rgb_c;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("red_map", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_152red_map[] = "\n    RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param wavelength   : integer; Wavelength\n    :param gamma        : float; Gamma value\n    :return             : tuple RGB values (0 ... 255)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_153red_map(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_wavelength;
      float __pyx_v_gamma;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("red_map (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_wavelength,&__pyx_n_s_gamma,0};
        PyObject* values[2] = {0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_wavelength)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gamma);
              if (value) { values[1] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "red_map") < 0)) __PYX_ERR(1, 6111, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_wavelength = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_wavelength == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6111, __pyx_L3_error)
        if (values[1]) {
          __pyx_v_gamma = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_gamma == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6111, __pyx_L3_error)
        } else {
          __pyx_v_gamma = ((float)1.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("red_map", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6111, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_152red_map(__pyx_self, __pyx_v_wavelength, __pyx_v_gamma);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_152red_map(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_wavelength, float __pyx_v_gamma) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("red_map", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 1;
      __pyx_t_2.gamma = __pyx_v_gamma;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_red_map(__pyx_v_wavelength, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.red_map", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_red_map {
      int __pyx_n;
      float gamma;
    };

     6112:     """

     6113:     RETURN AN RGB COLOR VALUE MATCHING A SPECIFIC WAVELENGTH

     6114:

     6115:     Cython cpdef function, this function can be called directly and do not require a

     6116:     hook function.

     6117:

     6118:     :param wavelength   : integer; Wavelength

     6119:     :param gamma        : float; Gamma value

     6120:     :return             : tuple RGB values (0 ... 255)

     6121:     """

     6122:     cdef  rgb_color_int rgb_c

    +6123:     rgb_c = wavelength_to_rgb(wavelength, gamma)

      __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_wavelength, __pyx_v_gamma);

    +6124:     return rgb_c.r, rgb_c.g, rgb_c.b

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.g); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rgb_c.b); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_r = ((PyObject*)__pyx_t_4);
      __pyx_t_4 = 0;
      goto __pyx_L0;

     6125:

    +6126: i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +6127: REDMAP = [ red_map(i, 1.0) for i in range(620, 750) ]

      __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6127, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      for (__pyx_t_7 = 0x26C; __pyx_t_7 < 0x2EE; __pyx_t_7+=1) {
        __pyx_v_12PygameShader_6shader_i = __pyx_t_7;
        __pyx_t_46.__pyx_n = 1;
        __pyx_t_46.gamma = 1.0;
        __pyx_t_33 = __pyx_f_12PygameShader_6shader_red_map(__pyx_v_12PygameShader_6shader_i, 0, &__pyx_t_46); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6127, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_33))) __PYX_ERR(1, 6127, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      }
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_REDMAP, __pyx_t_2) < 0) __PYX_ERR(1, 6127, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     6128:

    +6129: cdef float f_redmap = (<float>750.0 - <float>620.0 - <float>1.0) / (<float>255.0 * <float>3.0)

      __pyx_v_12PygameShader_6shader_f_redmap = (((((float)750.0) - ((float)620.0)) - ((float)1.0)) / (((float)255.0) * ((float)3.0)));

     6130:

    +6131: cdef unsigned char[:, ::1] redmap_array = numpy.zeros((750 - 620, 3), numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_tuple__61);
      __Pyx_GIVEREF(__pyx_tuple__61);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_tuple__61);
      __Pyx_GIVEREF(__pyx_t_32);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_32);
      __pyx_t_32 = 0;
      __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_2, NULL); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_unsigned_char(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_redmap_array, 1);
      __pyx_v_12PygameShader_6shader_redmap_array = __pyx_t_39;
      __pyx_t_39.memview = NULL;
      __pyx_t_39.data = NULL;
    /* … */
      __pyx_tuple__61 = PyTuple_Pack(2, __pyx_int_130, __pyx_int_3); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 6131, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__61);
      __Pyx_GIVEREF(__pyx_tuple__61);

     6132:

    +6133: i = 0

      __pyx_v_12PygameShader_6shader_i = 0;

    +6134: for t in REDMAP:

      __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_REDMAP); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      if (likely(PyList_CheckExact(__pyx_t_32)) || PyTuple_CheckExact(__pyx_t_32)) {
        __pyx_t_2 = __pyx_t_32; __Pyx_INCREF(__pyx_t_2); __pyx_t_40 = 0;
        __pyx_t_41 = NULL;
      } else {
        __pyx_t_40 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_41 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_41)) __PYX_ERR(1, 6134, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      for (;;) {
        if (likely(!__pyx_t_41)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_40 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_32 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6134, __pyx_L1_error)
            #else
            __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_32);
            #endif
          } else {
            if (__pyx_t_40 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_32 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_40); __Pyx_INCREF(__pyx_t_32); __pyx_t_40++; if (unlikely(0 < 0)) __PYX_ERR(1, 6134, __pyx_L1_error)
            #else
            __pyx_t_32 = PySequence_ITEM(__pyx_t_2, __pyx_t_40); __pyx_t_40++; if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 6134, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_32);
            #endif
          }
        } else {
          __pyx_t_32 = __pyx_t_41(__pyx_t_2);
          if (unlikely(!__pyx_t_32)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(1, 6134, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_32);
        }
        if (!(likely(PyTuple_CheckExact(__pyx_t_32))||((__pyx_t_32) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_32)->tp_name), 0))) __PYX_ERR(1, 6134, __pyx_L1_error)
        __Pyx_XGOTREF(__pyx_v_12PygameShader_6shader_t);
        __Pyx_DECREF_SET(__pyx_v_12PygameShader_6shader_t, ((PyObject*)__pyx_t_32));
        __Pyx_GIVEREF(__pyx_t_32);
        __pyx_t_32 = 0;
    /* … */
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    +6135:     redmap_array[i, 0] = t[0]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6135, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 0)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6135, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6135, __pyx_L1_error) }
        __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_44 = 0;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    +6136:     redmap_array[i, 1] = t[1]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6136, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 1)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6136, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6136, __pyx_L1_error) }
        __pyx_t_44 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_43 = 1;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_44 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_42;

    +6137:     redmap_array[i, 2] = t[2]

        if (unlikely(__pyx_v_12PygameShader_6shader_t == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6137, __pyx_L1_error)
        }
        __pyx_t_42 = __Pyx_PyInt_As_unsigned_char(PyTuple_GET_ITEM(__pyx_v_12PygameShader_6shader_t, 2)); if (unlikely((__pyx_t_42 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(1, 6137, __pyx_L1_error)
        if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundLocalError("redmap_array"); __PYX_ERR(1, 6137, __pyx_L1_error) }
        __pyx_t_43 = __pyx_v_12PygameShader_6shader_i;
        __pyx_t_44 = 2;
        *((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_43 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_44)) )) = __pyx_t_42;

    +6138:     i += 1

        __pyx_v_12PygameShader_6shader_i = (__pyx_v_12PygameShader_6shader_i + 1);

     6139:

     6140:

     6141:

     6142: @cython.binding(False)

     6143: @cython.boundscheck(False)

     6144: @cython.wraparound(False)

     6145: @cython.nonecheck(False)

     6146: @cython.cdivision(True)

    +6147: cpdef inline void redscale(object surface_):

    static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_redscale(PyObject *__pyx_v_surface_, CYTHON_UNUSED int __pyx_skip_dispatch) {
      CYTHON_UNUSED unsigned int __pyx_v_w;
      CYTHON_UNUSED unsigned int __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned int __pyx_v_s;
      int __pyx_v_i;
      CYTHON_UNUSED int __pyx_v_size;
      unsigned int __pyx_v_index;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      CYTHON_UNUSED short __pyx_v_bitsize;
      CYTHON_UNUSED short __pyx_v_bytesize;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("redscale", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.redscale", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array, 1);
      __Pyx_RefNannyFinishContext();
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_154redscale[] = "\n    MAP AN IMAGE INTO A RED EQUIVALENT FORMAT\n    THIS ALGORITHM IS USING THE WAVELENGTH FROM 620 TO 750 NM TO\n    REPRESENT THE IMAGE IN RED SHADES\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param surface_ : pygame.Surface to transform\n    :return         : void\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_155redscale(PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("redscale (wrapper)", 0);
      __pyx_r = __pyx_pf_12PygameShader_6shader_154redscale(__pyx_self, ((PyObject *)__pyx_v_surface_));

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_154redscale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("redscale", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_void_to_None(__pyx_f_12PygameShader_6shader_redscale(__pyx_v_surface_, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.redscale", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     6148:     """

     6149:     MAP AN IMAGE INTO A RED EQUIVALENT FORMAT

     6150:     THIS ALGORITHM IS USING THE WAVELENGTH FROM 620 TO 750 NM TO

     6151:     REPRESENT THE IMAGE IN RED SHADES

     6152:

     6153:     Cython cpdef function, this function can be called directly and do not require a

     6154:     hook function.

     6155:

     6156:     :param surface_ : pygame.Surface to transform

     6157:     :return         : void

     6158:     """

     6159:

     6160:

     6161:     cdef:

     6162:         unsigned int w, h

    +6163:     w, h = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6163, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 6163, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6163, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 6163, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 6163, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6163, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_unsigned_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6163, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_w = __pyx_t_6;
      __pyx_v_h = __pyx_t_7;

     6164:

     6165:     cdef:

    +6166:         unsigned char [::1] rgb_array  = surface_.get_buffer()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6166, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6166, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rgb_array = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     6167:         unsigned int s

     6168:         int i

    +6169:         int size = rgb_array.size

      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_rgb_array, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6169, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6169, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_size = __pyx_t_9;

    +6170:         unsigned int index = 0

      __pyx_v_index = 0;

     6171:         unsigned char *r

     6172:         unsigned char *g

     6173:         unsigned char *b

    +6174:         short int bitsize = surface_.get_bitsize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bitsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6174, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bitsize = __pyx_t_10;

    +6175:         short int bytesize = surface_.get_bytesize()

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_bytesize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_short(__pyx_t_3); if (unlikely((__pyx_t_10 == (short)-1) && PyErr_Occurred())) __PYX_ERR(1, 6175, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bytesize = __pyx_t_10;

     6176:

    +6177:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L6_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L7:;
          }
      }

    +6178:         for i in prange(0, size, bytesize, schedule='static', num_threads=THREADS):

            __pyx_t_9 = __pyx_v_size;
            __pyx_t_10 = __pyx_v_bytesize;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static)        __pyx_t_10 = __pyx_v_bytesize;
            if ((__pyx_t_10 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_9 - 0 + __pyx_t_10 - __pyx_t_10/abs(__pyx_t_10)) / __pyx_t_10;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) lastprivate(__pyx_v_r) lastprivate(__pyx_v_s) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                            {
                                __pyx_v_i = (int)(0 + __pyx_t_10 * __pyx_t_11);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_index = ((unsigned int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_s = ((unsigned int)0xbad0bad0);

     6179:

    +6180:             r = &rgb_array[i]

                                __pyx_t_13 = __pyx_v_i;
                                __pyx_v_r = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

    +6181:             g = &rgb_array[i + 1]

                                __pyx_t_13 = (__pyx_v_i + 1);
                                __pyx_v_g = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

    +6182:             b = &rgb_array[i + 2]

                                __pyx_t_13 = (__pyx_v_i + 2);
                                __pyx_v_b = (&(*((unsigned char *) ( /* dim=0 */ ((char *) (((unsigned char *) __pyx_v_rgb_array.data) + __pyx_t_13)) ))));

     6183:

    +6184:             s = r[0] + g[0] + b[0]

                                __pyx_v_s = (((__pyx_v_r[0]) + (__pyx_v_g[0])) + (__pyx_v_b[0]));

    +6185:             index = <int>(s * f_redmap)

                                __pyx_v_index = ((int)(__pyx_v_s * __pyx_v_12PygameShader_6shader_f_redmap));

     6186:

    +6187:             r[0] = <unsigned char>redmap_array[index, 2]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6187, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 2;
                                (__pyx_v_r[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));

    +6188:             g[0] = <unsigned char>redmap_array[index, 1]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6188, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 1;
                                (__pyx_v_g[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));

    +6189:             b[0] = <unsigned char>redmap_array[index, 0]

                                if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6189, __pyx_L10_error) }
                                __pyx_t_14 = __pyx_v_index;
                                __pyx_t_13 = 0;
                                (__pyx_v_b[0]) = ((unsigned char)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_14 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_13)) ))));
                                goto __pyx_L13;
                                __pyx_L10_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L12;
                                __pyx_L12:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates6)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_b;
                                    __pyx_parallel_temp1 = __pyx_v_g;
                                    __pyx_parallel_temp2 = __pyx_v_i;
                                    __pyx_parallel_temp3 = __pyx_v_index;
                                    __pyx_parallel_temp4 = __pyx_v_r;
                                    __pyx_parallel_temp5 = __pyx_v_s;
                                }
                                __pyx_L13:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_b = __pyx_parallel_temp0;
                  __pyx_v_g = __pyx_parallel_temp1;
                  __pyx_v_i = __pyx_parallel_temp2;
                  __pyx_v_index = __pyx_parallel_temp3;
                  __pyx_v_r = __pyx_parallel_temp4;
                  __pyx_v_s = __pyx_parallel_temp5;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L6_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     6190:

     6191:

     6192:

     6193: @cython.binding(False)

     6194: @cython.boundscheck(False)

     6195: @cython.wraparound(False)

     6196: @cython.nonecheck(False)

     6197: @cython.cdivision(True)

    +6198: cdef inline void shader_blood_inplace_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_blood_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_, __Pyx_memviewslice __pyx_v_mask_, float __pyx_v_perc_) {
      int __pyx_v_w;
      CYTHON_UNUSED int __pyx_v_h;
      CYTHON_UNUSED int __pyx_v_bytesize;
      int __pyx_v_i;
      int __pyx_v_j;
      unsigned int __pyx_v_index;
      unsigned char *__pyx_v_r;
      float __pyx_v_theta;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_blood_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_blood_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

     6199:         unsigned char [:, :, :] rgb_array_, float [:, :] mask_, float perc_):

     6200:

     6201:     """

     6202:     SHADER HURT EFFECT

     6203:     THE MASK DETERMINE THE CONTOUR USED FOR THE BLOOD EFFECT.

     6204:

     6205:     The Array (rgb_array) must be a numpy array shape (w, h, 3)

     6206:     containing RGB pixels, please refer to pygame

     6207:     function pixels3d or array3d to convert an image into a

     6208:     3d array (library surfarray)

     6209:

     6210:     :param rgb_array_   : numpy.ndarray shape (w, h, 3) of unsigned

     6211:     char representing the surface pixels

     6212:     :param mask_        : numpy.ndarray shape (w, h) of float values in range [0.0...1.0]

     6213:     :param perc_        : Percentage value in range [0.0 ... 1.0] with 1.0 being 100%

     6214:

     6215:     :return: void

     6216:     """

    +6217:     assert 0.0 <= perc_ <= 1.0, "perc_ variable must be in range[0.0 ... 1.0] got %s " % perc_

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_1 = (0.0 <= __pyx_v_perc_);
        if (__pyx_t_1) {
          __pyx_t_1 = (__pyx_v_perc_ <= 1.0);
        }
        if (unlikely(!(__pyx_t_1 != 0))) {
          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_perc_); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_perc__variable_must_be_in_range, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6217, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(1, 6217, __pyx_L1_error)
        }
      }
      #endif

     6218:

     6219:     cdef:

     6220:         int w, h, bytesize

    +6221:     w, h, bytesize = (<object> rgb_array_).shape

      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6221, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
        PyObject* sequence = __pyx_t_2;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 6221, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2);
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1);
          __pyx_t_5 = PyList_GET_ITEM(sequence, 2);
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6221, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6221, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6221, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6221, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 2; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(1, 6221, __pyx_L1_error)
        __pyx_t_7 = NULL;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 6221, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6221, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_w = __pyx_t_8;
      __pyx_v_h = __pyx_t_9;
      __pyx_v_bytesize = __pyx_t_10;

     6222:

     6223:     cdef:

     6224:         unsigned int s

     6225:         int i, j

    +6226:         unsigned int index = 0

      __pyx_v_index = 0;

     6227:         unsigned char *r

     6228:         unsigned char *g

     6229:         unsigned char *b

     6230:         float theta

     6231:

     6232:

    +6233:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L7;
            }
            __pyx_L6_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L7:;
          }
      }

    +6234:         for j in prange(0, h, schedule='static', num_threads=THREADS):

            __pyx_t_10 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_10 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) schedule(static)
    /* … */
            __pyx_t_10 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_10 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_i) lastprivate(__pyx_v_index) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_theta) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_12; __pyx_t_11++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_11);
                                /* Initialize private variables to invalid values */
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_index = ((unsigned int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_theta = ((float)__PYX_NAN());

    +6235:             for i in range(0, w):

                                __pyx_t_9 = __pyx_v_w;
                                __pyx_t_8 = __pyx_t_9;
                                for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_8; __pyx_t_13+=1) {
                                  __pyx_v_i = __pyx_t_13;

     6236:

    +6237:                 r = &rgb_array_[i, j, 0]

                                  __pyx_t_14 = __pyx_v_i;
                                  __pyx_t_15 = __pyx_v_j;
                                  __pyx_t_16 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_14 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))));

     6238:                 # g = &rgb_array_[i, j, 1]

     6239:                 # b = &rgb_array_[i, j, 2]

     6240:

     6241:                 # s = r[0] + g[0] + b[0]

     6242:                 # index = <int>(s * f_redmap)

     6243:

    +6244:                 index = <int>(r[0] * f_redmap)

                                  __pyx_v_index = ((int)((__pyx_v_r[0]) * __pyx_v_12PygameShader_6shader_f_redmap));

    +6245:                 theta = <float>(mask_[i, j] * perc_)

                                  __pyx_t_16 = __pyx_v_i;
                                  __pyx_t_15 = __pyx_v_j;
                                  __pyx_v_theta = ((float)((*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mask_.data + __pyx_t_16 * __pyx_v_mask_.strides[0]) ) + __pyx_t_15 * __pyx_v_mask_.strides[1]) ))) * __pyx_v_perc_));

     6246:

     6247:                 # BEST METHOD (SLOW)

     6248:                 # r[0] = <unsigned char> (r[0] * (1.0 - theta) +

     6249:                 # <float>redmap_array[index, 0] * theta)

     6250:                 # g[0] = <unsigned char> (g[0] * (1.0 - theta) +

     6251:                 # <float>redmap_array[index, 1] * theta)

     6252:                 # b[0] = <unsigned char> (b[0] * (1.0 - theta) +

     6253:                 # <float>redmap_array[index, 2] * theta)

     6254:

     6255:                 # ALTERNATIVE WITH BEST PERFORMANCES

    +6256:                 r[0] = <unsigned char> (

                                  (__pyx_v_r[0]) = ((unsigned char)__pyx_t_20);
                                }
                                goto __pyx_L15;
                                __pyx_L10_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L14;
                                __pyx_L14:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates7)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_i;
                                    __pyx_parallel_temp1 = __pyx_v_index;
                                    __pyx_parallel_temp2 = __pyx_v_j;
                                    __pyx_parallel_temp3 = __pyx_v_r;
                                    __pyx_parallel_temp4 = __pyx_v_theta;
                                }
                                __pyx_L15:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_i = __pyx_parallel_temp0;
                  __pyx_v_index = __pyx_parallel_temp1;
                  __pyx_v_j = __pyx_parallel_temp2;
                  __pyx_v_r = __pyx_parallel_temp3;
                  __pyx_v_theta = __pyx_parallel_temp4;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L6_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +6257:                     min(r[0] + <float> redmap_array[index, 0] * theta, <unsigned char>255))

                                  __pyx_t_17 = ((unsigned char)0xFF);
                                  if (unlikely(!__pyx_v_12PygameShader_6shader_redmap_array.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("redmap_array"); __PYX_ERR(1, 6257, __pyx_L10_error) }
                                  __pyx_t_18 = __pyx_v_index;
                                  __pyx_t_15 = 0;
                                  __pyx_t_19 = ((__pyx_v_r[0]) + (((float)(*((unsigned char *) ( /* dim=1 */ ((char *) (((unsigned char *) ( /* dim=0 */ (__pyx_v_12PygameShader_6shader_redmap_array.data + __pyx_t_18 * __pyx_v_12PygameShader_6shader_redmap_array.strides[0]) )) + __pyx_t_15)) )))) * __pyx_v_theta));
                                  if (((__pyx_t_17 < __pyx_t_19) != 0)) {
                                    __pyx_t_20 = __pyx_t_17;
                                  } else {
                                    __pyx_t_20 = __pyx_t_19;
                                  }

     6258:

     6259:

     6260:

     6261: #

     6262: # def interpolant(t):

     6263: #     return t*t*t*(t*(t*6 - 15) + 10)

     6264: #

     6265: #

     6266: # def generate_perlin_noise_2d(

     6267: #         shape, res, tileable=(False, False), interpolant=interpolant

     6268: # ):

     6269: #     """Generate a 2D numpy array of perlin noise.

     6270: #

     6271: #     Args:

     6272: #         shape: The shape of the generated array (tuple of two ints).

     6273: #             This must be a multple of res.

     6274: #         res: The number of periods of noise to generate along each

     6275: #             axis (tuple of two ints). Note shape must be a multiple of

     6276: #             res.

     6277: #         tileable: If the noise should be tileable along each axis

     6278: #             (tuple of two bools). Defaults to (False, False).

     6279: #         interpolant: The interpolation function, defaults to

     6280: #             t*t*t*(t*(t*6 - 15) + 10).

     6281: #

     6282: #     Returns:

     6283: #         A numpy array of shape shape with the generated noise.

     6284: #

     6285: #     Raises:

     6286: #         ValueError: If shape is not a multiple of res.

     6287: #     """

     6288: #     delta = (res[0] / shape[0], res[1] / shape[1])

     6289: #     d = (shape[0] // res[0], shape[1] // res[1])

     6290: #     grid = numpy.mgrid[0:res[0]:delta[0], 0:res[1]:delta[1]]\

     6291: #              .transpose(1, 2, 0) % 1

     6292: #     # Gradients

     6293: #     angles = 2*numpy.pi*numpy.random.rand(res[0]+1, res[1]+1)

     6294: #     gradients = numpy.dstack((numpy.cos(angles), numpy.sin(angles)))

     6295: #     if tileable[0]:

     6296: #         gradients[-1,:] = gradients[0,:]

     6297: #     if tileable[1]:

     6298: #         gradients[:,-1] = gradients[:,0]

     6299: #     gradients = gradients.repeat(d[0], 0).repeat(d[1], 1)

     6300: #     g00 = gradients[    :-d[0],    :-d[1]]

     6301: #     g10 = gradients[d[0]:     ,    :-d[1]]

     6302: #     g01 = gradients[    :-d[0],d[1]:     ]

     6303: #     g11 = gradients[d[0]:     ,d[1]:     ]

     6304: #     # Ramps

     6305: #     n00 = numpy.sum(numpy.dstack((grid[:,:,0]  , grid[:,:,1]  )) * g00, 2)

     6306: #     n10 = numpy.sum(numpy.dstack((grid[:,:,0]-1, grid[:,:,1]  )) * g10, 2)

     6307: #     n01 = numpy.sum(numpy.dstack((grid[:,:,0]  , grid[:,:,1]-1)) * g01, 2)

     6308: #     n11 = numpy.sum(numpy.dstack((grid[:,:,0]-1, grid[:,:,1]-1)) * g11, 2)

     6309: #     # Interpolation

     6310: #     t = interpolant(grid)

     6311: #     n0 = n00*(1-t[:,:,0]) + t[:,:,0]*n10

     6312: #     n1 = n01*(1-t[:,:,0]) + t[:,:,0]*n11

     6313: #     return numpy.sqrt(2)*((1-t[:,:,1])*n0 + t[:,:,1]*n1)

     6314: #

     6315: #

     6316: #

     6317: # @cython.boundscheck(False)

     6318: # @cython.wraparound(False)

     6319: # @cython.nonecheck(False)

     6320: # @cython.cdivision(True)

     6321: # cdef inline cloud_effect_inplace_c(int frame):

     6322: #

     6323: #     cdef int w, h, i, j

     6324: #

     6325: #     # cdef float [:, :] noise_array = generate_perlin_noise_2d(

     6326: #     (800, 800), (16, 16), tileable=(True, True))

     6327: #

     6328: #     cdef float [:, :] noise_array = numpy.empty((200, 200), float32)

     6329: #

     6330: #     for j in range(0, 200):

     6331: #         for i in range(0, 200):

     6332: #             noise_array[i, j] = noise.pnoise2((i+ 50 * cos(frame * M_PI/180.0))/ 8.0,

     6333: #                           j / 8.0,

     6334: #                           octaves=8,

     6335: #                           persistence=0.25,

     6336: #                           lacunarity=2,

     6337: #                           repeatx=1024,

     6338: #                           repeaty=1024,

     6339: #                           base=0)

     6340: #

     6341: #

     6342: #     cdef:

     6343: #         unsigned char [:, :, :] dest_array = numpy.empty((800, 800, 3), numpy.uint8)

     6344: #         int ii, jj

     6345: #         int v

     6346: #

     6347: #     with nogil:

     6348: #         for i in prange(0, 800, schedule='static', num_threads=THREADS):

     6349: #             for j in range(0, 800):

     6350: #                 ii = <int>(200.0/800.0 * i)

     6351: #                 jj = <int>(200.0/800.0 * j)

     6352: #                 dest_array[i, j, 0] =<unsigned char>(noise_array[ii, jj] * 255)

     6353: #                 dest_array[i, j, 1] =<unsigned char>(noise_array[ii, jj] * 255)

     6354: #                 dest_array[i, j, 2] =<unsigned char>(noise_array[ii, jj] * 255)

     6355: #

     6356: #

     6357: #     return pygame.surfarray.make_surface(asarray(dest_array))

     6358: #

     6359:

     6360:

     6361: @cython.boundscheck(False)

     6362: @cython.wraparound(False)

     6363: @cython.nonecheck(False)

     6364: @cython.cdivision(True)

    +6365: cpdef inline unsigned int rgb_to_int(int red, int green, int blue)nogil:

    static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE unsigned int __pyx_f_12PygameShader_6shader_rgb_to_int(int __pyx_v_red, int __pyx_v_green, int __pyx_v_blue, CYTHON_UNUSED int __pyx_skip_dispatch) {
      unsigned int __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_156rgb_to_int[] = "\n    CONVERT RGB MODEL INTO A PYTHON INTEGER EQUIVALENT TO THE FUNCTION PYGAME MAP_RGB()\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param red   : Red color value,  must be in range [0..255]\n    :param green : Green color value, must be in range [0..255]\n    :param blue  : Blue color, must be in range [0.255]\n    :return      : returns a positive python integer representing the RGB values(int32)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_157rgb_to_int(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_red;
      int __pyx_v_green;
      int __pyx_v_blue;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_int (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_red,&__pyx_n_s_green,&__pyx_n_s_blue,0};
        PyObject* values[3] = {0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_red)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_green)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, 1); __PYX_ERR(1, 6365, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_blue)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, 2); __PYX_ERR(1, 6365, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rgb_to_int") < 0)) __PYX_ERR(1, 6365, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        }
        __pyx_v_red = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_red == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
        __pyx_v_green = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_green == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
        __pyx_v_blue = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_blue == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6365, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("rgb_to_int", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 6365, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_156rgb_to_int(__pyx_self, __pyx_v_red, __pyx_v_green, __pyx_v_blue);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_156rgb_to_int(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_red, int __pyx_v_green, int __pyx_v_blue) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("rgb_to_int", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_f_12PygameShader_6shader_rgb_to_int(__pyx_v_red, __pyx_v_green, __pyx_v_blue, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.rgb_to_int", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     6366:     """

     6367:     CONVERT RGB MODEL INTO A PYTHON INTEGER EQUIVALENT TO THE FUNCTION PYGAME MAP_RGB()

     6368:

     6369:     Cython cpdef function, this function can be called directly and do not require a

     6370:     hook function.

     6371:

     6372:     :param red   : Red color value,  must be in range [0..255]

     6373:     :param green : Green color value, must be in range [0..255]

     6374:     :param blue  : Blue color, must be in range [0.255]

     6375:     :return      : returns a positive python integer representing the RGB values(int32)

     6376:     """

    +6377:     return 65536 * red + 65536*10 + 256 * green + 256 + blue + 1

      __pyx_r = ((((((0x10000 * __pyx_v_red) + 0xA0000) + (0x100 * __pyx_v_green)) + 0x100) + __pyx_v_blue) + 1);
      goto __pyx_L0;

     6378:

     6379: @cython.boundscheck(False)

     6380: @cython.wraparound(False)

     6381: @cython.nonecheck(False)

     6382: @cython.cdivision(True)

    +6383: cpdef inline rgb int_to_rgb(unsigned int n)nogil:

    static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
    static CYTHON_INLINE struct rgb __pyx_f_12PygameShader_6shader_int_to_rgb(unsigned int __pyx_v_n, CYTHON_UNUSED int __pyx_skip_dispatch) {
      struct rgb __pyx_v_rgb_;
      struct rgb __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_158int_to_rgb[] = "\n    CONVERT A PYTHON INTEGER INTO A RGB COLOUR MODEL (UNSIGNED CHAR VALUES [0..255]).\n    EQUIVALENT TO PYGAME UNMAP_RGB()\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    :param n : positive integer value to convert\n    :return  : return a C structure rgb containing RGB values\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_159int_to_rgb(PyObject *__pyx_self, PyObject *__pyx_arg_n) {
      unsigned int __pyx_v_n;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("int_to_rgb (wrapper)", 0);
      assert(__pyx_arg_n); {
        __pyx_v_n = __Pyx_PyInt_As_unsigned_int(__pyx_arg_n); if (unlikely((__pyx_v_n == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6383, __pyx_L3_error)
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.int_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_158int_to_rgb(__pyx_self, ((unsigned int)__pyx_v_n));
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_158int_to_rgb(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_n) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("int_to_rgb", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __pyx_convert__to_py_struct__rgb(__pyx_f_12PygameShader_6shader_int_to_rgb(__pyx_v_n, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.int_to_rgb", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     6384:     """

     6385:     CONVERT A PYTHON INTEGER INTO A RGB COLOUR MODEL (UNSIGNED CHAR VALUES [0..255]).

     6386:     EQUIVALENT TO PYGAME UNMAP_RGB()

     6387:

     6388:     Cython cpdef function, this function can be called directly and do not require a

     6389:     hook function.

     6390:

     6391:     :param n : positive integer value to convert

     6392:     :return  : return a C structure rgb containing RGB values

     6393:     """

     6394:     cdef:

     6395:         rgb rgb_

     6396:

    +6397:     rgb_.r = <float>((n >> 16) & 255)

      __pyx_v_rgb_.r = ((float)((__pyx_v_n >> 16) & 0xFF));

    +6398:     rgb_.g = <float>((n >> 8) & 255)

      __pyx_v_rgb_.g = ((float)((__pyx_v_n >> 8) & 0xFF));

    +6399:     rgb_.b = <float>(n & 255)

      __pyx_v_rgb_.b = ((float)(__pyx_v_n & 0xFF));

    +6400:     return rgb_

      __pyx_r = __pyx_v_rgb_;
      goto __pyx_L0;

     6401:

     6402:

     6403: @cython.boundscheck(False)

     6404: @cython.wraparound(False)

     6405: @cython.nonecheck(False)

     6406: @cython.cdivision(True)

    +6407: cdef inline make_palette_c(int width, float fh, float fs, float fl):

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_make_palette_c(int __pyx_v_width, float __pyx_v_fh, float __pyx_v_fs, float __pyx_v_fl) {
      __Pyx_memviewslice __pyx_v_palette = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      float __pyx_v_h;
      float __pyx_v_s;
      float __pyx_v_l;
      struct rgb __pyx_v_rgb_;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("make_palette_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_AddTraceback("PygameShader.shader.make_palette_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     6408:     """

     6409:     CREATE A PALETTE (ARRAY) FROM HSL VALUES (HUE, SATURATION, LIGHTNESS)

     6410:

     6411:     e.g:

     6412:         # below: palette of 256 colors & surface (width=256, height=50).

     6413:         # hue * 6, saturation = 255.0, lightness * 2.0

     6414:         palette, surf = make_palette(256, 50, 6, 255, 2)

     6415:         palette, surf = make_palette(256, 50, 4, 255, 2)

     6416:

     6417:     :param width  : integer, Palette width

     6418:     :param fh     : float, hue factor

     6419:     :param fs     : float, saturation factor

     6420:     :param fl     : float, lightness factor

     6421:     :return       : Return a tuple ndarray type uint32 and pygame.Surface (width, height)

     6422:     """

    +6423:     assert width > 0, "Argument width should be > 0, got %s " % width

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_width > 0) != 0))) {
          __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Argument_width_should_be_0_got_s, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(1, 6423, __pyx_L1_error)
        }
      }
      #endif

     6424:

     6425:     cdef:

    +6426:         unsigned int [::1] palette = numpy.empty(width, uint32)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_uint32); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
        __pyx_t_1 = 0;
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 6426, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_palette = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     6427:         int x, y

     6428:         float h, s, l

     6429:         rgb rgb_

     6430:

    +6431:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +6432:         for x in prange(width, schedule='static', num_threads=THREADS):

            __pyx_t_6 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)
    /* … */
            __pyx_t_6 = __pyx_v_width;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_6 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_h) lastprivate(__pyx_v_l) lastprivate(__pyx_v_rgb_) lastprivate(__pyx_v_s) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_9);
                                /* Initialize private variables to invalid values */
                                __pyx_v_h = ((float)__PYX_NAN());
                                __pyx_v_l = ((float)__PYX_NAN());
                                __pyx_v_s = ((float)__PYX_NAN());

    +6433:             h, s, l = <float>x * fh,  min(fs, <float>255.0), min(<float>x * fl, <float>255.0)

                                __pyx_t_11 = (((float)__pyx_v_x) * __pyx_v_fh);
                                __pyx_t_12 = ((float)255.0);
                                __pyx_t_13 = __pyx_v_fs;
                                if (((__pyx_t_12 < __pyx_t_13) != 0)) {
                                  __pyx_t_14 = __pyx_t_12;
                                } else {
                                  __pyx_t_14 = __pyx_t_13;
                                }
                                __pyx_t_12 = __pyx_t_14;
                                __pyx_t_14 = ((float)255.0);
                                __pyx_t_13 = (((float)__pyx_v_x) * __pyx_v_fl);
                                if (((__pyx_t_14 < __pyx_t_13) != 0)) {
                                  __pyx_t_15 = __pyx_t_14;
                                } else {
                                  __pyx_t_15 = __pyx_t_13;
                                }
                                __pyx_t_14 = __pyx_t_15;
                                __pyx_v_h = __pyx_t_11;
                                __pyx_v_s = __pyx_t_12;
                                __pyx_v_l = __pyx_t_14;

    +6434:             rgb_ = struct_hsl_to_rgb(h * <float>ONE_360, s * <float>ONE_255, l * <float>ONE_255)

                                __pyx_v_rgb_ = struct_hsl_to_rgb((__pyx_v_h * ((float)0.002777777777777778)), (__pyx_v_s * ((float)0.00392156862745098)), (__pyx_v_l * ((float)0.00392156862745098)));

     6435:             # build the palette (1d buffer int values)

    +6436:             palette[x] = rgb_to_int(<int>(rgb_.r * <float>255.0),

                                __pyx_t_16 = __pyx_v_x;
                                *((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_16)) )) = __pyx_f_12PygameShader_6shader_rgb_to_int(((int)(__pyx_v_rgb_.r * ((float)255.0))), ((int)(__pyx_v_rgb_.g * ((float)255.0))), ((int)((__pyx_v_rgb_.b * ((float)255.0)) * ((float)0.5))), 0);
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     6437:                                     <int>(rgb_.g * <float>255.0),

     6438:                                     <int>(rgb_.b * <float>255.0 * <float>0.5))

     6439:

    +6440:     return asarray(palette)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_palette, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 6440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     6441:

     6442: @cython.boundscheck(False)

     6443: @cython.wraparound(False)

     6444: @cython.nonecheck(False)

     6445: @cython.cdivision(False)

    +6446: cdef fire_surface24_c(

    static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c *__pyx_optional_args) {
      int __pyx_v_intensity = ((int)0);
      int __pyx_v_low = ((int)0);
      int __pyx_v_high = ((int)0);
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      float __pyx_v_d;
      unsigned int __pyx_v_ii;
      unsigned int __pyx_v_c1;
      unsigned int __pyx_v_c2;
      CYTHON_UNUSED int __pyx_v_min_;
      CYTHON_UNUSED int __pyx_v_max_;
      int __pyx_v_middle;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_surface24_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_intensity = __pyx_optional_args->intensity;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_low = __pyx_optional_args->low;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_high = __pyx_optional_args->high;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_AddTraceback("PygameShader.shader.fire_surface24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +6447:         int width,

    struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c {
      int __pyx_n;
      int intensity;
      int low;
      int high;
    };

     6448:         int height,

     6449:         float factor,

     6450:         unsigned int [::1] palette,

     6451:         float [:, ::1] fire,

     6452:         int intensity = 0,

     6453:         int low       = 0,

     6454:         int high      = 0,

     6455: ):

     6456:     """

     6457:

     6458:     CREATE A FIRE EFFECT

     6459:

     6460:     * Do not call this function directly

     6461:

     6462:     :param width    : integer; max width of the effect

     6463:     :param height   : integer; max height of the effect

     6464:     :param factor   : float; factor to reduce the flame effect

     6465:     :param palette  : ndarray; Color palette 1d numpy array (colors buffer unsigned int values)

     6466:     :param fire     : ndarray; 2d array (x, y) (contiguous) containing float values

     6467:     :param intensity: integer; Control the flame intensity default 0 (low intensity), range [0...32]

     6468:     :param low      : integer; The x lowest position of the effect, x must be >=0 and < high

     6469:     :param high     : integer; The x highest position of the effect, x must be > low and <= high

     6470:     :return         : Return a numpy array containing the fire effect array shape

     6471:      (w, h, 3) of RGB pixels

     6472:     """

     6473:

     6474:     cdef:

     6475:         # flame opacity palette

    +6476:         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 6476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

    +6477:         int x = 0, y = 0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     6478:         float d

    +6479:         unsigned int ii=0

      __pyx_v_ii = 0;

    +6480:         unsigned c1 = 0, c2 = 0

      __pyx_v_c1 = 0;
      __pyx_v_c2 = 0;

     6481:

     6482:     cdef int min_, max_, middle

     6483:

     6484:

    +6485:     if low != 0 or high != 0:

      __pyx_t_7 = ((__pyx_v_low != 0) != 0);
      if (!__pyx_t_7) {
      } else {
        __pyx_t_6 = __pyx_t_7;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_7 = ((__pyx_v_high != 0) != 0);
      __pyx_t_6 = __pyx_t_7;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_6) {
    /* … */
        goto __pyx_L3;
      }

    +6486:         assert 0 <= low < high, "Argument low_ must be < high_"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_6 = (0 <= __pyx_v_low);
          if (__pyx_t_6) {
            __pyx_t_6 = (__pyx_v_low < __pyx_v_high);
          }
          if (unlikely(!(__pyx_t_6 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
            __PYX_ERR(1, 6486, __pyx_L1_error)
          }
        }
        #endif

    +6487:         assert high <= width, "Argument high must be <= width"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
            __PYX_ERR(1, 6487, __pyx_L1_error)
          }
        }
        #endif

     6488:

    +6489:         middle = low + ((high - low) >> 1)

        __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    +6490:         min_ = randRange(low, middle)

        __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    +6491:         max_ = randRange(middle + 1, high)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

     6492:     else:

    +6493:         middle = width >> 1

      /*else*/ {
        __pyx_v_middle = (__pyx_v_width >> 1);

    +6494:         min_ = randRange(0, middle)

        __pyx_v_min_ = randRange(0, __pyx_v_middle);

    +6495:         max_ = randRange(middle +1, width)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
      }
      __pyx_L3:;

     6496:

     6497:

    +6498:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L8;
            }
            __pyx_L7_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L8:;
          }
      }

     6499:         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)

    +6500:         for x in prange(min_, max_, schedule='static', num_threads=THREADS):

            __pyx_t_8 = __pyx_v_min_;
            __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)        __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                            {
                                __pyx_v_x = (int)(__pyx_t_8 + 1 * __pyx_t_10);

    +6501:                 fire[height-1, x] = randRange(intensity, 260)

                                __pyx_t_12 = (__pyx_v_height - 1);
                                __pyx_t_13 = __pyx_v_x;
                                *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_12 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )) = randRange(__pyx_v_intensity, 0x104);
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif

     6502:

     6503:

     6504:         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD

    +6505:         for y in prange(1, height-1, schedule='static', num_threads=THREADS):

            __pyx_t_14 = (__pyx_v_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_14 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_14 = (__pyx_v_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_14 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                            {
                                __pyx_v_y = (int)(1 + 1 * __pyx_t_15);
                                /* Initialize private variables to invalid values */
                                __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                                __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                                __pyx_v_d = ((float)__PYX_NAN());
                                __pyx_v_ii = ((unsigned int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);

     6506:

    +6507:             for x in range(0, width):

                                __pyx_t_11 = __pyx_v_width;
                                __pyx_t_10 = __pyx_t_11;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     6508:

    +6509:                     c1 = (y + 1) % height

                                  __pyx_t_17 = (__pyx_v_y + 1);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6509, __pyx_L17_error)
                                  }
                                  __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

    +6510:                     c2 = x % width

                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6510, __pyx_L17_error)
                                  }
                                  __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

    +6511:                     d = (fire[c1, (x - 1 + width) % width]

                                  __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6511, __pyx_L17_error)
                                  }
                                  __pyx_t_18 = __pyx_v_c1;
                                  __pyx_t_13 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

    +6512:                        + fire[c1, c2]

                                  __pyx_t_19 = __pyx_v_c1;
                                  __pyx_t_20 = __pyx_v_c2;

    +6513:                        + fire[c1, (x + 1) % width]

                                  __pyx_t_21 = (__pyx_v_x + 1);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6513, __pyx_L17_error)
                                  }
                                  __pyx_t_22 = __pyx_v_c1;
                                  __pyx_t_12 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

    +6514:                        + fire[(y + 2) % height, c2]) * factor

                                  __pyx_t_23 = (__pyx_v_y + 2);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6514, __pyx_L17_error)
                                  }
                                  __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                                  __pyx_t_25 = __pyx_v_c2;
                                  __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_18 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_19 * __pyx_v_fire.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_22 * __pyx_v_fire.strides[0]) )) + __pyx_t_12)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

     6515:

    +6516:                     d = d - <float>(rand() * 0.0001)

                                  __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

     6517:

     6518:                     # Cap the values

    +6519:                     if d <0:

                                  __pyx_t_6 = ((__pyx_v_d < 0.0) != 0);
                                  if (__pyx_t_6) {
    /* … */
                                  }

    +6520:                         d = 0.0

                                    __pyx_v_d = 0.0;

     6521:

     6522:                     # CAP THE VALUE TO 255

    +6523:                     if d>255.0:

                                  __pyx_t_6 = ((__pyx_v_d > 255.0) != 0);
                                  if (__pyx_t_6) {
    /* … */
                                  }

    +6524:                         d = <float>255.0

                                    __pyx_v_d = ((float)255.0);

    +6525:                     fire[y, x] = d

                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_12 = __pyx_v_x;
                                  *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_12)) )) = __pyx_v_d;

     6526:

    +6527:                     ii = palette[<unsigned int>d % width]

                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6527, __pyx_L17_error)
                                  }
                                  __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_width);
                                  __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

     6528:

    +6529:                     out[x, y, 0] = (ii >> 16) & 255

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 16) & 0xFF);

    +6530:                     out[x, y, 1] = (ii >> 8) & 255

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_12 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_12)) )) = ((__pyx_v_ii >> 8) & 0xFF);

    +6531:                     out[x, y, 2] = ii & 255

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_13 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = (__pyx_v_ii & 0xFF);
                                }
                                goto __pyx_L24;
                                __pyx_L17_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L23;
                                __pyx_L23:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates8)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_c1;
                                    __pyx_parallel_temp1 = __pyx_v_c2;
                                    __pyx_parallel_temp2 = __pyx_v_d;
                                    __pyx_parallel_temp3 = __pyx_v_ii;
                                    __pyx_parallel_temp4 = __pyx_v_x;
                                    __pyx_parallel_temp5 = __pyx_v_y;
                                }
                                __pyx_L24:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_c1 = __pyx_parallel_temp0;
                  __pyx_v_c2 = __pyx_parallel_temp1;
                  __pyx_v_d = __pyx_parallel_temp2;
                  __pyx_v_ii = __pyx_parallel_temp3;
                  __pyx_v_x = __pyx_parallel_temp4;
                  __pyx_v_y = __pyx_parallel_temp5;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L7_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     6532:

    +6533:     return asarray(out)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6533, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     6534:

     6535:

     6536:

     6537: @cython.boundscheck(False)

     6538: @cython.wraparound(False)

     6539: @cython.nonecheck(False)

     6540: @cython.cdivision(False)

    +6541: cdef fire_surface24_c_border(

    static PyObject *__pyx_f_12PygameShader_6shader_fire_surface24_c_border(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_fire, struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border *__pyx_optional_args) {
      int __pyx_v_intensity = ((int)0);
      int __pyx_v_low = ((int)0);
      int __pyx_v_high = ((int)0);
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      float __pyx_v_d;
      unsigned int __pyx_v_ii;
      unsigned int __pyx_v_c1;
      unsigned int __pyx_v_c2;
      CYTHON_UNUSED int __pyx_v_min_;
      CYTHON_UNUSED int __pyx_v_max_;
      int __pyx_v_middle;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("fire_surface24_c_border", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_intensity = __pyx_optional_args->intensity;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_low = __pyx_optional_args->low;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_high = __pyx_optional_args->high;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_AddTraceback("PygameShader.shader.fire_surface24_c_border", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +6542:         int width,

    struct __pyx_opt_args_12PygameShader_6shader_fire_surface24_c_border {
      int __pyx_n;
      int intensity;
      int low;
      int high;
    };

     6543:         int height,

     6544:

     6545:         float factor,

     6546:         unsigned int [::1] palette,

     6547:         float [:, ::1] fire,

     6548:         int intensity = 0,

     6549:         int low       = 0,

     6550:         int high      = 0,

     6551: ):

     6552:     """

     6553:

     6554:     CREATE A FIRE EFFECT (BORDER EFFECT)

     6555:

     6556:     * Do not call this function directly

     6557:

     6558:     :param width    : integer; max width of the effect

     6559:     :param height   : integer; max height of the effect

     6560:     :param factor   : float; factor to reduce the flame effect

     6561:     :param palette  : ndarray; Color palette 1d numpy array (colors buffer unsigned int values)

     6562:     :param fire     : ndarray; 2d array (x, y) (contiguous) containing float values

     6563:     :param intensity: integer; Control the flame intensity default 0 (low intensity), range [0...32]

     6564:     :param low      : integer; The x lowest position of the effect, x must be >=0 and < high

     6565:     :param high     : integer; The x highest position of the effect, x must be > low and <= high

     6566:     :return         : Return a numpy array containing the fire effect array

     6567:     shape (w, h, 3) of RGB pixels

     6568:     """

     6569:

     6570:     cdef:

     6571:         # flame opacity palette

    +6572:         unsigned char [:, :, ::1] out = zeros((width, height, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 6572, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

    +6573:         int x = 0, y = 0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     6574:         float d

    +6575:         unsigned int ii=0

      __pyx_v_ii = 0;

    +6576:         unsigned c1 = 0, c2 = 0

      __pyx_v_c1 = 0;
      __pyx_v_c2 = 0;

     6577:

     6578:     cdef int min_, max_, middle

     6579:

     6580:

    +6581:     if low != 0 or high != 0:

      __pyx_t_7 = ((__pyx_v_low != 0) != 0);
      if (!__pyx_t_7) {
      } else {
        __pyx_t_6 = __pyx_t_7;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_7 = ((__pyx_v_high != 0) != 0);
      __pyx_t_6 = __pyx_t_7;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_6) {
    /* … */
        goto __pyx_L3;
      }

    +6582:         assert 0 <= low < high, "Argument low_ must be < high_"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_6 = (0 <= __pyx_v_low);
          if (__pyx_t_6) {
            __pyx_t_6 = (__pyx_v_low < __pyx_v_high);
          }
          if (unlikely(!(__pyx_t_6 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
            __PYX_ERR(1, 6582, __pyx_L1_error)
          }
        }
        #endif

    +6583:         assert high <= width, "Argument high must be <= width"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
            __PYX_ERR(1, 6583, __pyx_L1_error)
          }
        }
        #endif

     6584:

    +6585:         middle = low + ((high - low) >> 1)

        __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    +6586:         min_ = randRange(low, middle)

        __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    +6587:         max_ = randRange(middle + 1, high)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

     6588:     else:

    +6589:         middle = width >> 1

      /*else*/ {
        __pyx_v_middle = (__pyx_v_width >> 1);

    +6590:         min_ = randRange(0, middle)

        __pyx_v_min_ = randRange(0, __pyx_v_middle);

    +6591:         max_ = randRange(middle +1, width)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
      }
      __pyx_L3:;

     6592:

     6593:

    +6594:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L8;
            }
            __pyx_L7_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L8:;
          }
      }

     6595:         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)

     6596:         # for x in prange(min_, max_, schedule='static', num_threads=THREADS

     6597:         #         fire[height - 1, x] = randRange(intensity, 260)

     6598:

     6599:         # FIRE ARRAY IS [HEIGHT, WIDTH]

    +6600:         for x in prange(min_, max_, schedule='static', num_threads=THREADS):

            __pyx_t_8 = __pyx_v_min_;
            __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)        __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_8 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                            {
                                __pyx_v_x = (int)(__pyx_t_8 + 1 * __pyx_t_10);

    +6601:                 fire[x % height, (height - 1) % width] = randRange(intensity, 260)

                                if (unlikely(__pyx_v_height == 0)) {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                                  __PYX_ERR(1, 6601, __pyx_L11_error)
                                }
                                __pyx_t_12 = (__pyx_v_height - 1);
                                if (unlikely(__pyx_v_width == 0)) {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                                  __PYX_ERR(1, 6601, __pyx_L11_error)
                                }
                                __pyx_t_13 = __Pyx_mod_int(__pyx_v_x, __pyx_v_height);
                                __pyx_t_14 = __Pyx_mod_long(__pyx_t_12, __pyx_v_width);
                                *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_13 * __pyx_v_fire.strides[0]) )) + __pyx_t_14)) )) = randRange(__pyx_v_intensity, 0x104);
                                goto __pyx_L14;
                                __pyx_L11_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L13;
                                __pyx_L13:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates9)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_x;
                                }
                                __pyx_L14:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_x = __pyx_parallel_temp0;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L7_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif

     6602:

     6603:

     6604:         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD

    +6605:         for y in prange(1, height - 1, schedule='static', num_threads=THREADS):

            __pyx_t_12 = (__pyx_v_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_12 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_12 = (__pyx_v_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_12 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                            {
                                __pyx_v_y = (int)(1 + 1 * __pyx_t_15);
                                /* Initialize private variables to invalid values */
                                __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                                __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                                __pyx_v_d = ((float)__PYX_NAN());
                                __pyx_v_ii = ((unsigned int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);

     6606:

    +6607:             for x in range(0, width):

                                __pyx_t_11 = __pyx_v_width;
                                __pyx_t_10 = __pyx_t_11;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     6608:

    +6609:                     c1 = (y + 1) % height

                                  __pyx_t_17 = (__pyx_v_y + 1);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6609, __pyx_L17_error)
                                  }
                                  __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

    +6610:                     c2 = x % width

                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6610, __pyx_L17_error)
                                  }
                                  __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

    +6611:                     d = (fire[c1, (x - 1 + width) % width]

                                  __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6611, __pyx_L17_error)
                                  }
                                  __pyx_t_18 = __pyx_v_c1;
                                  __pyx_t_14 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

    +6612:                        + fire[c1, c2]

                                  __pyx_t_19 = __pyx_v_c1;
                                  __pyx_t_20 = __pyx_v_c2;

    +6613:                        + fire[c1, (x + 1) % width]

                                  __pyx_t_21 = (__pyx_v_x + 1);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6613, __pyx_L17_error)
                                  }
                                  __pyx_t_22 = __pyx_v_c1;
                                  __pyx_t_13 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

    +6614:                        + fire[(y + 2) % height, c2]) * factor

                                  __pyx_t_23 = (__pyx_v_y + 2);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6614, __pyx_L17_error)
                                  }
                                  __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                                  __pyx_t_25 = __pyx_v_c2;
                                  __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_18 * __pyx_v_fire.strides[0]) )) + __pyx_t_14)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_19 * __pyx_v_fire.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_22 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

     6615:

    +6616:                     d = d - <float>(rand() * 0.0001)

                                  __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

     6617:

     6618:                     # Cap the values

    +6619:                     if d <0:

                                  __pyx_t_6 = ((__pyx_v_d < 0.0) != 0);
                                  if (__pyx_t_6) {
    /* … */
                                  }

    +6620:                         d = 0.0

                                    __pyx_v_d = 0.0;

     6621:

    +6622:                     if d>255.0:

                                  __pyx_t_6 = ((__pyx_v_d > 255.0) != 0);
                                  if (__pyx_t_6) {
    /* … */
                                  }

    +6623:                         d = <float>255.0

                                    __pyx_v_d = ((float)255.0);

     6624:

    +6625:                     fire[x % height , y % width] = d

                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6625, __pyx_L17_error)
                                  }
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6625, __pyx_L17_error)
                                  }
                                  __pyx_t_24 = __Pyx_mod_int(__pyx_v_x, __pyx_v_height);
                                  __pyx_t_13 = __Pyx_mod_int(__pyx_v_y, __pyx_v_width);
                                  *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_fire.data + __pyx_t_24 * __pyx_v_fire.strides[0]) )) + __pyx_t_13)) )) = __pyx_v_d;

     6626:

    +6627:                     ii = palette[<unsigned int>d % width]

                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 6627, __pyx_L17_error)
                                  }
                                  __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_width);
                                  __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

     6628:

    +6629:                     out[x, y, 0] = (ii >> 16) & 255

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_14 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = ((__pyx_v_ii >> 16) & 0xFF);

    +6630:                     out[x, y, 1] = (ii >> 8) & 255

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_14 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 8) & 0xFF);

    +6631:                     out[x, y, 2] = ii & 255

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_14 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_ii & 0xFF);
                                }
                                goto __pyx_L24;
                                __pyx_L17_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L23;
                                __pyx_L23:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates10)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_c1;
                                    __pyx_parallel_temp1 = __pyx_v_c2;
                                    __pyx_parallel_temp2 = __pyx_v_d;
                                    __pyx_parallel_temp3 = __pyx_v_ii;
                                    __pyx_parallel_temp4 = __pyx_v_x;
                                    __pyx_parallel_temp5 = __pyx_v_y;
                                }
                                __pyx_L24:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_c1 = __pyx_parallel_temp0;
                  __pyx_v_c2 = __pyx_parallel_temp1;
                  __pyx_v_d = __pyx_parallel_temp2;
                  __pyx_v_ii = __pyx_parallel_temp3;
                  __pyx_v_x = __pyx_parallel_temp4;
                  __pyx_v_y = __pyx_parallel_temp5;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L7_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     6632:

    +6633:     return asarray(out)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_out, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;

     6634:

     6635:

     6636: # CUSTOM FIRE PALETTE

     6637: # arr = numpy.array([0, 1,       # violet

     6638: #                    0, 1,       # blue

     6639: #                    0, 1,       # green

     6640: #                    2, 619,     # yellow

     6641: #                    620, 650,   # orange

     6642: #                    651, 660],  # red

     6643: #                   numpy.int)

     6644: #

     6645: # HEATMAP = [custom_map(i - 20, arr, 1.0) for i in range(380, 800)]

     6646: # heatmap_array = numpy.zeros((800 - 380, 3), uint8)

     6647: # heatmap_rescale = numpy.zeros(255, numpy.uint)

     6648: # i = 0

     6649: # for t in HEATMAP:

     6650: #     heatmap_array[i, 0] = t[0]

     6651: #     heatmap_array[i, 1] = t[1]

     6652: #     heatmap_array[i, 2] = t[2]

     6653: #     i += 1

     6654: # for r in range(0, 255):

     6655: #     s = int(r * (800.0-380.0)/255)

     6656: #     heatmap_rescale[r] = rgb_to_int(heatmap_array[s][0], heatmap_array[s][1], heatmap_array[s][2])

     6657: # heatmap_rescale = numpy.ascontiguousarray(heatmap_rescale[::-1])

     6658: # -------- main loop ----

     6659: # if frame % 2 == 0:

     6660: # surface_ = fire_effect(

     6661: #     width, height, 3.95 + random.uniform(0.002, 0.008),

     6662: #     heatmap_rescale,

     6663: #     FIRE_ARRAY,

     6664: #     reduce_factor_=3,  fire_intensity_=8,

     6665: #     smooth_=True, bloom_=True, fast_bloom_=True,

     6666: #     bpf_threshold_=70, low_=0, high_=800, brightness_=True, brightness_intensity_=0.1,

     6667: #     adjust_palette_=False, hsv_=(10,  80, 1.8), transpose_=False, border_=False, surface_=None)

     6668:

     6669: @cython.boundscheck(False)

     6670: @cython.wraparound(False)

     6671: @cython.nonecheck(False)

     6672: @cython.cdivision(True)

    +6673: cdef inline shader_fire_effect_c(

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_fire_effect_c(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_fire_, struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c *__pyx_optional_args) {
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)3);
      unsigned short __pyx_v_fire_intensity_ = ((unsigned short)32);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_10);
      __Pyx_XDECREF(__pyx_t_11);
      __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
      __Pyx_AddTraceback("PygameShader.shader.shader_fire_effect_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_fire_surface_smallest);
      __Pyx_XDECREF(__pyx_v_rgb_array_);
      __Pyx_XDECREF(__pyx_v_fire_effect);
      __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +6674:         int width_,

    struct __pyx_opt_args_12PygameShader_6shader_shader_fire_effect_c {
      int __pyx_n;
      unsigned short reduce_factor_;
      unsigned short fire_intensity_;
      int smooth_;
      int bloom_;
      int fast_bloom_;
      unsigned char bpf_threshold_;
      unsigned int low_;
      unsigned int high_;
      int brightness_;
      float brightness_intensity_;
      PyObject *surface_;
      int adjust_palette_;
      PyObject *hsl_;
      int transpose_;
      int border_;
      int blur_;
    };

     6675:         int height_,

     6676:         float factor_,

     6677:         unsigned int [::1] palette_,

     6678:         float [:, ::1] fire_,

     6679:         unsigned short int reduce_factor_ = 3,

     6680:         unsigned short int fire_intensity_= 32,

    +6681:         bint smooth_                      = True,

      int __pyx_v_smooth_ = ((int)1);

    +6682:         bint bloom_                       = True,

      int __pyx_v_bloom_ = ((int)1);

    +6683:         bint fast_bloom_                  = True,

      int __pyx_v_fast_bloom_ = ((int)1);
      unsigned char __pyx_v_bpf_threshold_ = ((unsigned char)0);
      unsigned int __pyx_v_low_ = ((unsigned int)0);
      unsigned int __pyx_v_high_ = ((unsigned int)0x258);

     6684:         unsigned char bpf_threshold_      = 0,

     6685:         unsigned int low_                 = 0,

     6686:         unsigned int high_                = 600,

    +6687:         bint brightness_                  = True,

      int __pyx_v_brightness_ = ((int)1);
      float __pyx_v_brightness_intensity_ = ((float)0.15);

     6688:         float brightness_intensity_       = 0.15,

    +6689:         object surface_                   = None,

      PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

    +6690:         bint adjust_palette_              = False,

      int __pyx_v_adjust_palette_ = ((int)0);

    +6691:         tuple hsl_                        = (10, 80, 1.8),

      PyObject *__pyx_v_hsl_ = ((PyObject*)__pyx_tuple__23);
    /* … */
      __pyx_tuple__23 = PyTuple_Pack(3, __pyx_int_10, __pyx_int_80, __pyx_float_1_8); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 6691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__23);
      __Pyx_GIVEREF(__pyx_tuple__23);

    +6692:         bint transpose_                   = False,

      int __pyx_v_transpose_ = ((int)0);

    +6693:         bint border_                      = False,

      int __pyx_v_border_ = ((int)0);

    +6694:         bint blur_                        = True

      int __pyx_v_blur_ = ((int)1);
      int __pyx_v_w4;
      int __pyx_v_h4;
      int __pyx_v_f_height;
      int __pyx_v_f_width;
      PyObject *__pyx_v_fire_surface_smallest = NULL;
      PyObject *__pyx_v_rgb_array_ = NULL;
      PyObject *__pyx_v_fire_effect = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_fire_effect_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_fire_intensity_ = __pyx_optional_args->fire_intensity_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_smooth_ = __pyx_optional_args->smooth_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_bloom_ = __pyx_optional_args->bloom_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                    if (__pyx_optional_args->__pyx_n > 6) {
                      __pyx_v_low_ = __pyx_optional_args->low_;
                      if (__pyx_optional_args->__pyx_n > 7) {
                        __pyx_v_high_ = __pyx_optional_args->high_;
                        if (__pyx_optional_args->__pyx_n > 8) {
                          __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                          if (__pyx_optional_args->__pyx_n > 9) {
                            __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                            if (__pyx_optional_args->__pyx_n > 10) {
                              __pyx_v_surface_ = __pyx_optional_args->surface_;
                              if (__pyx_optional_args->__pyx_n > 11) {
                                __pyx_v_adjust_palette_ = __pyx_optional_args->adjust_palette_;
                                if (__pyx_optional_args->__pyx_n > 12) {
                                  __pyx_v_hsl_ = __pyx_optional_args->hsl_;
                                  if (__pyx_optional_args->__pyx_n > 13) {
                                    __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                    if (__pyx_optional_args->__pyx_n > 14) {
                                      __pyx_v_border_ = __pyx_optional_args->border_;
                                      if (__pyx_optional_args->__pyx_n > 15) {
                                        __pyx_v_blur_ = __pyx_optional_args->blur_;
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      __PYX_INC_MEMVIEW(&__pyx_v_palette_, 1);

     6695:         ):

     6696:     """

     6697:

     6698:     FIRE SHADER EFFECT

     6699:

     6700:     * FIRE TEXTURE SIZES

     6701:

     6702:     input width_  : integer,

     6703:     input height_ : integer

     6704:

     6705:     width_ and height_ values define the size of the texture e.g Surface(width x height)

     6706:

     6707:     * FIRE ASPECT (CONTROL OVER THE WIDTH):

     6708:

     6709:     inputs low_ : integer

     6710:     input high_ : integer

     6711:

     6712:     Optional arguments low_ & high_ (integer values) define the width 's limits of the fire effect.

     6713:     low_ for the starting point and high_ for the ending of the effect.

     6714:     e.g low_ = 10 and high_ = 200. The fire effect will be contain within width = 10 and 200

     6715:     low_ & high_ values must be in range [0 ... width_]

     6716:

     6717:     * FIRE HEIGHT:

     6718:

     6719:     input factor_ : float

     6720:

     6721:     The fire maximum height can be adjust with the variable factor_ (float value)

     6722:     value > 3.95 will contain the effect within the display

     6723:     value < 3.95 will enlarge the effect over the display height

     6724:     Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually

     6725:     to contain the fire effect within the display

     6726:

     6727:     * SPEED CONSIDERATION

     6728:

     6729:     input reduce_factor_ : integer

     6730:

     6731:     The argument reduce_factor_ control the size of the texture to be processed

     6732:     e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)

     6733:     Smaller texture improve the overall performances but will slightly degrade the fire aspect,

     6734:     especially if the blur and smooth option are not enabled.

     6735:     Recommended value for reduce_factor_ is 3 (fast process)

     6736:     reduce_factor_ values must be an integer in range [ 0 ... 4]

     6737:     The reduce_factor_ value will have a significant impact on the fire effect maximum height,

     6738:     adjust the argument factor_ accordingly

     6739:

     6740:     * FIRE INTENSITY AT THE SOURCE

     6741:

     6742:     input fire_intensity_: integer

     6743:

     6744:     Set the fire intensity with the variable fire_intensity_, 0 low flame,

     6745:     32 maximum flame effect

     6746:     Values must be an int in range [0 ... 32]

     6747:

     6748:     * SMOOTHING THE EFFECT

     6749:

     6750:     input smooth_: True | False

     6751:

     6752:     When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear

     6753:     filtering) or False the final texture will be adjust with the scale function.

     6754:     Set this variable to False if you need the best performance for the effect or if you require

     6755:     a pixelated fire effect. Otherwise set the variable to True for a more realistic effect.

     6756:

     6757:

     6758:     * BLOOM EFFECT

     6759:

     6760:     input bloom_         : True | False

     6761:     input fast_bloom_    : True | False

     6762:     input bpf_threshold_ : integer

     6763:

     6764:     Fire effect produce a bright and smooth light effect to the background texture where the fire

     6765:     intensity is at its maximum.

     6766:     Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances

     6767:     The flag fast_bloom_ define a very fast bloom algo using only the smallest texture

     6768:     to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect

     6769:     project for more details.

     6770:     When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will

     6771:     produce a more realistic fire effect (this will slightly degrade the overall performances).

     6772:     If the fire effect is too bright, you can always adjust the bright pass filter value

     6773:     bpf_threshold_(this will adjust the bloom intensity)

     6774:     bpf_threshold_ value must be in range [ 0 ... 255]

     6775:     Below 128 the bloom effect will be more noticeable and above 128 only the brightest

     6776:     area will be enhanced.

     6777:

     6778:     * LIGHT EFFECT INTENSITY

     6779:

     6780:     input brightness_            : True | False

     6781:     input brightness_intensity_  : float

     6782:

     6783:     When the flag is set to True, the algorithm will use an external function,

     6784:     <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture

     6785:     A custom color can be passed to the function defining the pixels to be ignored during the

     6786:     process (default is black color).

     6787:     the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness

     6788:     of the flame effect and positive values will increase the brightness of the effect (causing

     6789:     bright white patches on the fire texture).

     6790:     Values below -0.4 will cause the fire effect to be translucent and this effect can also be

     6791:     used for simulating ascending heat convection effects on a background texture.

     6792:

     6793:

     6794:     * OPTIONAL SURFACE

     6795:

     6796:     input surface_ : pygame.Surface

     6797:

     6798:     This is an optional surface that can be passed to the shader to improve the performances

     6799:     and to avoid a new surface to be generated every iterations. The surface size must match

     6800:     exactly the reduce texture dimensions otherwise an exception will be raise.

     6801:     see reduce_factor_ option to determine the fire texture size that will be processed.

     6802:

     6803:     * COLOR PALETTE ADJUSTMENT

     6804:

     6805:     input adjust_palette_ : True | False

     6806:     input hsl_            : (10, 80, 1.8)

     6807:

     6808:     Set this flag to True to modify the color palette of the fire texture.

     6809:     This allow the HSL color model to be apply to the palette values

     6810:     You can redefine the palette when the flag is True and by customizing a tuple of 3 float

     6811:     values, default is (10, 80, 1.8).

     6812:     The first value control the palette hue value, the second is for the saturation and last,

     6813:     the palette color lightness.

     6814:     With the variable hsl_ you can rotate the palette colors and define a new flame

     6815:     aspect/color/intensity

     6816:

     6817:     * FLAME ORIENTATION / DIRECTION & BORDER FLAME EFFECT

     6818:

     6819:     input transpose_ = True | False,

     6820:     input border_    = True | False,

     6821:

     6822:     transpose_ = True, this will transpose the final array

     6823:     for e.g :

     6824:     If the final fire texture is (w, h) after setting the transpose flag, the final

     6825:     fire texture will become (h, w). As a result the fire effect will be transversal (starting

     6826:     from the right of the display to the left side).

     6827:     You can always transpose / flip the texture to get the right flame orientation

     6828:     BORDER FLAME EFFECT

     6829:     border_ = True to create a flame effect burning the edge of the display

     6830:

     6831:     * FINAL TOUCH

     6832:

     6833:     input blur_ : True | False

     6834:

     6835:     This will will blur the fire effect for a more realistic appearance, remove all the jagged

     6836:     edge when and pixelated effect

     6837:

     6838:

     6839:     :param width_           : integer; Size (width) of the surface or display in pixels

     6840:     :param height_          : integer; size (height) of the surface or display in pixels

     6841:     :param factor_          : float; Value controlling the fire height value

     6842:                               must be in range [3.95 ... 4.2].

     6843:                               The value 3.95 gives the highest flame effect

     6844:     :param palette_         : numpy.ndarray, buffer containing mapped RGB colors (uint values)

     6845:     :param fire_            : numpy.ndarray shape (w, h) containing float values (fire intensity).

     6846:                               For better performance it is advised to set the array to the size

     6847:                               of the texture after applying the reduction_factor_.

     6848:                               For example if the reduction_factor_ is 2, the texture would have

     6849:                               width >> 1 and height >> 1 and the fire_array should be set to

     6850:                               numpy.empty((height >> 1, width >> 1), float32)

     6851:     :param reduce_factor_   : unsigned short int ; Can be either 0, 1, 2, 3, 4.

     6852:                               2 and 3 provide the best performance and the best looking effect.

     6853:     :param fire_intensity_  : Integer; Control the original amount of energy at the

     6854:                               bottom of the fire, must be in range of [0 ... 32].

     6855:                               32 being the maximum value and the maximum fire intensity

     6856:     :param smooth_          : boolean; True smoothscale (bi-linear filtering) or

     6857:                               scale algorithm jagged edges (mush faster)

     6858:     :param bloom_           : boolean; True or False, True apply a bloom effect to the fire effect

     6859:     :param fast_bloom_      : boolean; Fastest bloom. This reduce the amount of calculation

     6860:     :param bpf_threshold_   : integer; control the bright pass filter threshold

     6861:                               value, must be in range [0 ... 255].

     6862:                               Maximum brightness amplification with threshold = 0,

     6863:                               when bpf_threshold_ = 255, no change.

     6864:     :param low_             : integer; Starting position x for the fire effect

     6865:     :param high_            : integer; Ending position x for the fire effect

     6866:     :param brightness_      : boolean; True apply a bright filter shader to the array.

     6867:                               Increase overall brightness of the effect

     6868:     :param brightness_intensity_: float; must be in range [-1.0 ... 1.0] control

     6869:                               the brightness intensity

     6870:                               of the effect

     6871:     :param surface_         : pygame.Surface. Pass a surface to the shader for

     6872:                               better performance, otherwise algo is creating a new surface each

     6873:                               calls.

     6874:     :param adjust_palette_  : boolean; True adjust the palette setting HSL

     6875:                               (hue, saturation, luminescence).

     6876:                               Be aware that if adjust_palette is True, the optional palette

     6877:                               passed to the Shader will be disregarded

     6878:     :param hsl_             : tuple; float values of hue, saturation and luminescence.

     6879:                               Hue in range [0.0 ... 100],  saturation [0...100],

     6880:                               luminescence [0.0 ... 2.0]

     6881:     :param transpose_       : boolean; Transpose the array (w, h) become (h, w).

     6882:                               The fire effect will start from the left and move to the right

     6883:     :param border_          : boolean; Flame effect affect the border of the texture

     6884:     :param blur_            : boolean; Blur the fire effect

     6885:     :return                 : Return a pygame surface that can be blit directly to the game display

     6886:

     6887:     """

     6888:

     6889:

     6890:     cdef int w4, h4

     6891:

     6892:     # TEXTURE DIVIDE BY POWER OF 2

    +6893:     if reduce_factor_ in (0, 1, 2):

      switch (__pyx_v_reduce_factor_) {
        case 0:
        case 1:
        case 2:
    /* … */
        break;
        case 3:

    +6894:         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_

        __pyx_t_1 = (__pyx_v_width_ >> __pyx_v_reduce_factor_);
        __pyx_t_2 = (__pyx_v_height_ >> __pyx_v_reduce_factor_);
        __pyx_v_w4 = __pyx_t_1;
        __pyx_v_h4 = __pyx_t_2;

     6895:

     6896:     # TEXTURE 150 x 150 * ratio

    +6897:     elif reduce_factor_ == 3:

        break;
        case 4:

     6898:         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH

    +6899:         w4 = 150

        __pyx_v_w4 = 0x96;

    +6900:         h4 = <int>(150 * height_/width_)

        __pyx_v_h4 = ((int)((0x96 * __pyx_v_height_) / __pyx_v_width_));

    +6901:         low_ = <int>(low_ * low_/width_)

        __pyx_v_low_ = ((int)((__pyx_v_low_ * __pyx_v_low_) / __pyx_v_width_));

    +6902:         high_ = <int>(high_ * 150/width_)

        __pyx_v_high_ = ((int)((__pyx_v_high_ * 0x96) / __pyx_v_width_));

    +6903:         reduce_factor_ = 0

        __pyx_v_reduce_factor_ = 0;

     6904:

     6905:     # TEXTURE 100 x 100 * ratio

    +6906:     elif reduce_factor_ == 4:

        break;
        default: break;
      }

    +6907:         w4 = 100

        __pyx_v_w4 = 0x64;

    +6908:         h4 = <int> (100 * height_ / width_)

        __pyx_v_h4 = ((int)((0x64 * __pyx_v_height_) / __pyx_v_width_));

    +6909:         low_ = <int> (low_ * low_ / width_)

        __pyx_v_low_ = ((int)((__pyx_v_low_ * __pyx_v_low_) / __pyx_v_width_));

    +6910:         high_ = <int> (high_ * 100 / width_)

        __pyx_v_high_ = ((int)((__pyx_v_high_ * 0x64) / __pyx_v_width_));

    +6911:         reduce_factor_ = 0

        __pyx_v_reduce_factor_ = 0;

     6912:

     6913:     cdef int f_height, f_width

    +6914:     f_height, f_width = (<object>fire_).shape[:2]

      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_fire_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_4, 0, 2, NULL, NULL, &__pyx_slice__24, 0, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 6914, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6914, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6914, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6914, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(1, 6914, __pyx_L1_error)
        __pyx_t_7 = NULL;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 6914, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_f_height = __pyx_t_2;
      __pyx_v_f_width = __pyx_t_1;
    /* … */
      __pyx_slice__24 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(1, 6914, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_slice__24);
      __Pyx_GIVEREF(__pyx_slice__24);

     6915:

    +6916:     assert f_width >= w4 or f_height >= h4,\

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_9 = ((__pyx_v_f_width >= __pyx_v_w4) != 0);
        if (!__pyx_t_9) {
        } else {
          __pyx_t_8 = __pyx_t_9;
          goto __pyx_L5_bool_binop_done;
        }
        __pyx_t_9 = ((__pyx_v_f_height >= __pyx_v_h4) != 0);
        __pyx_t_8 = __pyx_t_9;
        __pyx_L5_bool_binop_done:;
        if (unlikely(!__pyx_t_8)) {

     6917:         "Fire array size mismatch the texture size.\n" \

    +6918:         "Set fire_ array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)

          __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6918, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6918, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6918, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
          __pyx_t_3 = 0;
          __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Fire_array_size_mismatch_the_tex, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6918, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_5);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __PYX_ERR(1, 6916, __pyx_L1_error)
        }
      }
      #endif

     6919:

    +6920:     if surface_ is None:

      __pyx_t_8 = (__pyx_v_surface_ == Py_None);
      __pyx_t_9 = (__pyx_t_8 != 0);
      if (__pyx_t_9) {
    /* … */
        goto __pyx_L7;
      }

    +6921:         fire_surface_smallest = pygame.Surface((w4, h4)).convert()

        __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Surface); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
        __pyx_t_3 = 0;
        __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_t_11) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_11);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6921, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_v_fire_surface_smallest = __pyx_t_5;
        __pyx_t_5 = 0;

     6922:

     6923:     else:

    +6924:         if PyObject_IsInstance(surface_, pygame.Surface):

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Surface); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_6); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 6924, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_8 = (__pyx_t_9 != 0);
        if (likely(__pyx_t_8)) {
    /* … */
          goto __pyx_L8;
        }

    +6925:             assert surface_.get_width() == w4 and surface_.get_height() == h4, \

          #ifndef CYTHON_WITHOUT_ASSERTIONS
          if (unlikely(!Py_OptimizeFlag)) {
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_4)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_4);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
              }
            }
            __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            if (__pyx_t_9) {
            } else {
              __pyx_t_8 = __pyx_t_9;
              goto __pyx_L9_bool_binop_done;
            }
            __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_6 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_5, function);
              }
            }
            __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(1, 6925, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_8 = __pyx_t_9;
            __pyx_L9_bool_binop_done:;
            if (unlikely(!__pyx_t_8)) {

     6926:             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \

     6927:             "Set argument surface_ to None to avoid this error message"\

    +6928:             % (w4, h4, surface_.get_width(), surface_.get_height())

              __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __pyx_t_10 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
                __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
                if (likely(__pyx_t_10)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
                  __Pyx_INCREF(__pyx_t_10);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_11, function);
                }
              }
              __pyx_t_4 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_11);
              __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
              if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __pyx_t_3 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
                __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
                if (likely(__pyx_t_3)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
                  __Pyx_INCREF(__pyx_t_3);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_10, function);
                }
              }
              __pyx_t_11 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_10);
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
              __Pyx_GIVEREF(__pyx_t_5);
              PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
              __Pyx_GIVEREF(__pyx_t_4);
              PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
              __Pyx_GIVEREF(__pyx_t_11);
              PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_11);
              __pyx_t_6 = 0;
              __pyx_t_5 = 0;
              __pyx_t_4 = 0;
              __pyx_t_11 = 0;
              __pyx_t_11 = __Pyx_PyString_Format(__pyx_kp_s_Surface_argument_has_incorrect_d, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6928, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
              PyErr_SetObject(PyExc_AssertionError, __pyx_t_11);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
              __PYX_ERR(1, 6925, __pyx_L1_error)
            }
          }
          #endif

    +6929:             fire_surface_smallest = surface_

          __Pyx_INCREF(__pyx_v_surface_);
          __pyx_v_fire_surface_smallest = __pyx_v_surface_;

     6930:         else:

    +6931:             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))

        /*else*/ {
          __pyx_t_11 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_Surf, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6931, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6931, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_Raise(__pyx_t_10, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __PYX_ERR(1, 6931, __pyx_L1_error)
        }
        __pyx_L8:;
      }
      __pyx_L7:;

     6932:

    +6933:     if adjust_palette_:

      __pyx_t_8 = (__pyx_v_adjust_palette_ != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +6934:         palette_= make_palette_c(w4, hsl_[0], hsl_[1], hsl_[2])

        if (unlikely(__pyx_v_hsl_ == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6934, __pyx_L1_error)
        }
        __pyx_t_12 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 0)); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
        if (unlikely(__pyx_v_hsl_ == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6934, __pyx_L1_error)
        }
        __pyx_t_13 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 1)); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
        if (unlikely(__pyx_v_hsl_ == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          __PYX_ERR(1, 6934, __pyx_L1_error)
        }
        __pyx_t_14 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v_hsl_, 2)); if (unlikely((__pyx_t_14 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 6934, __pyx_L1_error)
        __pyx_t_10 = __pyx_f_12PygameShader_6shader_make_palette_c(__pyx_v_w4, __pyx_t_12, __pyx_t_13, __pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6934, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_10, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 6934, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_v_palette_, 1);
        __pyx_v_palette_ = __pyx_t_15;
        __pyx_t_15.memview = NULL;
        __pyx_t_15.data = NULL;

     6935:

    +6936:     if border_:

      __pyx_t_8 = (__pyx_v_border_ != 0);
      if (__pyx_t_8) {
    /* … */
        goto __pyx_L12;
      }

     6937:         # CREATE THE FIRE EFFECT ONTO A PYGAME SURFACE

    +6938:         rgb_array_ = fire_surface24_c_border(

        __pyx_t_16.__pyx_n = 3;
        __pyx_t_16.intensity = __pyx_v_fire_intensity_;
        __pyx_t_16.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
        __pyx_t_16.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
        __pyx_t_10 = __pyx_f_12PygameShader_6shader_fire_surface24_c_border(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6938, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_v_rgb_array_ = __pyx_t_10;
        __pyx_t_10 = 0;

     6939:             w4, h4, <float>1.0 / factor_, palette_, fire_, fire_intensity_,

     6940:             low_ >> reduce_factor_, high_ >> reduce_factor_)

     6941:     else:

    +6942:         rgb_array_ = fire_surface24_c(

      /*else*/ {
    /* … */
        __pyx_t_17.__pyx_n = 3;
        __pyx_t_17.intensity = __pyx_v_fire_intensity_;
        __pyx_t_17.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
        __pyx_t_17.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
        __pyx_t_10 = __pyx_f_12PygameShader_6shader_fire_surface24_c(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_fire_, &__pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6942, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_v_rgb_array_ = __pyx_t_10;
        __pyx_t_10 = 0;
      }
      __pyx_L12:;

     6943:             w4, h4, <float>1.0 / factor_, palette_, fire_, fire_intensity_,

     6944:                     low_ >> reduce_factor_, high_ >> reduce_factor_)

     6945:

     6946:     # BRIGHTNESS SHADER

    +6947:     if brightness_:

      __pyx_t_8 = (__pyx_v_brightness_ != 0);
      if (__pyx_t_8) {
    /* … */
      }

     6948:         # EXCLUDE BLACK COLORS (DEFAULT)

    +6949:         assert -1.0 <= brightness_intensity_ <= 1.0, \

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_8 = (-1.0 <= __pyx_v_brightness_intensity_);
          if (__pyx_t_8) {
            __pyx_t_8 = (__pyx_v_brightness_intensity_ <= 1.0);
          }
          if (unlikely(!(__pyx_t_8 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_brightness_intensity_mu);
            __PYX_ERR(1, 6949, __pyx_L1_error)
          }
        }
        #endif

     6950:             "Argument brightness intensity must be in range [-1.0 ... 1.0]"

    +6951:         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,

        __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 6951, __pyx_L1_error)
    /* … */
        __pyx_t_19.__pyx_n = 2;
        __pyx_t_19.shift_ = __pyx_v_brightness_intensity_;
        __pyx_t_19.color_ = __pyx_tuple__9;
        __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_18, &__pyx_t_19);
        __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
        __pyx_t_18.memview = NULL;
        __pyx_t_18.data = NULL;

     6952:                                               shift_=brightness_intensity_, color_=(0, 0, 0))

     6953:

    +6954:     if blur_:

      __pyx_t_8 = (__pyx_v_blur_ != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +6955:         shader_blur5x5_array24_inplace_c(rgb_array_)

        __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(1, 6955, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_18, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
        __pyx_t_18.memview = NULL;
        __pyx_t_18.data = NULL;

     6956:

    +6957:     if transpose_:

      __pyx_t_8 = (__pyx_v_transpose_ != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +6958:         rgb_array_ = rgb_array_.transpose(1, 0, 2)

        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_rgb_array_, __pyx_n_s_transpose_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6958, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6958, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_rgb_array_, __pyx_t_11);
        __pyx_t_11 = 0;
    /* … */
      __pyx_tuple__25 = PyTuple_Pack(3, __pyx_int_1, __pyx_int_0, __pyx_int_2); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 6958, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__25);
      __Pyx_GIVEREF(__pyx_tuple__25);

    +6959:         fire_surface_smallest = rotate(fire_surface_smallest, 90)

        __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_rotate); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_4 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fire_surface_smallest, __pyx_int_90};
          __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_11);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_fire_surface_smallest, __pyx_int_90};
          __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_11);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (__pyx_t_4) {
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
          }
          __Pyx_INCREF(__pyx_v_fire_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
          __Pyx_INCREF(__pyx_int_90);
          __Pyx_GIVEREF(__pyx_int_90);
          PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_1, __pyx_int_90);
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF_SET(__pyx_v_fire_surface_smallest, __pyx_t_11);
        __pyx_t_11 = 0;

     6960:

     6961:

     6962:     # CONVERT THE ARRAY INTO A PYGAME SURFACE

    +6963:     array_to_surface(fire_surface_smallest, rgb_array_)

      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = NULL;
      __pyx_t_1 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_1 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_v_rgb_array_};
        __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_v_rgb_array_};
        __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_INCREF(__pyx_v_fire_surface_smallest);
        __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
        __Pyx_INCREF(__pyx_v_rgb_array_);
        __Pyx_GIVEREF(__pyx_v_rgb_array_);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_v_rgb_array_);
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

     6964:

     6965:

     6966:     # BLOOM SHADER EFFECT

    +6967:     if bloom_:

      __pyx_t_8 = (__pyx_v_bloom_ != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +6968:         assert 0 <= bpf_threshold_ < 256, \

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_8 = (0 <= __pyx_v_bpf_threshold_);
          if (__pyx_t_8) {
            __pyx_t_8 = (__pyx_v_bpf_threshold_ < 0x100);
          }
          if (unlikely(!(__pyx_t_8 != 0))) {

    +6969:             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_

            __pyx_t_11 = __Pyx_PyInt_From_unsigned_char(__pyx_v_bpf_threshold_); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6969, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_10 = __Pyx_PyString_Format(__pyx_kp_s_Argument_bpf_threshold__must_be, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6969, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            PyErr_SetObject(PyExc_AssertionError, __pyx_t_10);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __PYX_ERR(1, 6968, __pyx_L1_error)
          }
        }
        #endif

    +6970:         shader_bloom_effect_array24_c(fire_surface_smallest, bpf_threshold_, fast_=fast_bloom_)

        __pyx_t_20.__pyx_n = 1;
        __pyx_t_20.fast_ = __pyx_v_fast_bloom_;
        __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_fire_surface_smallest, __pyx_v_bpf_threshold_, &__pyx_t_20);

     6971:

     6972:     # RESCALE THE SURFACE TO THE FULL SIZE

    +6973:     if smooth_:

      __pyx_t_8 = (__pyx_v_smooth_ != 0);
      if (__pyx_t_8) {
    /* … */
        goto __pyx_L17;
      }

    +6974:         fire_effect = smoothscale(fire_surface_smallest, (width_, height_))

        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6974, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
        __pyx_t_4 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_t_6};
          __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_fire_surface_smallest, __pyx_t_6};
          __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6974, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__pyx_t_5) {
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
          }
          __Pyx_INCREF(__pyx_v_fire_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6974, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_v_fire_effect = __pyx_t_10;
        __pyx_t_10 = 0;

     6975:     else:

    +6976:         fire_effect = scale(fire_surface_smallest, (width_, height_))

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_11, __pyx_n_s_scale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 6976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 6976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6976, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
        __pyx_t_4 = 0;
        __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_fire_surface_smallest, __pyx_t_5};
          __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_fire_surface_smallest, __pyx_t_5};
          __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6976, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_v_fire_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_fire_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_1, __pyx_v_fire_surface_smallest);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 6976, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_v_fire_effect = __pyx_t_10;
        __pyx_t_10 = 0;
      }
      __pyx_L17:;

     6977:

    +6978:     return fire_effect

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_fire_effect);
      __pyx_r = __pyx_v_fire_effect;
      goto __pyx_L0;

     6979:

     6980:

     6981:

     6982: @cython.boundscheck(False)

     6983: @cython.wraparound(False)

     6984: @cython.nonecheck(False)

     6985: @cython.cdivision(False)

    +6986: cdef cloud_surface24_c(

    static PyObject *__pyx_f_12PygameShader_6shader_cloud_surface24_c(int __pyx_v_width, int __pyx_v_height, float __pyx_v_factor, __Pyx_memviewslice __pyx_v_palette, __Pyx_memviewslice __pyx_v_cloud_, struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c *__pyx_optional_args) {
      int __pyx_v_intensity = ((int)0);
      int __pyx_v_low = ((int)0);
      int __pyx_v_high = ((int)0);
      int __pyx_v_new_height;
      __Pyx_memviewslice __pyx_v_out = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      float __pyx_v_d;
      unsigned int __pyx_v_ii;
      unsigned int __pyx_v_c1;
      unsigned int __pyx_v_c2;
      int __pyx_v_p_length;
      CYTHON_UNUSED int __pyx_v_min_;
      CYTHON_UNUSED int __pyx_v_max_;
      int __pyx_v_middle;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cloud_surface24_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_intensity = __pyx_optional_args->intensity;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_low = __pyx_optional_args->low;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_high = __pyx_optional_args->high;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __Pyx_AddTraceback("PygameShader.shader.cloud_surface24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_out, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +6987:         int width,

    struct __pyx_opt_args_12PygameShader_6shader_cloud_surface24_c {
      int __pyx_n;
      int intensity;
      int low;
      int high;
    };

     6988:         int height,

     6989:         float factor,

     6990:         unsigned int [::1] palette,

     6991:         float [:, ::1] cloud_,

     6992:         int intensity = 0,

     6993:         int low       = 0,

     6994:         int high      = 0,

     6995:     ):

     6996:

     6997:     """

     6998:     CLOUD PROCESSING FUNCTION

     6999:

     7000:     * Do not call that function directly, this function is a sub function of cloud_effect

     7001:

     7002:     :param width    : integer; Size (width) of the surface or display in pixels

     7003:     :param height   : integer; size (height) of the surface or display in pixels

     7004:     :param factor   : float; Value controlling the cloud size value must

     7005:                       be in range [3.95 ... 4.2].

     7006:                       value 3.95 will fill entirely the display with the cloud while value

     7007:                       above 3.95 will shrink the cloud effect

     7008:     :param palette  : numpy.ndarray, buffer containing mapped RGB colors (uint values)

     7009:     :param cloud_   : numpy.ndarray shape (w, h) containing float values (cloud intensity).

     7010:     :param intensity: integer; Determine the guaranteed amount of smoke the cloud

     7011:                       effect will generate at the base

     7012:                       of the effect (value must be in range [0 .. 260]). If you provide zero a

     7013:                       random value between 0 ... 260 will be

     7014:                       assigned. If you provide 250, a random value between 250 and 260 will be set.

     7015:     :param low      : integer; low determine the X starting position on the display,

     7016:                       if you provide a value of

     7017:                       100 pixels, the effect will start at the position 100 from the display

     7018:                       (first 100 pixels will bot be affected by the cloud/smoke effect)

     7019:     :param high     : integer; high determine the X ending position on the display,

     7020:                       if you provide a value of 800 pixels, the effect will end at the

     7021:                       position 800 from the display (last remaining pixels will not be affected

     7022:                       by the cloud/smoke effect)

     7023:     :return         : Return a numpy array shape (w, h, 3) containing the RGB pixels (smoke effect)

     7024:     """

     7025:

     7026:     cdef:

    +7027:         int new_height = height

      __pyx_v_new_height = __pyx_v_height;

    +7028:         unsigned char [:, :, ::1] out = empty((width, new_height, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_new_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 7028, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;

    +7029:         int x = 0, y = 0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     7030:         float d

    +7031:         unsigned int ii=0

      __pyx_v_ii = 0;

    +7032:         unsigned c1 = 0, c2 = 0

      __pyx_v_c1 = 0;
      __pyx_v_c2 = 0;

    +7033:         int p_length = (<object>palette).size

      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_palette, 1, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_int, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7033, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7033, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_p_length = __pyx_t_6;

     7034:

     7035:     cdef int min_, max_, middle

     7036:

    +7037:     if low != 0 or high != 0:

      __pyx_t_8 = ((__pyx_v_low != 0) != 0);
      if (!__pyx_t_8) {
      } else {
        __pyx_t_7 = __pyx_t_8;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_8 = ((__pyx_v_high != 0) != 0);
      __pyx_t_7 = __pyx_t_8;
      __pyx_L4_bool_binop_done:;
      if (__pyx_t_7) {
    /* … */
        goto __pyx_L3;
      }

    +7038:         assert 0 <= low < high, "Argument low_ must be < high_"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_7 = (0 <= __pyx_v_low);
          if (__pyx_t_7) {
            __pyx_t_7 = (__pyx_v_low < __pyx_v_high);
          }
          if (unlikely(!(__pyx_t_7 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_low__must_be_high);
            __PYX_ERR(1, 7038, __pyx_L1_error)
          }
        }
        #endif

    +7039:         assert high <= width,   "Argument high must be <= width"

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          if (unlikely(!((__pyx_v_high <= __pyx_v_width) != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_high_must_be_width);
            __PYX_ERR(1, 7039, __pyx_L1_error)
          }
        }
        #endif

     7040:

    +7041:         middle = low + ((high - low) >> 1)

        __pyx_v_middle = (__pyx_v_low + ((__pyx_v_high - __pyx_v_low) >> 1));

    +7042:         min_ = randRange(low, middle)

        __pyx_v_min_ = randRange(__pyx_v_low, __pyx_v_middle);

    +7043:         max_ = randRange(middle + 1, high)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_high);

     7044:     else:

    +7045:         middle = width >> 1

      /*else*/ {
        __pyx_v_middle = (__pyx_v_width >> 1);

    +7046:         min_ = randRange(0, middle)

        __pyx_v_min_ = randRange(0, __pyx_v_middle);

    +7047:         max_ = randRange(middle +1, width)

        __pyx_v_max_ = randRange((__pyx_v_middle + 1), __pyx_v_width);
      }
      __pyx_L3:;

     7048:

     7049:

    +7050:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L8;
            }
            __pyx_L7_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L8:;
          }
      }

     7051:         # POPULATE TO THE BASE OF THE FIRE (THIS WILL CONFIGURE THE FLAME ASPECT)

    +7052:         for x in prange(min_, max_, schedule='static', num_threads=THREADS):

            __pyx_t_6 = __pyx_v_min_;
            __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_6 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static)        __pyx_t_9 = __pyx_v_max_;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_11 = (__pyx_t_9 - __pyx_t_6 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_11 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_11; __pyx_t_10++){
                            {
                                __pyx_v_x = (int)(__pyx_t_6 + 1 * __pyx_t_10);

    +7053:                 cloud_[(new_height - 1) % height, x % width] = randRange(intensity, 260)

                                __pyx_t_12 = (__pyx_v_new_height - 1);
                                if (unlikely(__pyx_v_height == 0)) {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                                  __PYX_ERR(1, 7053, __pyx_L11_error)
                                }
                                if (unlikely(__pyx_v_width == 0)) {
                                  #ifdef WITH_THREAD
                                  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                  #endif
                                  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                  #ifdef WITH_THREAD
                                  __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                  #endif
                                  __PYX_ERR(1, 7053, __pyx_L11_error)
                                }
                                __pyx_t_13 = __Pyx_mod_long(__pyx_t_12, __pyx_v_height);
                                __pyx_t_14 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);
                                *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_13 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_14)) )) = randRange(__pyx_v_intensity, 0x104);
                                goto __pyx_L14;
                                __pyx_L11_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L13;
                                __pyx_L13:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates11)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_x;
                                }
                                __pyx_L14:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_x = __pyx_parallel_temp0;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L7_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif

     7054:

     7055:

     7056:         # DILUTE THE FLAME EFFECT (DECREASE THE MAXIMUM INT VALUE) WHEN THE FLAME TRAVEL UPWARD

    +7057:         for y in prange(0, new_height - 1, schedule='static', num_threads=THREADS):

            __pyx_t_12 = (__pyx_v_new_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_12 = (__pyx_v_new_height - 1);
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_16 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_16 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_d) lastprivate(__pyx_v_ii) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_15);
                                /* Initialize private variables to invalid values */
                                __pyx_v_c1 = ((unsigned int)0xbad0bad0);
                                __pyx_v_c2 = ((unsigned int)0xbad0bad0);
                                __pyx_v_d = ((float)__PYX_NAN());
                                __pyx_v_ii = ((unsigned int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);

     7058:

    +7059:             for x in range(0, width):

                                __pyx_t_11 = __pyx_v_width;
                                __pyx_t_10 = __pyx_t_11;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     7060:

    +7061:                     c1 = (y + 1) % height

                                  __pyx_t_17 = (__pyx_v_y + 1);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7061, __pyx_L17_error)
                                  }
                                  __pyx_v_c1 = __Pyx_mod_long(__pyx_t_17, __pyx_v_height);

    +7062:                     c2 = x % width

                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7062, __pyx_L17_error)
                                  }
                                  __pyx_v_c2 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);

    +7063:                     d = (cloud_[c1, (x - 1 + width) % width]

                                  __pyx_t_17 = ((__pyx_v_x - 1) + __pyx_v_width);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7063, __pyx_L17_error)
                                  }
                                  __pyx_t_18 = __pyx_v_c1;
                                  __pyx_t_14 = __Pyx_mod_long(__pyx_t_17, __pyx_v_width);

    +7064:                        + cloud_[c1, c2]

                                  __pyx_t_19 = __pyx_v_c1;
                                  __pyx_t_20 = __pyx_v_c2;

    +7065:                        + cloud_[c1, (x + 1) % width]

                                  __pyx_t_21 = (__pyx_v_x + 1);
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7065, __pyx_L17_error)
                                  }
                                  __pyx_t_22 = __pyx_v_c1;
                                  __pyx_t_13 = __Pyx_mod_long(__pyx_t_21, __pyx_v_width);

    +7066:                        + cloud_[(y + 2) % height, c2]) * factor

                                  __pyx_t_23 = (__pyx_v_y + 2);
                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7066, __pyx_L17_error)
                                  }
                                  __pyx_t_24 = __Pyx_mod_long(__pyx_t_23, __pyx_v_height);
                                  __pyx_t_25 = __pyx_v_c2;
                                  __pyx_v_d = (((((*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_18 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_14)) ))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_19 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_20)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_22 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_13)) )))) + (*((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_24 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_25)) )))) * __pyx_v_factor);

     7067:

    +7068:                     d = d - <float>(rand() * 0.0001)

                                  __pyx_v_d = (__pyx_v_d - ((float)(rand() * 0.0001)));

     7069:

     7070:                     # Cap the values

    +7071:                     if d <0:

                                  __pyx_t_7 = ((__pyx_v_d < 0.0) != 0);
                                  if (__pyx_t_7) {
    /* … */
                                  }

    +7072:                         d = 0.0

                                    __pyx_v_d = 0.0;

     7073:

     7074:                     # CAP THE VALUE TO 255

    +7075:                     if d>512.0:

                                  __pyx_t_7 = ((__pyx_v_d > 512.0) != 0);
                                  if (__pyx_t_7) {
    /* … */
                                  }

    +7076:                         d = <float>512.0

                                    __pyx_v_d = ((float)512.0);

    +7077:                     cloud_[y % height, x % width] = d

                                  if (unlikely(__pyx_v_height == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7077, __pyx_L17_error)
                                  }
                                  if (unlikely(__pyx_v_width == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7077, __pyx_L17_error)
                                  }
                                  __pyx_t_24 = __Pyx_mod_int(__pyx_v_y, __pyx_v_height);
                                  __pyx_t_13 = __Pyx_mod_int(__pyx_v_x, __pyx_v_width);
                                  *((float *) ( /* dim=1 */ ((char *) (((float *) ( /* dim=0 */ (__pyx_v_cloud_.data + __pyx_t_24 * __pyx_v_cloud_.strides[0]) )) + __pyx_t_13)) )) = __pyx_v_d;

     7078:

    +7079:                     ii = palette[<unsigned int>d % p_length]

                                  if (unlikely(__pyx_v_p_length == 0)) {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                    __PYX_ERR(1, 7079, __pyx_L17_error)
                                  }
                                  __pyx_t_25 = (((unsigned int)__pyx_v_d) % __pyx_v_p_length);
                                  __pyx_v_ii = (*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_palette.data) + __pyx_t_25)) )));

     7080:

    +7081:                     out[x, y, 0] = (ii >> 16) & 255

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_14 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = ((__pyx_v_ii >> 16) & 0xFF);

    +7082:                     out[x, y, 1] = (ii >> 8) & 255

                                  __pyx_t_14 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_14 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_13)) )) = ((__pyx_v_ii >> 8) & 0xFF);

    +7083:                     out[x, y, 2] = ii & 255

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_14 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_13 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) + __pyx_t_14)) )) = (__pyx_v_ii & 0xFF);
                                }
                                goto __pyx_L24;
                                __pyx_L17_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L23;
                                __pyx_L23:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates12)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_c1;
                                    __pyx_parallel_temp1 = __pyx_v_c2;
                                    __pyx_parallel_temp2 = __pyx_v_d;
                                    __pyx_parallel_temp3 = __pyx_v_ii;
                                    __pyx_parallel_temp4 = __pyx_v_x;
                                    __pyx_parallel_temp5 = __pyx_v_y;
                                }
                                __pyx_L24:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_c1 = __pyx_parallel_temp0;
                  __pyx_v_c2 = __pyx_parallel_temp1;
                  __pyx_v_d = __pyx_parallel_temp2;
                  __pyx_v_ii = __pyx_parallel_temp3;
                  __pyx_v_x = __pyx_parallel_temp4;
                  __pyx_v_y = __pyx_parallel_temp5;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L7_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     7084:

    +7085:     return asarray(out[:, 0:height, :])

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5.data = __pyx_v_out.data;
      __pyx_t_5.memview = __pyx_v_out.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_5, 0);
      __pyx_t_5.shape[0] = __pyx_v_out.shape[0];
    __pyx_t_5.strides[0] = __pyx_v_out.strides[0];
        __pyx_t_5.suboffsets[0] = -1;

    __pyx_t_11 = -1;
      if (unlikely(__pyx_memoryview_slice_memviewslice(
        &__pyx_t_5,
        __pyx_v_out.shape[1], __pyx_v_out.strides[1], __pyx_v_out.suboffsets[1],
        1,
        1,
        &__pyx_t_11,
        0,
        __pyx_v_height,
        0,
        1,
        1,
        0,
        1) < 0))
    {
        __PYX_ERR(1, 7085, __pyx_L1_error)
    }

    __pyx_t_5.shape[2] = __pyx_v_out.shape[2];
    __pyx_t_5.strides[2] = __pyx_v_out.strides[2];
        __pyx_t_5.suboffsets[2] = -1;

    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_5, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7085, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

     7086:

     7087:

     7088: # CLOUD ARRAY PALETTE

     7089: # cloud_rescale = numpy.zeros(256 * 2 * 3, numpy.uint)

     7090: #

     7091: # arr1 = create_horizontal_gradient_1d(255, (0, 0, 0), (255, 255, 255))

     7092: # arr2 = create_horizontal_gradient_1d(255, (255, 255, 255), (0, 0, 0))

     7093: # arr3 = numpy.concatenate((arr1, arr2), axis=None)

     7094: # i = 0

     7095: # for r in range(0, 1530, 3):

     7096: #     cloud_rescale[i] = rgb_to_int(arr3[r], arr3[r+1], arr3[r+2])

     7097: #     i += 1

     7098: # -------- main loop ----------

     7099: # surface_ = cloud_effect(

     7100: #             width, height, 3.956 + random.uniform(0.002, 0.008),

     7101: #             heatmap_rescale,

     7102: #             CLOUD_ARRAY,

     7103: #             reduce_factor_=2,  cloud_intensity_=75,

     7104: #             smooth_=True, bloom_=False, fast_bloom_=True,

     7105: #             bpf_threshold_=80, low_=0, high_=800, brightness_=False, brightness_intensity_=0.1,

     7106: #             transpose_=False, surface_=None, blur_=False)

     7107:

     7108: # TODO MASK ? TO MOVE CLOUD ?

     7109:

     7110: @cython.boundscheck(False)

     7111: @cython.wraparound(False)

     7112: @cython.nonecheck(False)

     7113: @cython.cdivision(False)

    +7114: cdef inline shader_cloud_effect_c(

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_shader_cloud_effect_c(int __pyx_v_width_, int __pyx_v_height_, float __pyx_v_factor_, __Pyx_memviewslice __pyx_v_palette_, __Pyx_memviewslice __pyx_v_cloud_, struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c *__pyx_optional_args) {
      unsigned short __pyx_v_reduce_factor_ = ((unsigned short)2);
      unsigned short __pyx_v_cloud_intensity_ = ((unsigned short)16);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_12);
      __Pyx_XDECREF(__pyx_t_13);
      __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
      __Pyx_AddTraceback("PygameShader.shader.shader_cloud_effect_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_cloud_surface_smallest);
      __Pyx_XDECREF(__pyx_v_rgb_array_);
      __Pyx_XDECREF(__pyx_v_cloud_effect);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    +7115:         int width_,

    struct __pyx_opt_args_12PygameShader_6shader_shader_cloud_effect_c {
      int __pyx_n;
      unsigned short reduce_factor_;
      unsigned short cloud_intensity_;
      int smooth_;
      int bloom_;
      int fast_bloom_;
      unsigned short bpf_threshold_;
      unsigned int low_;
      unsigned int high_;
      int brightness_;
      float brightness_intensity_;
      PyObject *surface_;
      int transpose_;
      int blur_;
    };

     7116:         int height_,

     7117:         float factor_,

     7118:         unsigned int [::1] palette_,

     7119:         float [:, ::1] cloud_,

     7120:

     7121:         # OPTIONAL

     7122:         unsigned short int reduce_factor_   = 2,

     7123:         unsigned short int cloud_intensity_ = 16,

    +7124:         bint smooth_                        = True,

      int __pyx_v_smooth_ = ((int)1);

    +7125:         bint bloom_                         = False,

      int __pyx_v_bloom_ = ((int)0);

    +7126:         bint fast_bloom_                    = True,

      int __pyx_v_fast_bloom_ = ((int)1);
      unsigned short __pyx_v_bpf_threshold_ = ((unsigned short)0x80);
      unsigned int __pyx_v_low_ = ((unsigned int)0);
      unsigned int __pyx_v_high_ = ((unsigned int)0);

     7127:         unsigned short int bpf_threshold_   = 128,

     7128:         unsigned int low_                   = 0,

     7129:         unsigned int high_                  = 0,

    +7130:         bint brightness_                    = False,

      int __pyx_v_brightness_ = ((int)0);
      float __pyx_v_brightness_intensity_ = ((float)0.0);

     7131:         float brightness_intensity_         = 0.0,

    +7132:         object surface_                     = None,

      PyObject *__pyx_v_surface_ = ((PyObject *)Py_None);

    +7133:         bint transpose_                     = False,

      int __pyx_v_transpose_ = ((int)0);

    +7134:         bint blur_                          = True

      int __pyx_v_blur_ = ((int)1);
      int __pyx_v_w4;
      int __pyx_v_h4;
      int __pyx_v_f_height;
      int __pyx_v_f_width;
      PyObject *__pyx_v_cloud_surface_smallest = NULL;
      PyObject *__pyx_v_rgb_array_ = NULL;
      PyObject *__pyx_v_cloud_effect = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_cloud_effect_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_reduce_factor_ = __pyx_optional_args->reduce_factor_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_cloud_intensity_ = __pyx_optional_args->cloud_intensity_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_smooth_ = __pyx_optional_args->smooth_;
              if (__pyx_optional_args->__pyx_n > 3) {
                __pyx_v_bloom_ = __pyx_optional_args->bloom_;
                if (__pyx_optional_args->__pyx_n > 4) {
                  __pyx_v_fast_bloom_ = __pyx_optional_args->fast_bloom_;
                  if (__pyx_optional_args->__pyx_n > 5) {
                    __pyx_v_bpf_threshold_ = __pyx_optional_args->bpf_threshold_;
                    if (__pyx_optional_args->__pyx_n > 6) {
                      __pyx_v_low_ = __pyx_optional_args->low_;
                      if (__pyx_optional_args->__pyx_n > 7) {
                        __pyx_v_high_ = __pyx_optional_args->high_;
                        if (__pyx_optional_args->__pyx_n > 8) {
                          __pyx_v_brightness_ = __pyx_optional_args->brightness_;
                          if (__pyx_optional_args->__pyx_n > 9) {
                            __pyx_v_brightness_intensity_ = __pyx_optional_args->brightness_intensity_;
                            if (__pyx_optional_args->__pyx_n > 10) {
                              __pyx_v_surface_ = __pyx_optional_args->surface_;
                              if (__pyx_optional_args->__pyx_n > 11) {
                                __pyx_v_transpose_ = __pyx_optional_args->transpose_;
                                if (__pyx_optional_args->__pyx_n > 12) {
                                  __pyx_v_blur_ = __pyx_optional_args->blur_;
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

     7135:         ):

     7136:     """

     7137:     GENERATE CLOUD /SMOKE ON THE GAME DISPLAY

     7138:

     7139:     * CLOUD TEXTURE SIZES

     7140:

     7141:     input width_  : integer,

     7142:     input height_ : integer

     7143:

     7144:     width_ and height_ values define the size of the texture e.g Surface(width x height)

     7145:

     7146:     * CLOUD ASPECT (CONTROL OVER THE WIDTH):

     7147:

     7148:     inputs low_ : integer

     7149:     input high_ : integer

     7150:

     7151:     Optional arguments low_ & high_ (integer values) define the width 's limits of the cloud

     7152:     effect. low_ for the starting point and high_ for the ending of the effect.

     7153:     e.g low_ = 10 and high_ = 200. The cloud effect will be contain within width = 10 and 200

     7154:     low_ & high_ values must be in range [0 ... width_]

     7155:

     7156:     * CLOUD HEIGHT:

     7157:

     7158:     input factor_ : float

     7159:

     7160:     The cloud maximum height can be adjust with the variable factor_ (float value)

     7161:     value > 3.95 will contain the effect within the display

     7162:     value < 3.95 will enlarge the effect over the display height

     7163:     Recommended value is 3.95 with reduce_factor_ = 3 otherwise adjust the value manually

     7164:     to contain the cloud effect within the display

     7165:

     7166:     * SPEED CONSIDERATION

     7167:

     7168:     input reduce_factor_ : integer

     7169:

     7170:     The argument reduce_factor_ control the size of the texture to be processed

     7171:     e.g : a value of 2, divide by 4 the pygame surface define by the values (width_ & height_)

     7172:     Smaller texture improve the overall performances but will slightly degrade the cloud aspect,

     7173:     especially if the blur and smooth option are not enabled.

     7174:     Recommended value for reduce_factor_ is 3 (fast process)

     7175:     reduce_factor_ values must be an integer in range [ 0 ... 4]

     7176:     The reduce_factor_ value will have a significant impact on the cloud effect maximum height,

     7177:     adjust the argument factor_ accordingly

     7178:

     7179:     * CLOUD INTENSITY AT THE SOURCE

     7180:

     7181:     input cloud_intensity_: integer

     7182:

     7183:     Set the cloud intensity with the variable cloud_intensity_, 0 low flame,

     7184:     32 maximum flame effect

     7185:     Values must be an int in range [0 ... 32]

     7186:

     7187:     * SMOOTHING THE EFFECT

     7188:

     7189:     input smooth_: True | False

     7190:

     7191:     When smooth_ is True the algorithm will use the pygame function smoothscale (bi-linear

     7192:     filtering) or False the final texture will be adjust with the scale function.

     7193:     Set this variable to False if you need the best performance for the effect or if you require

     7194:     a pixelated cloud effect. Otherwise set the variable to True for a more realistic effect.

     7195:

     7196:     * BLOOM EFFECT

     7197:

     7198:     input bloom_         : True | False

     7199:     input fast_bloom_    : True | False

     7200:     input bpf_threshold_ : integer

     7201:

     7202:     Bloom effect produce a bright and smooth light effect to the background texture where the cloud

     7203:     intensity is at its maximum.

     7204:     Use the flag fast_bloom_ for a compromise between a realistic effect and the best performances

     7205:     The flag fast_bloom_ define a very fast bloom algo using only the smallest texture

     7206:     to create a bloom effect (all the intermediate textures will be bypassed). See the bloom effect

     7207:     project for more details.

     7208:     When fast_bloom is False, all the sub-surfaces will be blit to the final effect and will

     7209:     produce a more realistic cloud effect (this will slightly degrade the overall performances).

     7210:     If the cloud effect is too bright, you can always adjust the bright pass filter value

     7211:     bpf_threshold_(this will adjust the bloom intensity)

     7212:     bpf_threshold_ value must be in range [ 0 ... 255]

     7213:     Below 128 the bloom effect will be more noticeable and above 128 only the brightest

     7214:     area will be enhanced.

     7215:

     7216:     * LIGHT EFFECT INTENSITY

     7217:

     7218:     input brightness_            : True | False

     7219:     input brightness_intensity_  : float

     7220:

     7221:     When the flag is set to True, the algorithm will use an external function,

     7222:     <shader_brightness24_exclude_inplace_c> to increase the brightness of the effect / texture

     7223:     A custom color can be passed to the function defining the pixels to be ignored during the

     7224:     process (default is black color).

     7225:     the value must be in range [-1.0 ... 1.0]. Values below zero will decrease the brightness

     7226:     of the cloud effect and positive values will increase the brightness of the effect (causing

     7227:     bright white patches on the cloud texture).

     7228:     Values below -0.4 will cause the cloud effect to be translucent

     7229:

     7230:

     7231:     * OPTIONAL SURFACE

     7232:

     7233:     input surface_ : pygame.Surface

     7234:

     7235:     This is an optional surface that can be passed to the shader to improve the performances

     7236:     and to avoid a new surface to be generated every iterations. The surface size must match

     7237:     exactly the reduce texture dimensions otherwise an exception will be raise.

     7238:     see reduce_factor_ option to determine the cloud texture size that will be processed.

     7239:

     7240:

     7241:     * CLOUD ORIENTATION / DIRECTION

     7242:

     7243:     input transpose_ = True | False,

     7244:

     7245:     transpose_ = True, this will transpose the final array

     7246:     for e.g :

     7247:     If the final cloud texture is (w, h) after setting the transpose flag, the final

     7248:     cloud texture will become (h, w). As a result the cloud effect will be transversal (starting

     7249:     from the right of the display to the left side).

     7250:     You can always transpose / flip the texture to get the right cloud orientation

     7251:

     7252:     * FINAL TOUCH

     7253:

     7254:     input blur_ : True | False

     7255:

     7256:     This will will blur the cloud effect for a more realistic appearance, remove all the jagged

     7257:     edge when and pixelated effect

     7258:

     7259:     :param width_               : integer; Texture size (width)

     7260:     :param height_              : integer; Texture size (height)

     7261:     :param factor_              : float; Floating value used to control the size of the cloud

     7262:                                   effect. Value must be in range [3.95 ... 4.2]. Value > 3.95

     7263:                                   will contain the smoke/ cloud effect within the display.

     7264:                                   Values < 3.95 will enlarge the smoke effect.

     7265:     :param palette_             : numpy.ndarray or cython memoryview containing the color for the

     7266:                                   cloud effect (buffer containing mapped RGB colors (uint values))

     7267:     :param cloud_               : numpy.ndarray shape (w, h) containing float values

     7268:                                   (cloud intensity). For better performance it is advised to set the

     7269:                                   array to the size of the texture after applying the

     7270:                                   reduction_factor_. For example if the reduction_factor_ is 2,

     7271:                                   the texture would have to be width >> 1 and height >> 1 and the

     7272:                                   cloud_ array should be equivalent to numpy.empty((height >> 1,

     7273:                                   width >> 1), float32)

     7274:     :param reduce_factor_       : integer; unsigned short int ; Can be either 0, 1, 2, 3, 4.

     7275:                                   2 and 3 provide the best performance and the best looking effect.

     7276:     :param cloud_intensity_     : integer; Determine the amount of smoke the cloud

     7277:                                   effect will generate at the base of the effect (value must be in

     7278:                                   range [0 .. 260]). If you provide zero a random value between

     7279:                                   0 ... 260 will be assigned. If you provide 250, a random value

     7280:                                   between 250 and 260 will be set for the amount of smoke.

     7281:                                   The highest the value, the more dense the cloud effect will be

     7282:     :param smooth_              : boolean; True use a smoothscale (bi-linear filtering) or

     7283:                                   False -> scale algorithm jagged edges (mush faster)

     7284:     :param bloom_               : True | False, Add a bloom effect when the flag is set to True

     7285:                                   The bloom effect will smooth the cloud and create a dense smoke

     7286:                                   areas where the cloud is the brightest.

     7287:     :param fast_bloom_          : True | False; This set a fast algorithm for the bloom effect (the

     7288:                                   bloom effect will use the smallest texture)

     7289:     :param bpf_threshold_       : integer; Bright pass filter value must be in range [ 0 ... 255]

     7290:                                   0 produce the maximum bloom effect

     7291:     :param low_                 : integer; must be in range [ 0 ... width_], left position of the

     7292:                                   cloud effect

     7293:     :param high_                : integer; must be in range [ 0 ... height_], right position of the

     7294:                                   cloud effect

     7295:     :param brightness_          : True | False; Increase the brightness of the cloud effect when

     7296:                                   True

     7297:     :param brightness_intensity_: float; Set the brightness intensity of the cloud. The value must

     7298:                                   be in range [-1.0 ... +1.0]. Changing the value overtime will

     7299:                                   generate a realistic cloud effect. Negative value will generate

     7300:                                   translucent patch of smoke on the background image

     7301:     :param surface_             : Pygame.Surface; Pass a surface to the shader for

     7302:                                   better performance, otherwise a new surface will be created each

     7303:                                   calls.

     7304:     :param transpose_           : boolean; Transpose the array (w, h) become (h, w).

     7305:                                   The cloud effect will start from the left and move to the right

     7306:     :param blur_                : boolean; Blur the cloud effect

     7307:     :return                     : Return a pygame surface that can be blit directly to the game

     7308:                                   display

     7309:     """

     7310:

     7311:

     7312:     cdef int w4, h4

     7313:

     7314:     # TEXTURE DIVIDE BY POWER OF 2

    +7315:     if reduce_factor_ in (0, 1, 2):

      switch (__pyx_v_reduce_factor_) {
        case 0:
        case 1:
        case 2:
    /* … */
        break;
        case 3:

    +7316:         w4, h4 = width_ >> reduce_factor_, height_ >> reduce_factor_

        __pyx_t_1 = (__pyx_v_width_ >> __pyx_v_reduce_factor_);
        __pyx_t_2 = (__pyx_v_height_ >> __pyx_v_reduce_factor_);
        __pyx_v_w4 = __pyx_t_1;
        __pyx_v_h4 = __pyx_t_2;

     7317:

     7318:     # TEXTURE 150 x 150 * ratio

    +7319:     elif reduce_factor_ == 3:

        break;
        case 4:

     7320:         # CUSTOM SIZE WIDTH 150 AND RATIO * HIGH

    +7321:         w4 = 150

        __pyx_v_w4 = 0x96;

    +7322:         h4 = <int>(150 * height_/width_)

        __pyx_t_3 = (0x96 * __pyx_v_height_);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7322, __pyx_L1_error)
        }
        else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
          PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
          __PYX_ERR(1, 7322, __pyx_L1_error)
        }
        __pyx_v_h4 = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    +7323:         low_ = <int>(low_ * low_/width_)

        __pyx_t_4 = (__pyx_v_low_ * __pyx_v_low_);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7323, __pyx_L1_error)
        }
        __pyx_v_low_ = ((int)(__pyx_t_4 / __pyx_v_width_));

    +7324:         high_ = <int>(high_ * 150/width_)

        __pyx_t_3 = (__pyx_v_high_ * 0x96);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7324, __pyx_L1_error)
        }
        else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
          PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
          __PYX_ERR(1, 7324, __pyx_L1_error)
        }
        __pyx_v_high_ = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    +7325:         reduce_factor_ = 0

        __pyx_v_reduce_factor_ = 0;

     7326:

     7327:     # TEXTURE 100 x 100 * ratio

    +7328:     elif reduce_factor_ == 4:

        break;
        default: break;
      }

    +7329:         w4 = 100

        __pyx_v_w4 = 0x64;

    +7330:         h4 = <int> (100 * height_ / width_)

        __pyx_t_3 = (0x64 * __pyx_v_height_);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7330, __pyx_L1_error)
        }
        else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
          PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
          __PYX_ERR(1, 7330, __pyx_L1_error)
        }
        __pyx_v_h4 = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    +7331:         low_ = <int> (low_ * low_ / width_)

        __pyx_t_4 = (__pyx_v_low_ * __pyx_v_low_);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7331, __pyx_L1_error)
        }
        __pyx_v_low_ = ((int)(__pyx_t_4 / __pyx_v_width_));

    +7332:         high_ = <int> (high_ * 100 / width_)

        __pyx_t_3 = (__pyx_v_high_ * 0x64);
        if (unlikely(__pyx_v_width_ == 0)) {
          PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
          __PYX_ERR(1, 7332, __pyx_L1_error)
        }
        else if (sizeof(long) == sizeof(long) && (!(((int)-1) > 0)) && unlikely(__pyx_v_width_ == (int)-1)  && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_3))) {
          PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
          __PYX_ERR(1, 7332, __pyx_L1_error)
        }
        __pyx_v_high_ = ((int)__Pyx_div_long(__pyx_t_3, __pyx_v_width_));

    +7333:         reduce_factor_ = 0

        __pyx_v_reduce_factor_ = 0;

     7334:

     7335:     cdef int f_height, f_width

    +7336:     f_height, f_width = (<object> cloud_).shape[:2]

      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_cloud_, 2, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetSlice(__pyx_t_6, 0, 2, NULL, NULL, &__pyx_slice__24, 0, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7336, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 7336, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7336, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) __PYX_ERR(1, 7336, __pyx_L1_error)
        __pyx_t_9 = NULL;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_9 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 7336, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7336, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_f_height = __pyx_t_2;
      __pyx_v_f_width = __pyx_t_1;

     7337:

    +7338:     assert f_width >= w4 or f_height >= h4, \

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        __pyx_t_11 = ((__pyx_v_f_width >= __pyx_v_w4) != 0);
        if (!__pyx_t_11) {
        } else {
          __pyx_t_10 = __pyx_t_11;
          goto __pyx_L5_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_f_height >= __pyx_v_h4) != 0);
        __pyx_t_10 = __pyx_t_11;
        __pyx_L5_bool_binop_done:;
        if (unlikely(!__pyx_t_10)) {

     7339:         "Cloud array size mismatch the texture size.\n" \

    +7340:         "Set cloud array to numpy.empty((%s, %s), dtype=numpy.float32)" % (h4, w4)

          __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7);
          __pyx_t_5 = 0;
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cloud_array_size_mismatch_the_te, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7340, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_7);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __PYX_ERR(1, 7338, __pyx_L1_error)
        }
      }
      #endif

     7341:

    +7342:     if surface_ is None:

      __pyx_t_10 = (__pyx_v_surface_ == Py_None);
      __pyx_t_11 = (__pyx_t_10 != 0);
      if (__pyx_t_11) {
    /* … */
        goto __pyx_L7;
      }

    +7343:         cloud_surface_smallest = pygame.Surface((w4, h4)).convert()

        __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pygame); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Surface); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_12);
        __pyx_t_5 = 0;
        __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_12, __pyx_t_13) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_13);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_convert); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        __pyx_t_7 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7343, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_v_cloud_surface_smallest = __pyx_t_7;
        __pyx_t_7 = 0;

     7344:

     7345:     else:

    +7346:         if PyObject_IsInstance(surface_, pygame.Surface):

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_pygame); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7346, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Surface); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7346, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = PyObject_IsInstance(__pyx_v_surface_, __pyx_t_8); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 7346, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_10 = (__pyx_t_11 != 0);
        if (likely(__pyx_t_10)) {
    /* … */
          goto __pyx_L8;
        }

    +7347:             assert surface_.get_width() == w4 and surface_.get_height() == h4, \

          #ifndef CYTHON_WITHOUT_ASSERTIONS
          if (unlikely(!Py_OptimizeFlag)) {
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_6 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_6)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_6);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            __pyx_t_8 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_6 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            if (__pyx_t_11) {
            } else {
              __pyx_t_10 = __pyx_t_11;
              goto __pyx_L9_bool_binop_done;
            }
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_8 = NULL;
            if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_8)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_8);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
            __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_8 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(1, 7347, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_10 = __pyx_t_11;
            __pyx_L9_bool_binop_done:;
            if (unlikely(!__pyx_t_10)) {

     7348:             "Surface argument has incorrect dimension surface must be (w:%s, h:%s) got (%s, %s)\n" \

     7349:             "Set argument surface_ to None to avoid this error message"\

    +7350:             % (w4, h4, surface_.get_width(), surface_.get_height())

              __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_w4); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_h4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_7);
              __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_width); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __pyx_t_12 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
                __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
                if (likely(__pyx_t_12)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
                  __Pyx_INCREF(__pyx_t_12);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_13, function);
                }
              }
              __pyx_t_6 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_13);
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_height); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __pyx_t_5 = NULL;
              if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
                __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_12);
                if (likely(__pyx_t_5)) {
                  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
                  __Pyx_INCREF(__pyx_t_5);
                  __Pyx_INCREF(function);
                  __Pyx_DECREF_SET(__pyx_t_12, function);
                }
              }
              __pyx_t_13 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_12);
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GIVEREF(__pyx_t_8);
              PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_7);
              PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_7);
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_6);
              __Pyx_GIVEREF(__pyx_t_13);
              PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_13);
              __pyx_t_8 = 0;
              __pyx_t_7 = 0;
              __pyx_t_6 = 0;
              __pyx_t_13 = 0;
              __pyx_t_13 = __Pyx_PyString_Format(__pyx_kp_s_Surface_argument_has_incorrect_d, __pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7350, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_13);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
              PyErr_SetObject(PyExc_AssertionError, __pyx_t_13);
              __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
              __PYX_ERR(1, 7347, __pyx_L1_error)
            }
          }
          #endif

    +7351:             cloud_surface_smallest = surface_

          __Pyx_INCREF(__pyx_v_surface_);
          __pyx_v_cloud_surface_smallest = __pyx_v_surface_;

     7352:         else:

    +7353:             raise ValueError("Argument surface_ must be a Surface type got %s " % type(surface_))

        /*else*/ {
          __pyx_t_13 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Argument_surface__must_be_a_Surf, ((PyObject *)Py_TYPE(__pyx_v_surface_))); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7353, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7353, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_Raise(__pyx_t_12, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __PYX_ERR(1, 7353, __pyx_L1_error)
        }
        __pyx_L8:;
      }
      __pyx_L7:;

     7354:

    +7355:     rgb_array_ = cloud_surface24_c(

      __pyx_t_14.__pyx_n = 3;
      __pyx_t_14.intensity = __pyx_v_cloud_intensity_;
      __pyx_t_14.low = (__pyx_v_low_ >> __pyx_v_reduce_factor_);
      __pyx_t_14.high = (__pyx_v_high_ >> __pyx_v_reduce_factor_);
      __pyx_t_12 = __pyx_f_12PygameShader_6shader_cloud_surface24_c(__pyx_v_w4, __pyx_v_h4, (((float)1.0) / __pyx_v_factor_), __pyx_v_palette_, __pyx_v_cloud_, &__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_v_rgb_array_ = __pyx_t_12;
      __pyx_t_12 = 0;

    +7356:         w4, h4, <float>1.0 / factor_, palette_, cloud_, cloud_intensity_,

      if (unlikely(__pyx_v_factor_ == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 7356, __pyx_L1_error)
      }

     7357:                 low_ >> reduce_factor_, high_ >> reduce_factor_)

     7358:

     7359:     # BRIGHTNESS SHADER

    +7360:     if brightness_:

      __pyx_t_10 = (__pyx_v_brightness_ != 0);
      if (__pyx_t_10) {
    /* … */
      }

     7361:         # EXCLUDE BLACK COLORS (DEFAULT)

    +7362:         assert -1.0 <= brightness_intensity_ <= 1.0, \

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_10 = (-1.0 <= __pyx_v_brightness_intensity_);
          if (__pyx_t_10) {
            __pyx_t_10 = (__pyx_v_brightness_intensity_ <= 1.0);
          }
          if (unlikely(!(__pyx_t_10 != 0))) {
            PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_brightness_intensity_mu);
            __PYX_ERR(1, 7362, __pyx_L1_error)
          }
        }
        #endif

     7363:             "Argument brightness intensity must be in range [-1.0 ... 1.0]"

    +7364:         shader_brightness24_exclude_inplace_c(rgb_array_=rgb_array_,

        __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 7364, __pyx_L1_error)
    /* … */
        __pyx_t_16.__pyx_n = 2;
        __pyx_t_16.shift_ = __pyx_v_brightness_intensity_;
        __pyx_t_16.color_ = __pyx_tuple__9;
        __pyx_f_12PygameShader_6shader_shader_brightness24_exclude_inplace_c(__pyx_t_15, &__pyx_t_16);
        __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
        __pyx_t_15.memview = NULL;
        __pyx_t_15.data = NULL;

     7365:                                               shift_=brightness_intensity_, color_=(0, 0, 0))

     7366:

    +7367:     if blur_:

      __pyx_t_10 = (__pyx_v_blur_ != 0);
      if (__pyx_t_10) {
    /* … */
      }

    +7368:         shader_blur5x5_array24_inplace_c(rgb_array_)

        __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_rgb_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(1, 7368, __pyx_L1_error)
        __pyx_f_12PygameShader_6shader_shader_blur5x5_array24_inplace_c(__pyx_t_15, NULL);
        __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
        __pyx_t_15.memview = NULL;
        __pyx_t_15.data = NULL;

     7369:

    +7370:     if transpose_:

      __pyx_t_10 = (__pyx_v_transpose_ != 0);
      if (__pyx_t_10) {
    /* … */
        goto __pyx_L13;
      }

    +7371:         rgb_array_ = rgb_array_.transpose(1, 0, 2)

        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_rgb_array_, __pyx_n_s_transpose_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7371, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7371, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF_SET(__pyx_v_rgb_array_, __pyx_t_13);
        __pyx_t_13 = 0;

    +7372:         cloud_surface_smallest = make_surface(rgb_array_)

        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7372, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        __pyx_t_13 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_6, __pyx_v_rgb_array_) : __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_rgb_array_);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7372, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF_SET(__pyx_v_cloud_surface_smallest, __pyx_t_13);
        __pyx_t_13 = 0;

     7373:     else:

     7374:         # CONVERT THE ARRAY INTO A PYGAME SURFACE

    +7375:         array_to_surface(cloud_surface_smallest, rgb_array_)

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_array_to_surface); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7375, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_6 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_12)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_v_rgb_array_};
          __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_13);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_v_rgb_array_};
          __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_13);
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7375, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
          __Pyx_INCREF(__pyx_v_rgb_array_);
          __Pyx_GIVEREF(__pyx_v_rgb_array_);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_v_rgb_array_);
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_7, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7375, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __pyx_L13:;

     7376:

     7377:

     7378:     # BLOOM SHADER EFFECT

    +7379:     if bloom_:

      __pyx_t_10 = (__pyx_v_bloom_ != 0);
      if (__pyx_t_10) {
    /* … */
      }

    +7380:         assert 0 <= bpf_threshold_ < 256, \

        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_10 = (0 <= __pyx_v_bpf_threshold_);
          if (__pyx_t_10) {
            __pyx_t_10 = (__pyx_v_bpf_threshold_ < 0x100);
          }
          if (unlikely(!(__pyx_t_10 != 0))) {

    +7381:             "Argument bpf_threshold_ must be in range [0 ... 256] got %s " % bpf_threshold_

            __pyx_t_13 = __Pyx_PyInt_From_unsigned_short(__pyx_v_bpf_threshold_); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7381, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __pyx_t_12 = __Pyx_PyString_Format(__pyx_kp_s_Argument_bpf_threshold__must_be, __pyx_t_13); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7381, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            PyErr_SetObject(PyExc_AssertionError, __pyx_t_12);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __PYX_ERR(1, 7380, __pyx_L1_error)
          }
        }
        #endif

    +7382:         shader_bloom_effect_array24_c(cloud_surface_smallest, bpf_threshold_, fast_=fast_bloom_)

        __pyx_t_17.__pyx_n = 1;
        __pyx_t_17.fast_ = __pyx_v_fast_bloom_;
        __pyx_f_12PygameShader_6shader_shader_bloom_effect_array24_c(__pyx_v_cloud_surface_smallest, __pyx_v_bpf_threshold_, &__pyx_t_17);

     7383:

     7384:     # RESCALE THE SURFACE TO THE FULL SIZE

    +7385:     if smooth_:

      __pyx_t_10 = (__pyx_v_smooth_ != 0);
      if (__pyx_t_10) {
    /* … */
        goto __pyx_L15;
      }

    +7386:         cloud_effect = smoothscale(cloud_surface_smallest, (width_, height_))

        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __pyx_t_7 = 0;
        __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_t_8};
          __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_cloud_surface_smallest, __pyx_t_8};
          __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7386, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7386, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_v_cloud_effect = __pyx_t_12;
        __pyx_t_12 = 0;

     7387:     else:

    +7388:         cloud_effect = scale(cloud_surface_smallest, (width_, height_))

      /*else*/ {
        __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_scale); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 7388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_width_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_height_); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_8);
        __pyx_t_7 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = NULL;
        __pyx_t_1 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_8)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
            __pyx_t_1 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_cloud_surface_smallest, __pyx_t_6};
          __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_v_cloud_surface_smallest, __pyx_t_6};
          __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_1, 2+__pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(2+__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7388, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (__pyx_t_8) {
            __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __pyx_t_8 = NULL;
          }
          __Pyx_INCREF(__pyx_v_cloud_surface_smallest);
          __Pyx_GIVEREF(__pyx_v_cloud_surface_smallest);
          PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_1, __pyx_v_cloud_surface_smallest);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_7, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 7388, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_v_cloud_effect = __pyx_t_12;
        __pyx_t_12 = 0;
      }
      __pyx_L15:;

     7389:

    +7390:     return cloud_effect

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_cloud_effect);
      __pyx_r = __pyx_v_cloud_effect;
      goto __pyx_L0;

     7391:

     7392:

     7393:

     7394: @cython.boundscheck(False)

     7395: @cython.wraparound(False)

     7396: @cython.nonecheck(False)

     7397: @cython.cdivision(True)

    +7398: cdef inline mirroring_c(unsigned char[:, :, :] rgb_array_):

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_x2;
      int __pyx_v_x3;
      int __pyx_v_x;
      int __pyx_v_y;
      __Pyx_memviewslice __pyx_v_new_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_10);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_AddTraceback("PygameShader.shader.mirroring_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_new_array, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7399:

     7400:     """

     7401:     SHADER MIRRORING

     7402:

     7403:     This method create a mirror image placed to the right side of the

     7404:      original image referenced by rgb_array_

     7405:

     7406:     The Array (rgb_array) must be a numpy array shape (w, h, 3)

     7407:     containing RGB pixels, please refer to pygame

     7408:     function pixels3d or array3d to convert an image into a 3d

     7409:     array (library surfarray)

     7410:

     7411:     :param rgb_array_: numpy ndarray shape (w, h, 3) containing RGB pixels

     7412:     :return          : returns a numpy ndarray shape (w, h, 3) with transformation

     7413:     """

     7414:

     7415:     cdef:

     7416:         Py_ssize_t w, h

     7417:         int x2, x3

    +7418:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     7419:

     7420:

     7421:     cdef:

     7422:         int x, y

    +7423:         unsigned char [:, :, :] new_array = empty((w, h, 3), uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_3);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_uint8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
        __pyx_t_8 = 0;
        __pyx_t_7 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7423, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_new_array = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     7424:         unsigned char *r

     7425:         unsigned char *g

     7426:         unsigned char *b

     7427:

    +7428:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +7429:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_x2 = ((int)0xbad0bad0);
                                __pyx_v_x3 = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);

    +7430:             for y in range(h):

                                __pyx_t_13 = __pyx_v_h;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                                  __pyx_v_y = __pyx_t_9;

     7431:

    +7432:                 r = &rgb_array_[x, y, 0]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) ))));

    +7433:                 g = &rgb_array_[x, y, 1]

                                  __pyx_t_17 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_17 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))));

    +7434:                 b = &rgb_array_[x, y, 2]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[2]) ))));

     7435:

    +7436:                 x2 = x >> 1

                                  __pyx_v_x2 = (__pyx_v_x >> 1);

    +7437:                 new_array[x2, y, 0] = r[0]

                                  __pyx_t_17 = __pyx_v_x2;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_r[0]);

    +7438:                 new_array[x2, y, 1] = g[0]

                                  __pyx_t_15 = __pyx_v_x2;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_g[0]);

    +7439:                 new_array[x2, y, 2] = b[0]

                                  __pyx_t_17 = __pyx_v_x2;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_b[0]);

    +7440:                 x3 = <int>w - x2 -1

                                  __pyx_v_x3 = ((((int)__pyx_v_w) - __pyx_v_x2) - 1);

    +7441:                 new_array[x3, y, 0] = r[0]

                                  __pyx_t_15 = __pyx_v_x3;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_r[0]);

    +7442:                 new_array[x3, y, 1] = g[0]

                                  __pyx_t_17 = __pyx_v_x3;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_17 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_15 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_g[0]);

    +7443:                 new_array[x3, y, 2] = b[0]

                                  __pyx_t_15 = __pyx_v_x3;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_new_array.data + __pyx_t_15 * __pyx_v_new_array.strides[0]) ) + __pyx_t_16 * __pyx_v_new_array.strides[1]) ) + __pyx_t_17 * __pyx_v_new_array.strides[2]) )) = (__pyx_v_b[0]);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     7444:

    +7445:     return asarray(new_array)

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_new_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_7, __pyx_t_10) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L0;

     7446:

     7447:

     7448:

     7449: @cython.boundscheck(False)

     7450: @cython.wraparound(False)

     7451: @cython.nonecheck(False)

     7452: @cython.cdivision(True)

    +7453: cdef inline mirroring_inplace_c(unsigned char[:, :, :] rgb_array_):

    static CYTHON_INLINE PyObject *__pyx_f_12PygameShader_6shader_mirroring_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      int __pyx_v_x2;
      int __pyx_v_x3;
      int __pyx_v_x;
      int __pyx_v_y;
      __Pyx_memviewslice __pyx_v_rgb_array_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("mirroring_inplace_c", 0);
    /* … */
      /* function exit code */
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_AddTraceback("PygameShader.shader.mirroring_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_copy, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7454:

     7455:     """

     7456:     SHADER MIRRORING (INPLACE)

     7457:

     7458:     This method create a mirror image placed to the right side of

     7459:      the original image referenced by rgb_array_

     7460:

     7461:     The Array (rgb_array) must be a numpy array shape (w, h, 3)

     7462:     containing RGB pixels, please refer to pygame

     7463:     function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     7464:

     7465:     :param rgb_array_: numpy ndarray shape (w, h, 3) containing RGB pixels

     7466:     :return          : void

     7467:     """

     7468:

     7469:     cdef:

     7470:         Py_ssize_t w, h

     7471:         int x2, x3

    +7472:     w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     7473:

     7474:     cdef:

     7475:         int x, y

    +7476:         unsigned char [:, :, :] rgb_array_copy = numpy.array(rgb_array_, copy=True)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_copy, Py_True) < 0) __PYX_ERR(1, 7476, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 7476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_v_rgb_array_copy = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

     7477:         unsigned char *r

     7478:         unsigned char *g

     7479:         unsigned char *b

     7480:

    +7481:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +7482:         for x in prange(w, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_r) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_x2) lastprivate(__pyx_v_x3) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_9; __pyx_t_2++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_x2 = ((int)0xbad0bad0);
                                __pyx_v_x3 = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);

    +7483:             for y in range(h):

                                __pyx_t_10 = __pyx_v_h;
                                __pyx_t_11 = __pyx_t_10;
                                for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
                                  __pyx_v_y = __pyx_t_12;

     7484:

    +7485:                 r = &rgb_array_copy[x, y, 0]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[2]) ))));

    +7486:                 g = &rgb_array_copy[x, y, 1]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[2]) ))));

    +7487:                 b = &rgb_array_copy[x, y, 2]

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_copy.data + __pyx_t_13 * __pyx_v_rgb_array_copy.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_copy.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_copy.strides[2]) ))));

     7488:

    +7489:                 x2 = x >> 1

                                  __pyx_v_x2 = (__pyx_v_x >> 1);

    +7490:                 rgb_array_[x2, y, 0] = r[0]

                                  __pyx_t_15 = __pyx_v_x2;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_r[0]);

    +7491:                 rgb_array_[x2, y, 1] = g[0]

                                  __pyx_t_13 = __pyx_v_x2;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_g[0]);

    +7492:                 rgb_array_[x2, y, 2] = b[0]

                                  __pyx_t_15 = __pyx_v_x2;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_b[0]);

     7493:

    +7494:                 x3 = <int>w - x2 - 1

                                  __pyx_v_x3 = ((((int)__pyx_v_w) - __pyx_v_x2) - 1);

     7495:

    +7496:                 rgb_array_[x3, y, 0] = r[0]

                                  __pyx_t_13 = __pyx_v_x3;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_r[0]);

    +7497:                 rgb_array_[x3, y, 1] = g[0]

                                  __pyx_t_15 = __pyx_v_x3;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_g[0]);

    +7498:                 rgb_array_[x3, y, 2] = b[0]

                                  __pyx_t_13 = __pyx_v_x3;
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = (__pyx_v_b[0]);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     7499:

     7500:

     7501: @cython.boundscheck(False)

     7502: @cython.wraparound(False)

     7503: @cython.nonecheck(False)

     7504: @cython.cdivision(True)

    +7505: cpdef tuple dampening(

    static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyObject *__pyx_f_12PygameShader_6shader_dampening(PyObject *__pyx_v_surface_, int __pyx_v_frame_, int __pyx_v_display_width, int __pyx_v_display_height_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_dampening *__pyx_optional_args) {
      float __pyx_v_amplitude_ = ((float)50.0);
      int __pyx_v_duration_ = ((int)30);
      float __pyx_v_freq_ = ((float)20.0);
      float __pyx_v_t;
      int __pyx_v_width;
      int __pyx_v_height;
      float __pyx_v_tm;
      PyObject *__pyx_v_surf = 0;
      int __pyx_v_new_width;
      int __pyx_v_new_height;
      int __pyx_v_diff_x;
      int __pyx_v_diff_y;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dampening", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_amplitude_ = __pyx_optional_args->amplitude_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_duration_ = __pyx_optional_args->duration_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_freq_ = __pyx_optional_args->freq_;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_surf);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_160dampening[] = "\n    DAMPENING EFFECT\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    Compatible with image 24-32 bit\n    The length of the effect equal duration_ * freq_\n\n    e.g :\n    surf, xx, yy = dampening(BCK, frame, width, height,\n    amplitude_=100, duration_=40, freq_=15)\n    SCREEN.blit(surf, (xx, yy))\n\n    :param surface_       : pygame.Surface (compatible 24 - 32 bit)\n    :param frame_         : integer; Frame number (linear variable changing overtime)\n    :param display_width  : integer; Size of your game display (width)\n    :param display_height_: integer; size of your game display (height)\n    :param amplitude_     : float; Amplitude of the dampening effect  (default is 50)\n    :param duration_      : integer; Duration of the effect (default value is 30)\n    :param freq_          : float; change the speed of the effect default value is 20.0.\n    A small value will decrease\n    the overall timing of the effect while a larger value will increase the duration of the effect.\n    :return               : Tuple values containing the Surface and the position (x, y)\n    with x & y are the top\n     left corner of the\n    image\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_161dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_surface_ = 0;
      int __pyx_v_frame_;
      int __pyx_v_display_width;
      int __pyx_v_display_height_;
      float __pyx_v_amplitude_;
      int __pyx_v_duration_;
      float __pyx_v_freq_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dampening (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_surface,&__pyx_n_s_frame_2,&__pyx_n_s_display_width,&__pyx_n_s_display_height,&__pyx_n_s_amplitude,&__pyx_n_s_duration,&__pyx_n_s_freq,0};
        PyObject* values[7] = {0,0,0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surface)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame_2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 1); __PYX_ERR(1, 7505, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_display_width)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 2); __PYX_ERR(1, 7505, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_display_height)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, 3); __PYX_ERR(1, 7505, __pyx_L3_error)
            }
            CYTHON_FALLTHROUGH;
            case  4:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude);
              if (value) { values[4] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  5:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_duration);
              if (value) { values[5] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  6:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
              if (value) { values[6] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dampening") < 0)) __PYX_ERR(1, 7505, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
            CYTHON_FALLTHROUGH;
            case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
            CYTHON_FALLTHROUGH;
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            CYTHON_FALLTHROUGH;
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_surface_ = values[0];
        __pyx_v_frame_ = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_frame_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7507, __pyx_L3_error)
        __pyx_v_display_width = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_display_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7508, __pyx_L3_error)
        __pyx_v_display_height_ = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_display_height_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7509, __pyx_L3_error)
        if (values[4]) {
          __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7510, __pyx_L3_error)
        } else {
          __pyx_v_amplitude_ = ((float)50.0);
        }
        if (values[5]) {
          __pyx_v_duration_ = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_duration_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7511, __pyx_L3_error)
        } else {
          __pyx_v_duration_ = ((int)30);
        }
        if (values[6]) {
          __pyx_v_freq_ = __pyx_PyFloat_AsFloat(values[6]); if (unlikely((__pyx_v_freq_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7512, __pyx_L3_error)
        } else {
          __pyx_v_freq_ = ((float)20.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("dampening", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 7505, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_160dampening(__pyx_self, __pyx_v_surface_, __pyx_v_frame_, __pyx_v_display_width, __pyx_v_display_height_, __pyx_v_amplitude_, __pyx_v_duration_, __pyx_v_freq_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_160dampening(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surface_, int __pyx_v_frame_, int __pyx_v_display_width, int __pyx_v_display_height_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dampening", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.amplitude_ = __pyx_v_amplitude_;
      __pyx_t_2.duration_ = __pyx_v_duration_;
      __pyx_t_2.freq_ = __pyx_v_freq_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_dampening(__pyx_v_surface_, __pyx_v_frame_, __pyx_v_display_width, __pyx_v_display_height_, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7505, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_AddTraceback("PygameShader.shader.dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7506:         object surface_,

     7507:         int frame_,

     7508:         int display_width,

     7509:         int display_height_,

     7510:         float amplitude_=50.0,

     7511:         int duration_=30,

     7512:         float freq_=20.0):

     7513:

     7514:     """

     7515:     DAMPENING EFFECT

     7516:

     7517:     Cython cpdef function, this function can be called directly and do not require a

     7518:     hook function.

     7519:

     7520:     Compatible with image 24-32 bit

     7521:     The length of the effect equal duration_ * freq_

     7522:

     7523:     e.g :

     7524:     surf, xx, yy = dampening(BCK, frame, width, height,

     7525:     amplitude_=100, duration_=40, freq_=15)

     7526:     SCREEN.blit(surf, (xx, yy))

     7527:

     7528:     :param surface_       : pygame.Surface (compatible 24 - 32 bit)

     7529:     :param frame_         : integer; Frame number (linear variable changing overtime)

     7530:     :param display_width  : integer; Size of your game display (width)

     7531:     :param display_height_: integer; size of your game display (height)

     7532:     :param amplitude_     : float; Amplitude of the dampening effect  (default is 50)

     7533:     :param duration_      : integer; Duration of the effect (default value is 30)

     7534:     :param freq_          : float; change the speed of the effect default value is 20.0.

     7535:     A small value will decrease

     7536:     the overall timing of the effect while a larger value will increase the duration of the effect.

     7537:     :return               : Tuple values containing the Surface and the position (x, y)

     7538:     with x & y are the top

     7539:      left corner of the

     7540:     image

     7541:     """

     7542:

    +7543:     assert freq_ > 0.0, "Argument freq_ must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_freq_ > 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_freq__must_be_0);
          __PYX_ERR(1, 7543, __pyx_L1_error)
        }
      }
      #endif

    +7544:     assert duration_ > 0.0, "Argument duration_ must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_duration_ > 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_duration__must_be_0);
          __PYX_ERR(1, 7544, __pyx_L1_error)
        }
      }
      #endif

     7545:

    +7546:     cdef float t = damped_oscillation((frame_ / freq_) % duration_)

      __pyx_v_t = __pyx_f_12PygameShader_6shader_damped_oscillation(fmodf((__pyx_v_frame_ / __pyx_v_freq_), __pyx_v_duration_));

     7547:     cdef int width, height,

    +7548:     cdef float tm = t * amplitude_

      __pyx_v_tm = (__pyx_v_t * __pyx_v_amplitude_);

     7549:

    +7550:     width, height = surface_.get_size()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_get_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7550, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 7550, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7550, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7550, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7550, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(1, 7550, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L4_unpacking_done;
        __pyx_L3_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 7550, __pyx_L1_error)
        __pyx_L4_unpacking_done:;
      }
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7550, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7550, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_width = __pyx_t_6;
      __pyx_v_height = __pyx_t_7;

     7551:

    +7552:     if width + tm < 0:

      __pyx_t_8 = (((__pyx_v_width + __pyx_v_tm) < 0.0) != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +7553:         tm = 0

        __pyx_v_tm = 0.0;

    +7554:     if height + tm < 0:

      __pyx_t_8 = (((__pyx_v_height + __pyx_v_tm) < 0.0) != 0);
      if (__pyx_t_8) {
    /* … */
      }

    +7555:         tm = 0

        __pyx_v_tm = 0.0;

    +7556:     cdef object surf = smoothscale(surface_, (<int>tm +<int> (width + <int>tm),

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_smoothscale); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyInt_From_int((((int)__pyx_v_tm) + ((int)(__pyx_v_width + ((int)__pyx_v_tm))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    /* … */
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7556, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_surface_, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface_);
        __Pyx_GIVEREF(__pyx_v_surface_);
        PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_surface_);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7556, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_surf = __pyx_t_1;
      __pyx_t_1 = 0;

    +7557:                                               <int>tm +<int> (height + <int>tm)))

      __pyx_t_4 = __Pyx_PyInt_From_int((((int)__pyx_v_tm) + ((int)(__pyx_v_height + ((int)__pyx_v_tm))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);

     7558:     cdef int new_width, new_height

    +7559:     new_width, new_height = surf.get_size()

      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s_get_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7559, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(1, 7559, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
          __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_5 = Py_TYPE(__pyx_t_9)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_9); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_9), 2) < 0) __PYX_ERR(1, 7559, __pyx_L1_error)
        __pyx_t_5 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L8_unpacking_done;
        __pyx_L7_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_5 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(1, 7559, __pyx_L1_error)
        __pyx_L8_unpacking_done:;
      }
      __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7559, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_new_width = __pyx_t_7;
      __pyx_v_new_height = __pyx_t_6;

     7560:

    +7561:     cdef int diff_x = display_width - new_width

      __pyx_v_diff_x = (__pyx_v_display_width - __pyx_v_new_width);

    +7562:     cdef int diff_y = display_height_ - new_height

      __pyx_v_diff_y = (__pyx_v_display_height_ - __pyx_v_new_height);

     7563:

    +7564:     return surf, diff_x >> 1, diff_y >> 1

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyInt_From_long((__pyx_v_diff_x >> 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_diff_y >> 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_surf);
      __Pyx_GIVEREF(__pyx_v_surf);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      goto __pyx_L0;

     7565:

     7566:

     7567: @cython.boundscheck(False)

     7568: @cython.wraparound(False)

     7569: @cython.nonecheck(False)

     7570: @cython.cdivision(False)

    +7571: cpdef inline float lateral_dampening(int frame_, float amplitude_=50.0,

    static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static CYTHON_INLINE float __pyx_f_12PygameShader_6shader_lateral_dampening(int __pyx_v_frame_, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_12PygameShader_6shader_lateral_dampening *__pyx_optional_args) {
      float __pyx_v_amplitude_ = ((float)50.0);
      int __pyx_v_duration_ = ((int)30);
      float __pyx_v_freq_ = ((float)20.0);
      float __pyx_v_t;
      float __pyx_r;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lateral_dampening", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_amplitude_ = __pyx_optional_args->amplitude_;
          if (__pyx_optional_args->__pyx_n > 1) {
            __pyx_v_duration_ = __pyx_optional_args->duration_;
            if (__pyx_optional_args->__pyx_n > 2) {
              __pyx_v_freq_ = __pyx_optional_args->freq_;
            }
          }
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_WriteUnraisable("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    /* Python wrapper */
    static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static char __pyx_doc_12PygameShader_6shader_162lateral_dampening[] = "\n    DAMPENING EFFECT\n\n    * This method return the lateral displacement (x)\n\n    e.g:\n    tm = lateral_dampening(frame, amplitude_=50.0, duration_=35, freq_=5.0)\n    SCREEN.blit(BCK, (tm, 0), special_flags=0)\n\n    Cython cpdef function, this function can be called directly and do not require a\n    hook function.\n\n    The length of the effect equal duration_ * freq_\n\n    :param frame_    : integer; Your game frame number\n    :param amplitude_: float; Represent the amplitude of the dampening effect.\n                       An amplitude of 1.0 will have no effect.Default value is 50.0\n    :param duration_ : float; This represent the duration of the effect, default value is 30\n    :param freq_     : float; change the speed of the effect default value is 20.0.\n                       A small value will decrease\n                       the overall timing of the effect while a larger value will increase the \n                       duration of the effect.\n    :return          : Return a float corresponding to the lateral displacement (x)\n    ";
    static PyObject *__pyx_pw_12PygameShader_6shader_163lateral_dampening(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      int __pyx_v_frame_;
      float __pyx_v_amplitude_;
      int __pyx_v_duration_;
      float __pyx_v_freq_;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lateral_dampening (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame_2,&__pyx_n_s_amplitude,&__pyx_n_s_duration,&__pyx_n_s_freq,0};
        PyObject* values[4] = {0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            CYTHON_FALLTHROUGH;
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame_2)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            CYTHON_FALLTHROUGH;
            case  1:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_amplitude);
              if (value) { values[1] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  2:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_duration);
              if (value) { values[2] = value; kw_args--; }
            }
            CYTHON_FALLTHROUGH;
            case  3:
            if (kw_args > 0) {
              PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_freq);
              if (value) { values[3] = value; kw_args--; }
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lateral_dampening") < 0)) __PYX_ERR(1, 7571, __pyx_L3_error)
          }
        } else {
          switch (PyTuple_GET_SIZE(__pyx_args)) {
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            CYTHON_FALLTHROUGH;
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            CYTHON_FALLTHROUGH;
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            CYTHON_FALLTHROUGH;
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            break;
            default: goto __pyx_L5_argtuple_error;
          }
        }
        __pyx_v_frame_ = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_frame_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7571, __pyx_L3_error)
        if (values[1]) {
          __pyx_v_amplitude_ = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_amplitude_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7571, __pyx_L3_error)
        } else {
          __pyx_v_amplitude_ = ((float)50.0);
        }
        if (values[2]) {
          __pyx_v_duration_ = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_duration_ == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 7572, __pyx_L3_error)
        } else {
          __pyx_v_duration_ = ((int)30);
        }
        if (values[3]) {
          __pyx_v_freq_ = __pyx_PyFloat_AsFloat(values[3]); if (unlikely((__pyx_v_freq_ == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 7572, __pyx_L3_error)
        } else {
          __pyx_v_freq_ = ((float)20.0);
        }
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("lateral_dampening", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 7571, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_12PygameShader_6shader_162lateral_dampening(__pyx_self, __pyx_v_frame_, __pyx_v_amplitude_, __pyx_v_duration_, __pyx_v_freq_);
      int __pyx_lineno = 0;
      const char *__pyx_filename = NULL;
      int __pyx_clineno = 0;

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_12PygameShader_6shader_162lateral_dampening(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_frame_, float __pyx_v_amplitude_, int __pyx_v_duration_, float __pyx_v_freq_) {
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("lateral_dampening", 0);
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2.__pyx_n = 3;
      __pyx_t_2.amplitude_ = __pyx_v_amplitude_;
      __pyx_t_2.duration_ = __pyx_v_duration_;
      __pyx_t_2.freq_ = __pyx_v_freq_;
      __pyx_t_1 = __pyx_f_12PygameShader_6shader_lateral_dampening(__pyx_v_frame_, 0, &__pyx_t_2);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7571, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_AddTraceback("PygameShader.shader.lateral_dampening", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7572:                                      int duration_=30, float freq_=20.0):

     7573:     """

     7574:     DAMPENING EFFECT

     7575:

     7576:     * This method return the lateral displacement (x)

     7577:

     7578:     e.g:

     7579:     tm = lateral_dampening(frame, amplitude_=50.0, duration_=35, freq_=5.0)

     7580:     SCREEN.blit(BCK, (tm, 0), special_flags=0)

     7581:

     7582:     Cython cpdef function, this function can be called directly and do not require a

     7583:     hook function.

     7584:

     7585:     The length of the effect equal duration_ * freq_

     7586:

     7587:     :param frame_    : integer; Your game frame number

     7588:     :param amplitude_: float; Represent the amplitude of the dampening effect.

     7589:                        An amplitude of 1.0 will have no effect.Default value is 50.0

     7590:     :param duration_ : float; This represent the duration of the effect, default value is 30

     7591:     :param freq_     : float; change the speed of the effect default value is 20.0.

     7592:                        A small value will decrease

     7593:                        the overall timing of the effect while a larger value will increase the

     7594:                        duration of the effect.

     7595:     :return          : Return a float corresponding to the lateral displacement (x)

     7596:     """

    +7597:     assert freq_ > 0, "Argument freq_ must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_freq_ > 0.0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_freq__must_be_0);
          __PYX_ERR(1, 7597, __pyx_L1_error)
        }
      }
      #endif

    +7598:     assert duration_ > 0, "Argument duration_ must be > 0"

      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!((__pyx_v_duration_ > 0) != 0))) {
          PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Argument_duration__must_be_0);
          __PYX_ERR(1, 7598, __pyx_L1_error)
        }
      }
      #endif

     7599:

    +7600:     cdef float t = damped_oscillation((<float>frame_ / freq_) % duration_) * amplitude_

      if (unlikely(__pyx_v_freq_ == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float division");
        __PYX_ERR(1, 7600, __pyx_L1_error)
      }
      __pyx_t_1 = (((float)__pyx_v_frame_) / __pyx_v_freq_);
      if (unlikely(__pyx_v_duration_ == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()");
        __PYX_ERR(1, 7600, __pyx_L1_error)
      }
      __pyx_v_t = (__pyx_f_12PygameShader_6shader_damped_oscillation(__Pyx_mod_float(__pyx_t_1, __pyx_v_duration_)) * __pyx_v_amplitude_);

    +7601:     return t

      __pyx_r = __pyx_v_t;
      goto __pyx_L0;

     7602:

     7603: # --------------------------------------------------------------------------------------------------------

     7604: # KERNEL DEFINITION FOR SHARPEN ALGORITHM

    +7605: cdef float [:, :] SHARPEN_KERNEL = numpy.array(([0, -1, 0],

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_32 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array_2); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_0);
    /* … */
      __pyx_t_30 = PyTuple_New(3); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 7605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_31);
      PyTuple_SET_ITEM(__pyx_t_30, 2, __pyx_t_31);
      __pyx_t_2 = 0;
      __pyx_t_33 = 0;
      __pyx_t_31 = 0;
      __pyx_t_31 = __Pyx_PyObject_CallOneArg(__pyx_t_32, __pyx_t_30); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7605, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;

    +7606:                       [-1, 5, -1],

      __pyx_t_33 = PyList_New(3); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 7606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_5);
      __Pyx_GIVEREF(__pyx_int_5);
      PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_5);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_neg_1);

    +7607:                       [0, -1, 0])).astype(dtype=float32)

      __pyx_t_31 = PyList_New(3); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_31, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_31, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_31, 2, __pyx_int_0);
    /* … */
      __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_astype); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __pyx_t_31 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_float32); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      if (PyDict_SetItem(__pyx_t_31, __pyx_n_s_dtype, __pyx_t_32) < 0) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __pyx_t_32 = __Pyx_PyObject_Call(__pyx_t_30, __pyx_empty_tuple, __pyx_t_31); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __pyx_t_34 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_32, PyBUF_WRITABLE); if (unlikely(!__pyx_t_34.memview)) __PYX_ERR(1, 7607, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL, 1);
      __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL = __pyx_t_34;
      __pyx_t_34.memview = NULL;
      __pyx_t_34.data = NULL;

    +7608: cdef int HALF_KERNEL = len(SHARPEN_KERNEL) >> 1

      if (unlikely(!__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.memview)) { __Pyx_RaiseUnboundLocalError("SHARPEN_KERNEL"); __PYX_ERR(1, 7608, __pyx_L1_error) }
      __pyx_t_47 = __Pyx_MemoryView_Len(__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL);
      __pyx_v_12PygameShader_6shader_HALF_KERNEL = (__pyx_t_47 >> 1);

     7609:

     7610: @cython.boundscheck(False)

     7611: @cython.wraparound(False)

     7612: @cython.nonecheck(False)

     7613: @cython.cdivision(True)

    +7614: cdef inline void shader_sharpen_filter_inplace_c(unsigned char [:, :, :] rgb_array_):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_shader_sharpen_filter_inplace_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_rgb_array_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_xx;
      int __pyx_v_yy;
      short __pyx_v_kernel_offset_y;
      short __pyx_v_kernel_offset_x;
      float __pyx_v_r;
      float __pyx_v_g;
      float __pyx_v_b;
      float __pyx_v_k;
      unsigned char *__pyx_v_rr;
      unsigned char *__pyx_v_gg;
      unsigned char *__pyx_v_bb;
      int __pyx_v_w_1;
      int __pyx_v_h_1;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("shader_sharpen_filter_inplace_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_10);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_WriteUnraisable("PygameShader.shader.shader_sharpen_filter_inplace_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_rgb_array_1, 1);
      __Pyx_RefNannyFinishContext();
    }

     7615:         """

     7616:         SHARPEN IMAGE APPLYING THE BELOW 3 X 3 KERNEL OVER EVERY PIXELS.

     7617:

     7618:         The Array (rgb_array) must be a numpy array shape (w, h, 3)

     7619:         containing RGB pixels, please refer to pygame

     7620:         function pixels3d or array3d to convert an image into a 3d array (library surfarray)

     7621:

     7622:         pixels convoluted outside image edges will be set to adjacent edge value

     7623:         [0 , -1,  0]

     7624:         [-1,  5, -1]

     7625:         [0 , -1,  0]

     7626:

     7627:         e.g

     7628:         sharpen(surface_)

     7629:

     7630:         :param rgb_array_: numpy.ndarray shape (w, h, 3) containing all the RGB pixels

     7631:         :return          : void

     7632:         """

     7633:

     7634:         # texture sizes

     7635:         cdef Py_ssize_t w, h

    +7636:         w, h = rgb_array_.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array_.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     7637:

     7638:         cdef:

     7639:

    +7640:             unsigned char [:, :, :] rgb_array_1 = numpy.empty((w, h, 3), uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_3);
      __pyx_t_5 = 0;
      __pyx_t_7 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_uint8); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_8, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_8, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7);
        __pyx_t_8 = 0;
        __pyx_t_7 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7640, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7640, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_rgb_array_1 = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

     7641:             int x, y, xx, yy

     7642:             short kernel_offset_y, kernel_offset_x

     7643:             float r, g, b, k

     7644:             unsigned char *rr

     7645:             unsigned char *gg

     7646:             unsigned char *bb

    +7647:             int w_1 = <int>w - 1

      __pyx_v_w_1 = (((int)__pyx_v_w) - 1);

    +7648:             int h_1 = <int>h - 1

      __pyx_v_h_1 = (((int)__pyx_v_h) - 1);

     7649:

    +7650:         with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L4_error: {
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L1_error;
            }
            __pyx_L5:;
          }
      }

     7651:

    +7652:             for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_12 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_12 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_12; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((float)__PYX_NAN());
                                __pyx_v_bb = ((unsigned char *)1);
                                __pyx_v_g = ((float)__PYX_NAN());
                                __pyx_v_gg = ((unsigned char *)1);
                                __pyx_v_k = ((float)__PYX_NAN());
                                __pyx_v_kernel_offset_x = ((short)0xbad0bad0);
                                __pyx_v_kernel_offset_y = ((short)0xbad0bad0);
                                __pyx_v_r = ((float)__PYX_NAN());
                                __pyx_v_rr = ((unsigned char *)1);
                                __pyx_v_x = ((int)0xbad0bad0);
                                __pyx_v_xx = ((int)0xbad0bad0);
                                __pyx_v_yy = ((int)0xbad0bad0);

     7653:

    +7654:                 for x in range(w):

                                __pyx_t_13 = __pyx_v_w;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     7655:

    +7656:                     rr = &rgb_array_1[x, y, 0]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 0;
                                  __pyx_v_rr = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[2]) ))));

    +7657:                     gg = &rgb_array_1[x, y, 1]

                                  __pyx_t_17 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  __pyx_v_gg = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_17 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_1.strides[2]) ))));

    +7658:                     bb = &rgb_array_1[x, y, 2]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_16 = __pyx_v_y;
                                  __pyx_t_17 = 2;
                                  __pyx_v_bb = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[2]) ))));

     7659:

    +7660:                     r, g, b = 0, 0, 0

                                  __pyx_t_18 = 0.0;
                                  __pyx_t_19 = 0.0;
                                  __pyx_t_20 = 0.0;
                                  __pyx_v_r = __pyx_t_18;
                                  __pyx_v_g = __pyx_t_19;
                                  __pyx_v_b = __pyx_t_20;

     7661:

    +7662:                     for kernel_offset_y in range(-HALF_KERNEL, HALF_KERNEL + 1):

                                  __pyx_t_21 = (__pyx_v_12PygameShader_6shader_HALF_KERNEL + 1);
                                  __pyx_t_22 = __pyx_t_21;
                                  for (__pyx_t_23 = (-__pyx_v_12PygameShader_6shader_HALF_KERNEL); __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
                                    __pyx_v_kernel_offset_y = __pyx_t_23;

     7663:

    +7664:                         for kernel_offset_x in range(-HALF_KERNEL, HALF_KERNEL + 1):

                                    __pyx_t_24 = (__pyx_v_12PygameShader_6shader_HALF_KERNEL + 1);
                                    __pyx_t_25 = __pyx_t_24;
                                    for (__pyx_t_26 = (-__pyx_v_12PygameShader_6shader_HALF_KERNEL); __pyx_t_26 < __pyx_t_25; __pyx_t_26+=1) {
                                      __pyx_v_kernel_offset_x = __pyx_t_26;

     7665:

    +7666:                             xx = x + kernel_offset_x

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

    +7667:                             yy = y + kernel_offset_y

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

     7668:

    +7669:                             if xx < 0:

                                      __pyx_t_27 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_27) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +7670:                                 xx = 0

                                        __pyx_v_xx = 0;

    +7671:                             elif xx > w_1:

                                      __pyx_t_27 = ((__pyx_v_xx > __pyx_v_w_1) != 0);
                                      if (__pyx_t_27) {
    /* … */
                                      }
                                      __pyx_L16:;

    +7672:                                 xx = w_1

                                        __pyx_v_xx = __pyx_v_w_1;

     7673:

    +7674:                             if yy < 0:

                                      __pyx_t_27 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_27) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +7675:                                 yy = 0

                                        __pyx_v_yy = 0;

    +7676:                             elif yy > h_1:

                                      __pyx_t_27 = ((__pyx_v_yy > __pyx_v_h_1) != 0);
                                      if (__pyx_t_27) {
    /* … */
                                      }
                                      __pyx_L17:;

    +7677:                                 yy = h_1

                                        __pyx_v_yy = __pyx_v_h_1;

     7678:

    +7679:                             k = SHARPEN_KERNEL[kernel_offset_y + HALF_KERNEL,

                                      if (unlikely(!__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.memview)) { __Pyx_RaiseUnboundMemoryviewSliceNogil("SHARPEN_KERNEL"); __PYX_ERR(1, 7679, __pyx_L8_error) }
    /* … */
                                      __pyx_t_17 = (__pyx_v_kernel_offset_y + __pyx_v_12PygameShader_6shader_HALF_KERNEL);
                                      __pyx_t_16 = (__pyx_v_kernel_offset_x + __pyx_v_12PygameShader_6shader_HALF_KERNEL);
                                      __pyx_v_k = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.data + __pyx_t_17 * __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.strides[0]) ) + __pyx_t_16 * __pyx_v_12PygameShader_6shader_SHARPEN_KERNEL.strides[1]) )));

     7680:                                                kernel_offset_x + HALF_KERNEL]

     7681:

    +7682:                             r = r + rgb_array_[xx, yy, 0] * k

                                      __pyx_t_16 = __pyx_v_xx;
                                      __pyx_t_17 = __pyx_v_yy;
                                      __pyx_t_15 = 0;
                                      __pyx_v_r = (__pyx_v_r + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));

    +7683:                             g = g + rgb_array_[xx, yy, 1] * k

                                      __pyx_t_15 = __pyx_v_xx;
                                      __pyx_t_17 = __pyx_v_yy;
                                      __pyx_t_16 = 1;
                                      __pyx_v_g = (__pyx_v_g + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));

    +7684:                             b = b + rgb_array_[xx, yy, 2] * k

                                      __pyx_t_16 = __pyx_v_xx;
                                      __pyx_t_17 = __pyx_v_yy;
                                      __pyx_t_15 = 2;
                                      __pyx_v_b = (__pyx_v_b + ((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_16 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) ))) * __pyx_v_k));
                                    }
                                  }

     7685:

    +7686:                     if r < 0:

                                  __pyx_t_27 = ((__pyx_v_r < 0.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7687:                         r = 0

                                    __pyx_v_r = 0.0;

    +7688:                     if g < 0:

                                  __pyx_t_27 = ((__pyx_v_g < 0.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7689:                         g = 0

                                    __pyx_v_g = 0.0;

    +7690:                     if b < 0:

                                  __pyx_t_27 = ((__pyx_v_b < 0.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7691:                         b = 0

                                    __pyx_v_b = 0.0;

    +7692:                     if r > 255:

                                  __pyx_t_27 = ((__pyx_v_r > 255.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7693:                         r= 255

                                    __pyx_v_r = 255.0;

    +7694:                     if g > 255:

                                  __pyx_t_27 = ((__pyx_v_g > 255.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7695:                         g = 255

                                    __pyx_v_g = 255.0;

    +7696:                     if b > 255:

                                  __pyx_t_27 = ((__pyx_v_b > 255.0) != 0);
                                  if (__pyx_t_27) {
    /* … */
                                  }

    +7697:                         b = 255

                                    __pyx_v_b = 255.0;

     7698:

    +7699:                     rr[0] = <unsigned char>r

                                  (__pyx_v_rr[0]) = ((unsigned char)__pyx_v_r);

    +7700:                     gg[0] = <unsigned char>g

                                  (__pyx_v_gg[0]) = ((unsigned char)__pyx_v_g);

    +7701:                     bb[0] = <unsigned char>b

                                  (__pyx_v_bb[0]) = ((unsigned char)__pyx_v_b);
                                }
                                goto __pyx_L25;
                                __pyx_L8_error:;
                                {
                                    #ifdef WITH_THREAD
                                    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                                    #endif
                                    #ifdef _OPENMP
                                    #pragma omp flush(__pyx_parallel_exc_type)
                                    #endif /* _OPENMP */
                                    if (!__pyx_parallel_exc_type) {
                                      __Pyx_ErrFetchWithState(&__pyx_parallel_exc_type, &__pyx_parallel_exc_value, &__pyx_parallel_exc_tb);
                                      __pyx_parallel_filename = __pyx_filename; __pyx_parallel_lineno = __pyx_lineno; __pyx_parallel_clineno = __pyx_clineno;
                                      __Pyx_GOTREF(__pyx_parallel_exc_type);
                                    }
                                    #ifdef WITH_THREAD
                                    __Pyx_PyGILState_Release(__pyx_gilstate_save);
                                    #endif
                                }
                                __pyx_parallel_why = 4;
                                goto __pyx_L24;
                                __pyx_L24:;
                                #ifdef _OPENMP
                                #pragma omp critical(__pyx_parallel_lastprivates13)
                                #endif /* _OPENMP */
                                {
                                    __pyx_parallel_temp0 = __pyx_v_b;
                                    __pyx_parallel_temp1 = __pyx_v_bb;
                                    __pyx_parallel_temp2 = __pyx_v_g;
                                    __pyx_parallel_temp3 = __pyx_v_gg;
                                    __pyx_parallel_temp4 = __pyx_v_k;
                                    __pyx_parallel_temp5 = __pyx_v_kernel_offset_x;
                                    __pyx_parallel_temp6 = __pyx_v_kernel_offset_y;
                                    __pyx_parallel_temp7 = __pyx_v_r;
                                    __pyx_parallel_temp8 = __pyx_v_rr;
                                    __pyx_parallel_temp9 = __pyx_v_x;
                                    __pyx_parallel_temp10 = __pyx_v_xx;
                                    __pyx_parallel_temp11 = __pyx_v_y;
                                    __pyx_parallel_temp12 = __pyx_v_yy;
                                }
                                __pyx_L25:;
                                #ifdef _OPENMP
                                #pragma omp flush(__pyx_parallel_why)
                                #endif /* _OPENMP */
                            }
                        }
                        #ifdef _OPENMP
                        Py_END_ALLOW_THREADS
                        #else
    {
    #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        #endif /* _OPENMP */
                        /* Clean up any temporaries */
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                        #ifndef _OPENMP
    }
    #endif /* _OPENMP */
                    }
                }
                if (__pyx_parallel_exc_type) {
                  /* This may have been overridden by a continue, break or return in another thread. Prefer the error. */
                  __pyx_parallel_why = 4;
                }
                if (__pyx_parallel_why) {
                  __pyx_v_b = __pyx_parallel_temp0;
                  __pyx_v_bb = __pyx_parallel_temp1;
                  __pyx_v_g = __pyx_parallel_temp2;
                  __pyx_v_gg = __pyx_parallel_temp3;
                  __pyx_v_k = __pyx_parallel_temp4;
                  __pyx_v_kernel_offset_x = __pyx_parallel_temp5;
                  __pyx_v_kernel_offset_y = __pyx_parallel_temp6;
                  __pyx_v_r = __pyx_parallel_temp7;
                  __pyx_v_rr = __pyx_parallel_temp8;
                  __pyx_v_x = __pyx_parallel_temp9;
                  __pyx_v_xx = __pyx_parallel_temp10;
                  __pyx_v_y = __pyx_parallel_temp11;
                  __pyx_v_yy = __pyx_parallel_temp12;
                  switch (__pyx_parallel_why) {
                        case 4:
                    {
                        #ifdef WITH_THREAD
                        PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
                        #endif
                        __Pyx_GIVEREF(__pyx_parallel_exc_type);
                        __Pyx_ErrRestoreWithState(__pyx_parallel_exc_type, __pyx_parallel_exc_value, __pyx_parallel_exc_tb);
                        __pyx_filename = __pyx_parallel_filename; __pyx_lineno = __pyx_parallel_lineno; __pyx_clineno = __pyx_parallel_clineno;
                        #ifdef WITH_THREAD
                        __Pyx_PyGILState_Release(__pyx_gilstate_save);
                        #endif
                    }
                    goto __pyx_L4_error;
                  }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif

     7702:

    +7703:             for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_12 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_3 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_3 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_12 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_3 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_3 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_3; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_x = ((int)0xbad0bad0);

     7704:

    +7705:                 for x in range(w):

                                __pyx_t_13 = __pyx_v_w;
                                __pyx_t_14 = __pyx_t_13;
                                for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_14; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

    +7706:                     rgb_array_[x, y, 0] = rgb_array_1[x, y, 0]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_16 = 0;
                                  __pyx_t_28 = __pyx_v_x;
                                  __pyx_t_29 = __pyx_v_y;
                                  __pyx_t_30 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_28 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_30 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[2]) )));

    +7707:                     rgb_array_[x, y, 1] = rgb_array_1[x, y, 1]

                                  __pyx_t_16 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_15 = 1;
                                  __pyx_t_30 = __pyx_v_x;
                                  __pyx_t_29 = __pyx_v_y;
                                  __pyx_t_28 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_30 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_28 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_16 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_1.strides[2]) )));

    +7708:                     rgb_array_[x, y, 2] = rgb_array_1[x, y, 2]

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_17 = __pyx_v_y;
                                  __pyx_t_16 = 2;
                                  __pyx_t_28 = __pyx_v_x;
                                  __pyx_t_29 = __pyx_v_y;
                                  __pyx_t_30 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_28 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_29 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_30 * __pyx_v_rgb_array_.strides[2]) )) = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_1.data + __pyx_t_15 * __pyx_v_rgb_array_1.strides[0]) ) + __pyx_t_17 * __pyx_v_rgb_array_1.strides[1]) ) + __pyx_t_16 * __pyx_v_rgb_array_1.strides[2]) )));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     7709:

     7710:

     7711: # Added to version 1.0.1

     7712: @cython.boundscheck(False)

     7713: @cython.wraparound(False)

     7714: @cython.nonecheck(False)

     7715: @cython.cdivision(True)

    +7716: cdef cartoon_effect(

    static PyObject *__pyx_f_12PygameShader_6shader_cartoon_effect(PyObject *__pyx_v_surface_, int __pyx_v_sobel_threshold_, int __pyx_v_median_kernel_, int __pyx_v_color_, int __pyx_v_flag_) {
      PyObject *__pyx_v_surface_branch_1 = NULL;
      PyObject *__pyx_v_array_ = NULL;
      PyObject *__pyx_v_arr = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("cartoon_effect", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
      __Pyx_XDECREF(__pyx_t_7);
      __Pyx_AddTraceback("PygameShader.shader.cartoon_effect", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_surface_branch_1);
      __Pyx_XDECREF(__pyx_v_array_);
      __Pyx_XDECREF(__pyx_v_arr);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7717:         object surface_,

     7718:         int sobel_threshold_,

     7719:         int median_kernel_,

     7720:         int color_, int flag_):

     7721:     """

     7722:

     7723:     :param surface_: pygame.Surface compatible 24 - 32 bit

     7724:     :param sobel_threshold_: integer sobel threshold

     7725:     :param median_kernel_  : integer median kernel

     7726:     :param color_          : integer; color reduction value (max color)

     7727:     :param flag_           : integer; Blend flag e.g (BLEND_RGB_ADD, BLEND_RGB_SUB,

     7728:                              BLEND_RGB_MULT, BLEND_RGB_MAX, BLEND_RGB_MIN

     7729:     :return               : Return a pygame Surface with the cartoon effect

     7730:     """

     7731:

     7732:     # First branch from the surface_

     7733:     # surface_branch_1

    +7734:     surface_branch_1 = surface_.copy()

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_surface_branch_1 = __pyx_t_1;
      __pyx_t_1 = 0;

    +7735:     array_ = canny_blur5x5_surface24_c(surface_branch_1)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_canny_blur5x5_surface24_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7735, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_surface_branch_1) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_surface_branch_1);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7735, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_array_ = __pyx_t_1;
      __pyx_t_1 = 0;

    +7736:     shader_greyscale_luminosity24_inplace_c(array_)

      __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7736, __pyx_L1_error)
      __pyx_f_12PygameShader_6shader_shader_greyscale_luminosity24_inplace_c(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
      __pyx_t_4.memview = NULL;
      __pyx_t_4.data = NULL;

    +7737:     shader_sobel24_inplace_c(array_, sobel_threshold_)

      __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_array_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7737, __pyx_L1_error)
      __pyx_t_5.__pyx_n = 1;
      __pyx_t_5.threshold = __pyx_v_sobel_threshold_;
      __pyx_f_12PygameShader_6shader_shader_sobel24_inplace_c(__pyx_t_4, &__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
      __pyx_t_4.memview = NULL;
      __pyx_t_4.data = NULL;

     7738:

     7739:     # Second branch

    +7740:     arr = pixels3d(surface_)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7740, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_surface_) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_surface_);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7740, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_arr = __pyx_t_1;
      __pyx_t_1 = 0;

    +7741:     shader_median_filter24_inplace_c(arr, median_kernel_)

      __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7741, __pyx_L1_error)
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.kernel_size_ = __pyx_v_median_kernel_;
      __pyx_f_12PygameShader_6shader_shader_median_filter24_inplace_c(__pyx_t_4, &__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
      __pyx_t_4.memview = NULL;
      __pyx_t_4.data = NULL;

     7742:

     7743:     # median_fast(

     7744:     #     surface_,

     7745:     #     kernel_size_=median_kernel_,

     7746:     #     reduce_factor_=2)

     7747:

     7748:     # Color reduction

    +7749:     shader_color_reduction24_inplace_c(arr, color_)

      __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_v_arr, PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 7749, __pyx_L1_error)
      __pyx_f_12PygameShader_6shader_shader_color_reduction24_inplace_c(__pyx_t_4, __pyx_v_color_);
      __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
      __pyx_t_4.memview = NULL;
      __pyx_t_4.data = NULL;

     7750:

    +7751:     del arr

      __Pyx_DECREF(__pyx_v_arr);
      __pyx_v_arr = NULL;

     7752:

     7753:     # Blend both branch

    +7754:     surface_.blit(make_surface(array_), (0, 0), special_flags=flag_)

      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surface_, __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_7, __pyx_v_array_) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_array_);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_INCREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_special_flags, __pyx_t_7) < 0) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 7754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

     7755:

    +7756:     return surface_

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_surface_);
      __pyx_r = __pyx_v_surface_;
      goto __pyx_L0;

     7757:

     7758:

     7759:

     7760: # TODO ADD TO TESTING

     7761: # Added to version 1.0.1

     7762: @cython.boundscheck(False)

     7763: @cython.wraparound(False)

     7764: @cython.nonecheck(False)

     7765: @cython.cdivision(True)

    +7766: cdef object blending(object source_, object destination_, float percentage_):

    static PyObject *__pyx_f_12PygameShader_6shader_blending(PyObject *__pyx_v_source_, PyObject *__pyx_v_destination_, float __pyx_v_percentage_) {
      __Pyx_memviewslice __pyx_v_source_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      __Pyx_memviewslice __pyx_v_destination_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_v_e = NULL;
      int __pyx_v_c1;
      int __pyx_v_c2;
      int __pyx_v_c3;
      int __pyx_v_i;
      int __pyx_v_j;
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_final_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      float __pyx_v_c4;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("blending", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_XDECREF(__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
      __Pyx_XDECREF(__pyx_t_9);
      __Pyx_XDECREF(__pyx_t_10);
      __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
      __Pyx_XDECREF(__pyx_t_24);
      __Pyx_XDECREF(__pyx_t_25);
      __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_source_array, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_destination_array, 1);
      __Pyx_XDECREF(__pyx_v_e);
      __PYX_XDEC_MEMVIEW(&__pyx_v_final_array, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7767:     """

     7768:     BLEND A SOURCE TEXTURE TOWARD A DESTINATION TEXTURE (TRANSITION EFFECT)

     7769:

     7770:     * Video system must be initialised

     7771:     * source_ & destination_ Textures must be same sizes

     7772:     * Compatible with 24 - 32 bit surface

     7773:     * Output create a new surface

     7774:     * Image returned is converted for fast blit (convert())

     7775:

     7776:     :param source_     : pygame.Surface (Source)

     7777:     :param destination_: pygame.Surface (Destination)

     7778:     :param percentage_ : float; Percentage value between [0.0 ... 100.0]

     7779:     :return: return    : Return a 24 bit pygame.Surface and blended with a percentage

     7780:                          of the destination texture.

     7781:     """

     7782:

     7783:     cdef:

     7784:             unsigned char [:, :, :] source_array

     7785:             unsigned char [:, :, :] destination_array

     7786:

    +7787:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L8_try_end;
        __pyx_L3_error:;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
    /* … */
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
        goto __pyx_L1_error;
        __pyx_L8_try_end:;
      }

    +7788:         source_array      = pixels3d(source_)

          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7788, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_source_) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_source_);
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7788, __pyx_L3_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 7788, __pyx_L3_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_source_array = __pyx_t_7;
          __pyx_t_7.memview = NULL;
          __pyx_t_7.data = NULL;

     7789:

    +7790:     except Exception as e:

        __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_8) {
          __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(1, 7790, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_e = __pyx_t_5;

    +7791:         raise ValueError("\nCannot reference source pixels into a 3d array.\n %s " % e)

          __pyx_t_9 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_reference_source_pixels, __pyx_v_e); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7791, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7791, __pyx_L5_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_Raise(__pyx_t_10, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __PYX_ERR(1, 7791, __pyx_L5_except_error)
        }
        goto __pyx_L5_except_error;
        __pyx_L5_except_error:;

     7792:

    +7793:     try:

      {
        /*try:*/ {
    /* … */
        }
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L16_try_end;
        __pyx_L11_error:;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    /* … */
        __Pyx_XGIVEREF(__pyx_t_3);
        __Pyx_XGIVEREF(__pyx_t_2);
        __Pyx_XGIVEREF(__pyx_t_1);
        __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_2, __pyx_t_1);
        goto __pyx_L1_error;
        __pyx_L16_try_end:;
      }

    +7794:         destination_array = pixels3d(destination_)

          __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pixels3d); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_4)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_4);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          __pyx_t_6 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_destination_) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_destination_);
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7794, __pyx_L11_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 7794, __pyx_L11_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_v_destination_array = __pyx_t_7;
          __pyx_t_7.memview = NULL;
          __pyx_t_7.data = NULL;

     7795:

    +7796:     except Exception as e:

        __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
        if (__pyx_t_8) {
          __Pyx_AddTraceback("PygameShader.shader.blending", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0) __PYX_ERR(1, 7796, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __pyx_v_e = __pyx_t_5;

    +7797:         raise ValueError("\nCannot reference destination pixels into a 3d array.\n %s " % e)

          __pyx_t_10 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_reference_destination_pi, __pyx_v_e); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7797, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7797, __pyx_L13_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_Raise(__pyx_t_9, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __PYX_ERR(1, 7797, __pyx_L13_except_error)
        }
        goto __pyx_L13_except_error;
        __pyx_L13_except_error:;

     7798:

     7799:     cdef:

     7800:

     7801:         int c1, c2, c3

    +7802:         int i=0, j=0

      __pyx_v_i = 0;
      __pyx_v_j = 0;

    +7803:         Py_ssize_t w = source_array.shape[0]

      __pyx_v_w = (__pyx_v_source_array.shape[0]);

    +7804:         Py_ssize_t h = source_array.shape[1]

      __pyx_v_h = (__pyx_v_source_array.shape[1]);

    +7805:         unsigned char[:, :, ::1] final_array = empty((h, w, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_6);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_3);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(1, 7805, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_final_array = __pyx_t_11;
      __pyx_t_11.memview = NULL;
      __pyx_t_11.data = NULL;

    +7806:         float c4 = percentage_ / <float> 100.0

      __pyx_v_c4 = (__pyx_v_percentage_ / ((float)100.0));

     7807:         unsigned char *r

     7808:         unsigned char *g

     7809:         unsigned char *b

     7810:

    +7811:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L21;
            }
            __pyx_L21:;
          }
      }

    +7812:         for j in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_12 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_14 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_14 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static)
    /* … */
            __pyx_t_12 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_14 = (__pyx_t_12 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_14 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_c1) lastprivate(__pyx_v_c2) lastprivate(__pyx_v_c3) lastprivate(__pyx_v_g) lastprivate(__pyx_v_i) firstprivate(__pyx_v_j) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_14; __pyx_t_13++){
                            {
                                __pyx_v_j = (int)(0 + 1 * __pyx_t_13);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_c1 = ((int)0xbad0bad0);
                                __pyx_v_c2 = ((int)0xbad0bad0);
                                __pyx_v_c3 = ((int)0xbad0bad0);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_i = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);

    +7813:             for i in range(w):

                                __pyx_t_15 = __pyx_v_w;
                                __pyx_t_16 = __pyx_t_15;
                                for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_16; __pyx_t_8+=1) {
                                  __pyx_v_i = __pyx_t_8;

     7814:

    +7815:                 r = &source_array[i, j, 0]

                                  __pyx_t_17 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_19 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_17 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_19 * __pyx_v_source_array.strides[2]) ))));

    +7816:                 g = &source_array[i, j, 1]

                                  __pyx_t_19 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_17 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_19 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_17 * __pyx_v_source_array.strides[2]) ))));

    +7817:                 b = &source_array[i, j, 2]

                                  __pyx_t_17 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_19 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_source_array.data + __pyx_t_17 * __pyx_v_source_array.strides[0]) ) + __pyx_t_18 * __pyx_v_source_array.strides[1]) ) + __pyx_t_19 * __pyx_v_source_array.strides[2]) ))));

     7818:

    +7819:                 c1 = min(<int> (<float> destination_array[i, j, 0] * c4 +

                                  __pyx_t_20 = 0xFF;
                                  __pyx_t_19 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_17 = 0;
    /* … */
                                  __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_19 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_17 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_r[0]) * (((float)1.0) - __pyx_v_c4))));

    +7820:                                 r[0] * (<float> 1.0 - c4)), 255)

                                  if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                    __pyx_t_22 = __pyx_t_20;
                                  } else {
                                    __pyx_t_22 = __pyx_t_21;
                                  }
                                  __pyx_v_c1 = __pyx_t_22;

    +7821:                 c2 = min(<int> (<float> destination_array[i, j, 1] * c4 +

                                  __pyx_t_22 = 0xFF;
                                  __pyx_t_17 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_19 = 1;
    /* … */
                                  __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_17 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_19 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_g[0]) * (((float)1.0) - __pyx_v_c4))));

    +7822:                                 g[0] * (<float> 1.0 - c4)), 255)

                                  if (((__pyx_t_22 < __pyx_t_21) != 0)) {
                                    __pyx_t_20 = __pyx_t_22;
                                  } else {
                                    __pyx_t_20 = __pyx_t_21;
                                  }
                                  __pyx_v_c2 = __pyx_t_20;

    +7823:                 c3 = min(<int> (<float> destination_array[i, j, 2] * c4 +

                                  __pyx_t_20 = 0xFF;
                                  __pyx_t_19 = __pyx_v_i;
                                  __pyx_t_18 = __pyx_v_j;
                                  __pyx_t_17 = 2;
    /* … */
                                  __pyx_t_21 = ((int)((((float)(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_destination_array.data + __pyx_t_19 * __pyx_v_destination_array.strides[0]) ) + __pyx_t_18 * __pyx_v_destination_array.strides[1]) ) + __pyx_t_17 * __pyx_v_destination_array.strides[2]) )))) * __pyx_v_c4) + ((__pyx_v_b[0]) * (((float)1.0) - __pyx_v_c4))));

    +7824:                                 b[0] * (<float> 1.0 - c4)), 255)

                                  if (((__pyx_t_20 < __pyx_t_21) != 0)) {
                                    __pyx_t_22 = __pyx_t_20;
                                  } else {
                                    __pyx_t_22 = __pyx_t_21;
                                  }
                                  __pyx_v_c3 = __pyx_t_22;

    +7825:                 if c1 < 0:

                                  __pyx_t_23 = ((__pyx_v_c1 < 0) != 0);
                                  if (__pyx_t_23) {
    /* … */
                                  }

    +7826:                     c1 = 0

                                    __pyx_v_c1 = 0;

    +7827:                 if c2 < 0:

                                  __pyx_t_23 = ((__pyx_v_c2 < 0) != 0);
                                  if (__pyx_t_23) {
    /* … */
                                  }

    +7828:                     c2 = 0

                                    __pyx_v_c2 = 0;

    +7829:                 if c3 < 0:

                                  __pyx_t_23 = ((__pyx_v_c3 < 0) != 0);
                                  if (__pyx_t_23) {
    /* … */
                                  }

    +7830:                     c3 = 0

                                    __pyx_v_c3 = 0;

    +7831:                 final_array[j, i, 0] = c1

                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = __pyx_v_i;
                                  __pyx_t_19 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_17 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_19)) )) = __pyx_v_c1;

    +7832:                 final_array[j, i, 1] = c2

                                  __pyx_t_19 = __pyx_v_j;
                                  __pyx_t_18 = __pyx_v_i;
                                  __pyx_t_17 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_19 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_17)) )) = __pyx_v_c2;

    +7833:                 final_array[j, i, 2] = c3

                                  __pyx_t_17 = __pyx_v_j;
                                  __pyx_t_18 = __pyx_v_i;
                                  __pyx_t_19 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_final_array.data + __pyx_t_17 * __pyx_v_final_array.strides[0]) ) + __pyx_t_18 * __pyx_v_final_array.strides[1]) )) + __pyx_t_19)) )) = __pyx_v_c3;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     7834:

    +7835:     return pygame.image.frombuffer(final_array, (w, h), 'RGB').convert()

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_pygame); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_image); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_final_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_24 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_24)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __pyx_t_25 = PyTuple_New(2); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_25, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_24);
      PyTuple_SET_ITEM(__pyx_t_25, 1, __pyx_t_24);
      __pyx_t_10 = 0;
      __pyx_t_24 = 0;
      __pyx_t_24 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_24)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_24);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_24, __pyx_t_4, __pyx_t_25, __pyx_n_s_RGB};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[4] = {__pyx_t_24, __pyx_t_4, __pyx_t_25, __pyx_n_s_RGB};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 7835, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_24) {
          __Pyx_GIVEREF(__pyx_t_24); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_24); __pyx_t_24 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_25);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_t_25);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_n_s_RGB);
        __pyx_t_4 = 0;
        __pyx_t_25 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 7835, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_5 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7835, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

     7836:

     7837:

     7838: @cython.boundscheck(False)

     7839: @cython.wraparound(False)

     7840: @cython.nonecheck(False)

     7841: @cython.cdivision(True)

    +7842: cdef inline void dirt_lens_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dirt_lens_c(PyObject *__pyx_v_source_, PyObject *__pyx_v_lens_model_, int __pyx_v_flag_, struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c *__pyx_optional_args) {
      float __pyx_v_light_ = ((float)0.0);
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dirt_lens_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_light_ = __pyx_optional_args->light_;
        }
      }
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __Pyx_WriteUnraisable("PygameShader.shader.dirt_lens_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_dirt_lens_c {
      int __pyx_n;
      float light_;
    };

     7843:         object source_,

     7844:         object lens_model_,

     7845:         int flag_,

     7846:         float light_=0.0):

     7847:

    +7848:     if light_!=0.0:

      __pyx_t_1 = ((__pyx_v_light_ != 0.0) != 0);
      if (__pyx_t_1) {
    /* … */
      }

    +7849:         brightness(lens_model_, light_)

        __pyx_f_12PygameShader_6shader_brightness(__pyx_v_lens_model_, __pyx_v_light_, 0);

    +7850:     source_.blit(lens_model_, (0, 0), special_flags=flag_)

      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source_, __pyx_n_s_blit); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_lens_model_);
      __Pyx_GIVEREF(__pyx_v_lens_model_);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_lens_model_);
      __Pyx_INCREF(__pyx_tuple__12);
      __Pyx_GIVEREF(__pyx_tuple__12);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_tuple__12);
      __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_flag_); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_special_flags, __pyx_t_5) < 0) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 7850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

     7851:

     7852:

     7853: # TODO DITHERING WITH KERNEL INSTEAD

     7854: @cython.boundscheck(False)

     7855: @cython.wraparound(False)

     7856: @cython.nonecheck(False)

     7857: @cython.cdivision(True)

    +7858: cdef object dithering_c(float [:, :, :] rgb_array_, int factor_):

    static PyObject *__pyx_f_12PygameShader_6shader_dithering_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_factor_) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      float __pyx_v_new_red;
      float __pyx_v_new_green;
      float __pyx_v_new_blue;
      float __pyx_v_quantization_error_red;
      float __pyx_v_quantization_error_green;
      float __pyx_v_quantization_error_blue;
      float __pyx_v_oldr;
      float __pyx_v_oldg;
      float __pyx_v_oldb;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_17);
      __Pyx_XDECREF(__pyx_t_18);
      __Pyx_XDECREF(__pyx_t_19);
      __Pyx_XDECREF(__pyx_t_20);
      __Pyx_XDECREF(__pyx_t_21);
      __Pyx_XDECREF(__pyx_t_22);
      __Pyx_AddTraceback("PygameShader.shader.dithering_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     7859:

     7860:     """

     7861:     Dithering is used in computer graphics to create the illusion of "color depth" in images with

     7862:     a limited color palette - a technique also known as color quantization. In a dithered image,

     7863:     colors that are not available in the palette are approximated by a diffusion of colored pixels

     7864:     from within the available palette. The human eye perceives the diffusion as a mixture of

     7865:     the colors within it (see color vision). Dithered images, particularly those with relatively

     7866:     few colors, can often be distinguished by a characteristic graininess or speckled appearance.

     7867:

     7868:     factor_ represent the color number per RGB channel, values must be (2, 3, 4 .. etc)

     7869:     and 2 means two colors per channels (2x2x2 = total 8 colors)

     7870:

     7871:

     7872:     :param rgb_array_: pygame.Surface compatible 24-32 bit

     7873:     :param factor_: integer; color per channel; must be > 1.

     7874:     A value of 2 means a total of 8 colors

     7875:     :return: pygame surface 24-32 bit

     7876:     """

     7877:

     7878:     cdef Py_ssize_t w, h

    +7879:     w = <object> rgb_array_.shape[ 0 ] - 1

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7879, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7879, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_w = __pyx_t_3;

    +7880:     h = <object> rgb_array_.shape[ 1 ] - 1

      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7880, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7880, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_h = __pyx_t_3;

     7881:

     7882:     cdef:

    +7883:         int x=0, y=0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     7884:         float new_red, new_green, new_blue

     7885:         float quantization_error_red, quantization_error_green, quantization_error_blue

     7886:         float oldr, oldg, oldb

     7887:

    +7888:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     7889:

    +7890:         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y)            __pyx_t_6 = __Pyx_pow_long(2, 8);
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static, __pyx_t_6) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){
                            {
                                __pyx_v_y = (int)(1 + 1 * __pyx_t_4);
                                /* Initialize private variables to invalid values */
                                __pyx_v_new_blue = ((float)__PYX_NAN());
                                __pyx_v_new_green = ((float)__PYX_NAN());
                                __pyx_v_new_red = ((float)__PYX_NAN());
                                __pyx_v_oldb = ((float)__PYX_NAN());
                                __pyx_v_oldg = ((float)__PYX_NAN());
                                __pyx_v_oldr = ((float)__PYX_NAN());
                                __pyx_v_quantization_error_blue = ((float)__PYX_NAN());
                                __pyx_v_quantization_error_green = ((float)__PYX_NAN());
                                __pyx_v_quantization_error_red = ((float)__PYX_NAN());
                                __pyx_v_x = ((int)0xbad0bad0);

     7891:

    +7892:             for x in range(1, w):

                                __pyx_t_7 = __pyx_v_w;
                                __pyx_t_8 = __pyx_t_7;
                                for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     7893:

    +7894:                 oldr = rgb_array_[x, y, 0]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 0;
                                  __pyx_v_oldr = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

    +7895:                 oldg = rgb_array_[x, y, 1]

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 1;
                                  __pyx_v_oldg = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));

    +7896:                 oldb = rgb_array_[x, y, 2]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 2;
                                  __pyx_v_oldb = (*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

     7897:

    +7898:                 new_red   = <float>round_c(oldr * (factor_ - 1)) / (factor_ - 1)

                                  __pyx_v_new_red = (((float)round((__pyx_v_oldr * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

    +7899:                 new_green = <float>round_c(oldg * (factor_ - 1)) / (factor_ - 1)

                                  __pyx_v_new_green = (((float)round((__pyx_v_oldg * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

    +7900:                 new_blue  = <float>round_c(oldb * (factor_ - 1)) / (factor_ - 1)

                                  __pyx_v_new_blue = (((float)round((__pyx_v_oldb * (__pyx_v_factor_ - 1)))) / (__pyx_v_factor_ - 1));

     7901:

    +7902:                 rgb_array_[x, y, 0] = new_red

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 0;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_red;

    +7903:                 rgb_array_[x, y, 1] = new_green

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 1;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_green;

    +7904:                 rgb_array_[x, y, 2] = new_blue

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 2;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_blue;

     7905:

    +7906:                 quantization_error_red   = <float>(oldr - new_red)

                                  __pyx_v_quantization_error_red = ((float)(__pyx_v_oldr - __pyx_v_new_red));

    +7907:                 quantization_error_green = <float>(oldg - new_green)

                                  __pyx_v_quantization_error_green = ((float)(__pyx_v_oldg - __pyx_v_new_green));

    +7908:                 quantization_error_blue  = <float>(oldb - new_blue)

                                  __pyx_v_quantization_error_blue = ((float)(__pyx_v_oldb - __pyx_v_new_blue));

     7909:

    +7910:                 rgb_array_[x + 1, y, 0] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C1));

    +7911:                     rgb_array_[x + 1, y, 0] + quantization_error_red * C1

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 0;

    +7912:                 rgb_array_[x + 1, y, 1] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C1));

    +7913:                     rgb_array_[x + 1, y, 1] + quantization_error_green * C1

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 1;

    +7914:                 rgb_array_[x + 1, y, 2] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C1));

    +7915:                     rgb_array_[x + 1, y, 2] + quantization_error_blue * C1

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 2;

     7916:

    +7917:                 rgb_array_[x - 1, y + 1, 0] = \

                                  __pyx_t_15 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 0;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C2));

    +7918:                     rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2

                                  __pyx_t_12 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 0;

    +7919:                 rgb_array_[x - 1, y + 1, 1] = \

                                  __pyx_t_13 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 1;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C2));

    +7920:                     rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2

                                  __pyx_t_10 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 1;

    +7921:                 rgb_array_[x - 1, y + 1, 2] = \

                                  __pyx_t_15 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 2;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C2));

    +7922:                     rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2

                                  __pyx_t_12 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 2;

     7923:

    +7924:                 rgb_array_[x, y + 1, 0] = \

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 0;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C3));

    +7925:                     rgb_array_[x, y + 1, 0] + quantization_error_red * C3

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 0;

    +7926:                 rgb_array_[x, y + 1, 1] = \

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 1;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C3));

    +7927:                     rgb_array_[x, y + 1, 1] + quantization_error_green * C3

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 1;

    +7928:                 rgb_array_[x, y + 1, 2] = \

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 2;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C3));

    +7929:                     rgb_array_[x, y + 1, 2] + quantization_error_blue * C3

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 2;

     7930:

    +7931:                 rgb_array_[x + 1, y + 1, 0] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 0;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C4));

    +7932:                     rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 0;

    +7933:                 rgb_array_[x + 1, y + 1, 1] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 1;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C4));

    +7934:                     rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 1;

    +7935:                 rgb_array_[x + 1, y + 1, 2] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 2;
                                  *((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((*((float *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C4));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +7936:                     rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 2;

     7937:

    +7938:     return make_surface(numpy.multiply(asarray(rgb_array_), 255.0).astype(dtype=uint8)).convert()

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_numpy); if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_multiply); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_asarray); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_20);
      __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_rgb_array_, 3, (PyObject *(*)(char *)) __pyx_memview_get_float, (int (*)(char *, PyObject *)) __pyx_memview_set_float, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_22 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
        __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
        if (likely(__pyx_t_22)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_22);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_20, function);
        }
      }
      __pyx_t_18 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_22, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_21);
      __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      __pyx_t_20 = NULL;
      __pyx_t_9 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_19, function);
          __pyx_t_9 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_18, __pyx_float_255_0};
        __pyx_t_17 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_18, __pyx_float_255_0};
        __pyx_t_17 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      {
        __pyx_t_21 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        if (__pyx_t_20) {
          __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_20); __pyx_t_20 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_18);
        PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_9, __pyx_t_18);
        __Pyx_INCREF(__pyx_float_255_0);
        __Pyx_GIVEREF(__pyx_float_255_0);
        PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_9, __pyx_float_255_0);
        __pyx_t_18 = 0;
        __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_21, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      }
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_17, __pyx_n_s_astype); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_uint8); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      if (PyDict_SetItem(__pyx_t_17, __pyx_n_s_dtype, __pyx_t_21) < 0) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_empty_tuple, __pyx_t_17); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_17 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_17)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
        }
      }
      __pyx_t_2 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_16, __pyx_t_17, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_21);
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_convert); if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
        }
      }
      __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_16);
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7938, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     7939:

     7940:

     7941:

     7942: @cython.boundscheck(False)

     7943: @cython.wraparound(False)

     7944: @cython.nonecheck(False)

     7945: @cython.cdivision(True)

    +7946: cdef inline void dithering_int_c(unsigned char[:, :, :] rgb_array_, int factor_):

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_dithering_int_c(__Pyx_memviewslice __pyx_v_rgb_array_, int __pyx_v_factor_) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      unsigned char __pyx_v_new_red;
      unsigned char __pyx_v_new_green;
      unsigned char __pyx_v_new_blue;
      int __pyx_v_quantization_error_red;
      int __pyx_v_quantization_error_green;
      int __pyx_v_quantization_error_blue;
      unsigned char __pyx_v_oldr;
      unsigned char __pyx_v_oldg;
      unsigned char __pyx_v_oldb;
      float __pyx_v_c5;
      float __pyx_v_c6;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("dithering_int_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_WriteUnraisable("PygameShader.shader.dithering_int_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

     7947:

     7948:

     7949:     cdef Py_ssize_t w, h

    +7950:     w = <object> rgb_array_.shape[ 0 ] - 1

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7950, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7950, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_w = __pyx_t_3;

    +7951:     h = <object> rgb_array_.shape[ 1 ] - 1

      __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_t_2, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7951, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 7951, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_h = __pyx_t_3;

     7952:

     7953:     cdef:

    +7954:         int x=0, y=0

      __pyx_v_x = 0;
      __pyx_v_y = 0;

     7955:         unsigned char new_red, new_green, new_blue

     7956:         int quantization_error_red, quantization_error_green, quantization_error_blue

     7957:         unsigned char oldr, oldg, oldb

    +7958:         float c5 = <float>255.0 / <float>(factor_ -1)

      __pyx_v_c5 = (((float)255.0) / ((float)(__pyx_v_factor_ - 1)));

    +7959:         float c6 = <float>(factor_ -1) * ONE_255

      __pyx_v_c6 = (((float)(__pyx_v_factor_ - 1)) * 0.00392156862745098);

     7960:

     7961:

    +7962:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     7963:

    +7964:         for y in prange(1, h, schedule='static', num_threads=THREADS, chunksize=2**8):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y)            __pyx_t_6 = __Pyx_pow_long(2, 8);
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_5 = (__pyx_t_3 - 1 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_5 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_new_blue) lastprivate(__pyx_v_new_green) lastprivate(__pyx_v_new_red) lastprivate(__pyx_v_oldb) lastprivate(__pyx_v_oldg) lastprivate(__pyx_v_oldr) lastprivate(__pyx_v_quantization_error_blue) lastprivate(__pyx_v_quantization_error_green) lastprivate(__pyx_v_quantization_error_red) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static, __pyx_t_6) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_5; __pyx_t_4++){
                            {
                                __pyx_v_y = (int)(1 + 1 * __pyx_t_4);
                                /* Initialize private variables to invalid values */
                                __pyx_v_new_blue = ((unsigned char)'?');
                                __pyx_v_new_green = ((unsigned char)'?');
                                __pyx_v_new_red = ((unsigned char)'?');
                                __pyx_v_oldb = ((unsigned char)'?');
                                __pyx_v_oldg = ((unsigned char)'?');
                                __pyx_v_oldr = ((unsigned char)'?');
                                __pyx_v_quantization_error_blue = ((int)0xbad0bad0);
                                __pyx_v_quantization_error_green = ((int)0xbad0bad0);
                                __pyx_v_quantization_error_red = ((int)0xbad0bad0);
                                __pyx_v_x = ((int)0xbad0bad0);

     7965:

    +7966:             for x in range(1, w):

                                __pyx_t_7 = __pyx_v_w;
                                __pyx_t_8 = __pyx_t_7;
                                for (__pyx_t_9 = 1; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
                                  __pyx_v_x = __pyx_t_9;

     7967:

    +7968:                 oldr = rgb_array_[x, y, 0]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 0;
                                  __pyx_v_oldr = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

    +7969:                 oldg = rgb_array_[x, y, 1]

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 1;
                                  __pyx_v_oldg = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )));

    +7970:                 oldb = rgb_array_[x, y, 2]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 2;
                                  __pyx_v_oldb = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )));

     7971:

     7972:

    +7973:                 new_red = <unsigned int> (<int>nearbyint(c6 * oldr) * <int>c5)

                                  __pyx_v_new_red = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldr))) * ((int)__pyx_v_c5)));

    +7974:                 new_green = <unsigned int> (<int>nearbyint(c6 * oldg) * <int>c5)

                                  __pyx_v_new_green = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldg))) * ((int)__pyx_v_c5)));

    +7975:                 new_blue = <unsigned int> (<int>nearbyint(c6 * oldb) * <int>c5)

                                  __pyx_v_new_blue = ((unsigned int)(((int)nearbyint((__pyx_v_c6 * __pyx_v_oldb))) * ((int)__pyx_v_c5)));

     7976:

    +7977:                 rgb_array_[x, y, 0] = new_red

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_red;

    +7978:                 rgb_array_[x, y, 1] = new_green

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_green;

    +7979:                 rgb_array_[x, y, 2] = new_blue

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) )) = __pyx_v_new_blue;

     7980:

    +7981:                 quantization_error_red   = int(oldr - new_red)

                                  __pyx_v_quantization_error_red = (__pyx_v_oldr - __pyx_v_new_red);

    +7982:                 quantization_error_green = int(oldg - new_green)

                                  __pyx_v_quantization_error_green = (__pyx_v_oldg - __pyx_v_new_green);

    +7983:                 quantization_error_blue  = int(oldb - new_blue)

                                  __pyx_v_quantization_error_blue = (__pyx_v_oldb - __pyx_v_new_blue);

     7984:

    +7985:                 rgb_array_[x + 1, y, 0] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C1)));

    +7986:                     <unsigned char>(rgb_array_[x + 1, y, 0] + quantization_error_red * C1)

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 0;

    +7987:                 rgb_array_[x + 1, y, 1] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_13 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C1)));

    +7988:                     <unsigned char>(rgb_array_[x + 1, y, 1] + quantization_error_green * C1)

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_10 = 1;

    +7989:                 rgb_array_[x + 1, y, 2] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = __pyx_v_y;
                                  __pyx_t_15 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C1)));

    +7990:                     <unsigned char>(rgb_array_[x + 1, y, 2] + quantization_error_blue * C1)

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = __pyx_v_y;
                                  __pyx_t_12 = 2;

     7991:

    +7992:                 rgb_array_[x - 1, y + 1, 0] = \

                                  __pyx_t_15 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C2)));

    +7993:                     <unsigned char>(rgb_array_[x - 1, y + 1, 0] + quantization_error_red * C2)

                                  __pyx_t_12 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 0;

    +7994:                 rgb_array_[x - 1, y + 1, 1] = \

                                  __pyx_t_13 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C2)));

    +7995:                     <unsigned char>(rgb_array_[x - 1, y + 1, 1] + quantization_error_green * C2)

                                  __pyx_t_10 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 1;

    +7996:                 rgb_array_[x - 1, y + 1, 2] = \

                                  __pyx_t_15 = (__pyx_v_x - 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C2)));

    +7997:                     <unsigned char>(rgb_array_[x - 1, y + 1, 2] + quantization_error_blue * C2)

                                  __pyx_t_12 = (__pyx_v_x - 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 2;

     7998:

    +7999:                 rgb_array_[x, y + 1, 0] = \

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C3)));

    +8000:                     <unsigned char>(rgb_array_[x, y + 1, 0] + quantization_error_red * C3)

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 0;

    +8001:                 rgb_array_[x, y + 1, 1] = \

                                  __pyx_t_15 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C3)));

    +8002:                     <unsigned char>(rgb_array_[x, y + 1, 1] + quantization_error_green * C3)

                                  __pyx_t_12 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 1;

    +8003:                 rgb_array_[x, y + 1, 2] = \

                                  __pyx_t_13 = __pyx_v_x;
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C3)));

    +8004:                     <unsigned char>(rgb_array_[x, y + 1, 2] + quantization_error_blue * C3)

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 2;

     8005:

    +8006:                 rgb_array_[x + 1, y + 1, 0] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_red * __pyx_v_12PygameShader_6shader_C4)));

    +8007:                     <unsigned char>(rgb_array_[x + 1, y + 1, 0] + quantization_error_red * C4)

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 0;

    +8008:                 rgb_array_[x + 1, y + 1, 1] = \

                                  __pyx_t_13 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_15 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_13 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_15 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_10 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_12 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_green * __pyx_v_12PygameShader_6shader_C4)));

    +8009:                     <unsigned char>(rgb_array_[x + 1, y + 1, 1] + quantization_error_green * C4)

                                  __pyx_t_10 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_12 = 1;

    +8010:                 rgb_array_[x + 1, y + 1, 2] = \

                                  __pyx_t_15 = (__pyx_v_x + 1);
                                  __pyx_t_14 = (__pyx_v_y + 1);
                                  __pyx_t_13 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_15 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_14 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_13 * __pyx_v_rgb_array_.strides[2]) )) = ((unsigned char)((*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_12 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_11 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array_.strides[2]) ))) + (__pyx_v_quantization_error_blue * __pyx_v_12PygameShader_6shader_C4)));
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

    +8011:                     <unsigned char>(rgb_array_[x + 1, y + 1, 2] + quantization_error_blue * C4)

                                  __pyx_t_12 = (__pyx_v_x + 1);
                                  __pyx_t_11 = (__pyx_v_y + 1);
                                  __pyx_t_10 = 2;

     8012:

     8013:

     8014:

     8015: @cython.boundscheck(False)

     8016: @cython.wraparound(False)

     8017: @cython.nonecheck(False)

     8018: @cython.cdivision(True)

    +8019: cdef inline void convert_27colors_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_convert_27colors_c(__Pyx_memviewslice __pyx_v_rgb_array) {
      Py_ssize_t __pyx_v_w;
      CYTHON_UNUSED Py_ssize_t __pyx_v_h;
      int __pyx_v_x;
      int __pyx_v_y;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_f;
      float __pyx_v_c1;
      CYTHON_UNUSED int __pyx_v_index;
      float __pyx_v_rr;
      float __pyx_v_gg;
      float __pyx_v_bb;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("convert_27colors_c", 0);
    /* … */
      /* function exit code */
      __Pyx_RefNannyFinishContext();
    }

     8020:         unsigned char [:, :, :] rgb_array):

     8021:

     8022:     """

     8023:     THIS ALGORITHM CONVERT AN IMAGE USING 27 COLORS ONLY

     8024:

     8025:     :param rgb_array: numpy.ndarray; containing the pixels RGB. Array shape (w, h, 3)

     8026:     :return: void

     8027:     """

     8028:     cdef Py_ssize_t w, h

    +8029:     w, h = rgb_array.shape[:2]

      __pyx_t_1 = __pyx_v_rgb_array.shape;
      __pyx_t_2 = (__pyx_t_1[0]);
      __pyx_t_3 = (__pyx_t_1[1]);
      __pyx_v_w = __pyx_t_2;
      __pyx_v_h = __pyx_t_3;

     8030:

     8031:     cdef:

    +8032:         int x=0

      __pyx_v_x = 0;

    +8033:         int y=0

      __pyx_v_y = 0;

     8034:         unsigned char *r

     8035:         unsigned char *g

     8036:         unsigned char *b

    +8037:         float f = <float> 255.0 / <float> 2

      __pyx_v_f = (((float)255.0) / ((float)2));

    +8038:         float c1 = <float>2 / <float>255.0

      __pyx_v_c1 = (((float)2) / ((float)255.0));

    +8039:         int index = 0

      __pyx_v_index = 0;

     8040:         float rr, gg, bb

     8041:

    +8042:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +8043:         for y in prange(h, schedule='static', num_threads=THREADS):

            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static)
    /* … */
            __pyx_t_3 = __pyx_v_h;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_3 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_bb) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gg) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rr) lastprivate(__pyx_v_x) firstprivate(__pyx_v_y) lastprivate(__pyx_v_y) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2++){
                            {
                                __pyx_v_y = (int)(0 + 1 * __pyx_t_2);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_bb = ((float)__PYX_NAN());
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_gg = ((float)__PYX_NAN());
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_rr = ((float)__PYX_NAN());
                                __pyx_v_x = ((int)0xbad0bad0);

    +8044:             for x in range(0, w):

                                __pyx_t_5 = __pyx_v_w;
                                __pyx_t_6 = __pyx_t_5;
                                for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
                                  __pyx_v_x = __pyx_t_7;

     8045:

    +8046:                 r = &rgb_array[x, y, 0]

                                  __pyx_t_8 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_10 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

    +8047:                 g = &rgb_array[x, y, 1]

                                  __pyx_t_10 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_8 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_10 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_8 * __pyx_v_rgb_array.strides[2]) ))));

    +8048:                 b = &rgb_array[x, y, 2]

                                  __pyx_t_8 = __pyx_v_x;
                                  __pyx_t_9 = __pyx_v_y;
                                  __pyx_t_10 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_8 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[2]) ))));

     8049:

    +8050:                 rr = <float>round_c(c1 * <float> r[ 0 ] ) * f

                                  __pyx_v_rr = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_r[0]))))) * __pyx_v_f);

    +8051:                 gg = <float>round_c(c1 * <float> g[ 0 ] ) * f

                                  __pyx_v_gg = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_g[0]))))) * __pyx_v_f);

    +8052:                 bb = <float>round_c(c1 * <float> b[ 0 ] ) * f

                                  __pyx_v_bb = (((float)round((__pyx_v_c1 * ((float)(__pyx_v_b[0]))))) * __pyx_v_f);

     8053:

    +8054:                 r[ 0 ] = <unsigned char>rr

                                  (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rr);

    +8055:                 g[ 0 ] = <unsigned char>gg

                                  (__pyx_v_g[0]) = ((unsigned char)__pyx_v_gg);

    +8056:                 b[ 0 ] = <unsigned char>bb

                                  (__pyx_v_b[0]) = ((unsigned char)__pyx_v_bb);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     8057:

     8058:

     8059: @cython.binding(False)

     8060: @cython.boundscheck(False)

     8061: @cython.wraparound(False)

     8062: @cython.nonecheck(False)

     8063: @cython.cdivision(True)

    +8064: cdef object spectrum_c(int width, int height, float gamma=1.0):

    static PyObject *__pyx_f_12PygameShader_6shader_spectrum_c(int __pyx_v_width, int __pyx_v_height, struct __pyx_opt_args_12PygameShader_6shader_spectrum_c *__pyx_optional_args) {
      float __pyx_v_gamma = ((float)1.0);
      int __pyx_v_i;
      int __pyx_v_k;
      struct rgb_color_int __pyx_v_rgb_c;
      __Pyx_memviewslice __pyx_v_spectrum_array = { 0, 0, { 0 }, { 0 }, { 0 } };
      PyObject *__pyx_v_surface = 0;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("spectrum_c", 0);
      if (__pyx_optional_args) {
        if (__pyx_optional_args->__pyx_n > 0) {
          __pyx_v_gamma = __pyx_optional_args->gamma;
        }
      }
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_6);
      __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
      __Pyx_XDECREF(__pyx_t_13);
      __Pyx_AddTraceback("PygameShader.shader.spectrum_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_spectrum_array, 1);
      __Pyx_XDECREF(__pyx_v_surface);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
    struct __pyx_opt_args_12PygameShader_6shader_spectrum_c {
      int __pyx_n;
      float gamma;
    };

     8065:

     8066:     """

     8067:     CREATE A PYGAME SURFACE DISPLAYING THE LIGHT SPECTRUM 380-750 nm

     8068:

     8069:     Color   Wavelength(nm) Frequency(THz)

     8070:     Red     620-750        484-400

     8071:     Orange  590-620        508-484

     8072:     Yellow  570-590        526-508

     8073:     Green   495-570        606-526

     8074:     Blue    450-495        668-606

     8075:     Violet  380-450        789-668

     8076:

     8077:     :param width: integer; width of the image

     8078:     :param height: integer; height of the image

     8079:     :param gamma: float; gamma value

     8080:     :return: Return a pygame surface 24-bit (width, height) converted for fast

     8081:     blit

     8082:

     8083:     """

     8084:

     8085:     cdef:

     8086:         int i, j, k

     8087:         rgb_color_int rgb_c

     8088:         unsigned char [:, :, :] spectrum_array =\

    +8089:             numpy.empty((370, 1, 3), numpy.uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_uint8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_tuple__26, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_tuple__26, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8089, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_tuple__26);
        __Pyx_GIVEREF(__pyx_tuple__26);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_tuple__26);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8089, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_spectrum_array = __pyx_t_7;
      __pyx_t_7.memview = NULL;
      __pyx_t_7.data = NULL;
    /* … */
      __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_370, __pyx_int_1, __pyx_int_3); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 8089, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple__26);
      __Pyx_GIVEREF(__pyx_tuple__26);

     8090:         object surface

     8091:

    +8092:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +8093:         for i in prange(380, 750, schedule='static', num_threads=THREADS):

            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x2EE - 0x17C + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_k) lastprivate(__pyx_v_rgb_c) schedule(static)
    /* … */
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_9 = (0x2EE - 0x17C + 1 - 1/abs(1)) / 1;
                if (__pyx_t_9 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_k) lastprivate(__pyx_v_rgb_c) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_9; __pyx_t_8++){
                            {
                                __pyx_v_i = (int)(0x17C + 1 * __pyx_t_8);
                                /* Initialize private variables to invalid values */
                                __pyx_v_k = ((int)0xbad0bad0);

    +8094:             rgb_c = wavelength_to_rgb(i, gamma)

                                __pyx_v_rgb_c = wavelength_to_rgb(__pyx_v_i, __pyx_v_gamma);

    +8095:             k = i - 380

                                __pyx_v_k = (__pyx_v_i - 0x17C);

    +8096:             spectrum_array[ k, 0, 0 ] = rgb_c.r

                                __pyx_t_5 = __pyx_v_rgb_c.r;
                                __pyx_t_10 = __pyx_v_k;
                                __pyx_t_11 = 0;
                                __pyx_t_12 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

    +8097:             spectrum_array[ k, 0, 1 ] = rgb_c.g

                                __pyx_t_5 = __pyx_v_rgb_c.g;
                                __pyx_t_12 = __pyx_v_k;
                                __pyx_t_11 = 0;
                                __pyx_t_10 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

    +8098:             spectrum_array[ k, 0, 2 ] = rgb_c.b

                                __pyx_t_5 = __pyx_v_rgb_c.b;
                                __pyx_t_10 = __pyx_v_k;
                                __pyx_t_11 = 0;
                                __pyx_t_12 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

    +8099:             spectrum_array[ k, 1, 0 ] = rgb_c.r

                                __pyx_t_5 = __pyx_v_rgb_c.r;
                                __pyx_t_12 = __pyx_v_k;
                                __pyx_t_11 = 1;
                                __pyx_t_10 = 0;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

    +8100:             spectrum_array[ k, 1, 1 ] = rgb_c.g

                                __pyx_t_5 = __pyx_v_rgb_c.g;
                                __pyx_t_10 = __pyx_v_k;
                                __pyx_t_11 = 1;
                                __pyx_t_12 = 1;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_10 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_12 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;

    +8101:             spectrum_array[ k, 1, 2 ] = rgb_c.b

                                __pyx_t_5 = __pyx_v_rgb_c.b;
                                __pyx_t_12 = __pyx_v_k;
                                __pyx_t_11 = 1;
                                __pyx_t_10 = 2;
                                *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_spectrum_array.data + __pyx_t_12 * __pyx_v_spectrum_array.strides[0]) ) + __pyx_t_11 * __pyx_v_spectrum_array.strides[1]) ) + __pyx_t_10 * __pyx_v_spectrum_array.strides[2]) )) = __pyx_t_5;
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     8102:

    +8103:     surface = make_surface(asarray(spectrum_array))

      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_make_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_spectrum_array, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8103, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_surface = __pyx_t_1;
      __pyx_t_1 = 0;

    +8104:     surface = scale(surface, (width, height)).convert()

      __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_scale); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2);
      __pyx_t_4 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      __pyx_t_5 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surface, __pyx_t_13};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_surface, __pyx_t_13};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_surface);
        __Pyx_GIVEREF(__pyx_v_surface);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_surface);
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8104, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_convert); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8104, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF_SET(__pyx_v_surface, __pyx_t_1);
      __pyx_t_1 = 0;

    +8105:     return surface

      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_surface);
      __pyx_r = __pyx_v_surface;
      goto __pyx_L0;

     8106:

     8107:

     8108:

     8109:

     8110: @cython.binding(False)

     8111: @cython.boundscheck(False)

     8112: @cython.wraparound(False)

     8113: @cython.nonecheck(False)

     8114: @cython.cdivision(True)

    +8115: cdef inline void palette_change_c(

    static CYTHON_INLINE void __pyx_f_12PygameShader_6shader_palette_change_c(__Pyx_memviewslice __pyx_v_rgb_array, __Pyx_memviewslice __pyx_v_palette_) {
      int __pyx_v_i;
      int __pyx_v_j;
      CYTHON_UNUSED Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      struct rgb __pyx_v_rgb_;
      struct rgb __pyx_v_rgb_c;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      Py_ssize_t __pyx_v_p_length;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("palette_change_c", 0);
    /* … */
      /* function exit code */
      goto __pyx_L0;
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_WriteUnraisable("PygameShader.shader.palette_change_c", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
      __pyx_L0:;
      __Pyx_RefNannyFinishContext();
    }

     8116:         unsigned char [:, :, :] rgb_array,

     8117:         float [:, :] palette_):

     8118:

     8119:

     8120:     cdef:

     8121:         int i, j

    +8122:         Py_ssize_t w = <object>rgb_array.shape[0]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8122, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8122, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_w = __pyx_t_2;

    +8123:         Py_ssize_t h = <object>rgb_array.shape[1]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8123, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8123, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_h = __pyx_t_2;

     8124:         rgb rgb_

     8125:         rgb rgb_c

     8126:         unsigned char *r

     8127:         unsigned char *g

     8128:         unsigned char *b

    +8129:         Py_ssize_t p_length = <object>palette_.shape[0]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_palette_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8129, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_p_length = __pyx_t_2;

     8130:

    +8131:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

    +8132:         for i in prange(w, schedule='static', num_threads=THREADS, chunksize=w * h):

            __pyx_t_2 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_)            __pyx_t_5 = (__pyx_v_w * __pyx_v_h);
    /* … */
            __pyx_t_2 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_4 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_4 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) firstprivate(__pyx_v_i) lastprivate(__pyx_v_i) lastprivate(__pyx_v_j) lastprivate(__pyx_v_r) lastprivate(__pyx_v_rgb_) schedule(static, __pyx_t_5) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_4; __pyx_t_3++){
                            {
                                __pyx_v_i = (int)(0 + 1 * __pyx_t_3);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_j = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);

    +8133:             for j in range(h):

                                __pyx_t_6 = __pyx_v_h;
                                __pyx_t_7 = __pyx_t_6;
                                for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
                                  __pyx_v_j = __pyx_t_8;

    +8134:                 r = &rgb_array[i, j, 0]

                                  __pyx_t_9 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_11 = 0;
                                  __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_9 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array.strides[2]) ))));

    +8135:                 g = &rgb_array[i, j, 1]

                                  __pyx_t_11 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_9 = 1;
                                  __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_11 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_9 * __pyx_v_rgb_array.strides[2]) ))));

    +8136:                 b = &rgb_array[i, j, 2]

                                  __pyx_t_9 = __pyx_v_i;
                                  __pyx_t_10 = __pyx_v_j;
                                  __pyx_t_11 = 2;
                                  __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array.data + __pyx_t_9 * __pyx_v_rgb_array.strides[0]) ) + __pyx_t_10 * __pyx_v_rgb_array.strides[1]) ) + __pyx_t_11 * __pyx_v_rgb_array.strides[2]) ))));

     8137:

    +8138:                 rgb_c.r = r[0]

                                  __pyx_v_rgb_c.r = (__pyx_v_r[0]);

    +8139:                 rgb_c.g = g[0]

                                  __pyx_v_rgb_c.g = (__pyx_v_g[0]);

    +8140:                 rgb_c.b = b[0]

                                  __pyx_v_rgb_c.b = (__pyx_v_b[0]);

     8141:

    +8142:                 rgb_ = close_color(rgb_c, palette_, p_length)

                                  __pyx_v_rgb_ = __pyx_f_12PygameShader_4misc_close_color(__pyx_v_rgb_c, __pyx_v_palette_, __pyx_v_p_length);

     8143:

    +8144:                 r[0] = <unsigned char>rgb_.r

                                  (__pyx_v_r[0]) = ((unsigned char)__pyx_v_rgb_.r);

    +8145:                 g[0] = <unsigned char>rgb_.g

                                  (__pyx_v_g[0]) = ((unsigned char)__pyx_v_rgb_.g);

    +8146:                 b[0] = <unsigned char>rgb_.b

                                  (__pyx_v_b[0]) = ((unsigned char)__pyx_v_rgb_.b);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     8147:

     8148:

     8149:

     8150:

     8151: @cython.boundscheck(False)

     8152: @cython.wraparound(False)

     8153: @cython.nonecheck(False)

     8154: @cython.cdivision(True)

    +8155: cdef float distance_ (float x1, float y1, float x2, float y2)nogil:

    static float __pyx_f_12PygameShader_6shader_distance_(float __pyx_v_x1, float __pyx_v_y1, float __pyx_v_x2, float __pyx_v_y2) {
      float __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }

    +8156:   return <float>sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));

      __pyx_r = ((float)sqrt((((__pyx_v_x1 - __pyx_v_x2) * (__pyx_v_x1 - __pyx_v_x2)) + ((__pyx_v_y1 - __pyx_v_y2) * (__pyx_v_y1 - __pyx_v_y2)))));
      goto __pyx_L0;

     8157:

     8158: @cython.boundscheck(False)

     8159: @cython.wraparound(False)

     8160: @cython.nonecheck(False)

     8161: @cython.cdivision(True)

    +8162: cdef float gaussian_ (float v, float sigma2)nogil:

    static float __pyx_f_12PygameShader_6shader_gaussian_(float __pyx_v_v, float __pyx_v_sigma2) {
      float __pyx_r;
    /* … */
      /* function exit code */
      __pyx_L0:;
      return __pyx_r;
    }

    +8163:   return (<float>1.0 / (<float>M_PI * sigma2)) * <float>exp(-(v * v ) / sigma2)

      __pyx_r = ((((float)1.0) / (((float)__pyx_v_12PygameShader_6shader_M_PI) * __pyx_v_sigma2)) * ((float)exp(((-(__pyx_v_v * __pyx_v_v)) / __pyx_v_sigma2))));
      goto __pyx_L0;

     8164:

     8165: @cython.boundscheck(False)

     8166: @cython.wraparound(False)

     8167: @cython.nonecheck(False)

     8168: @cython.cdivision(True)

    +8169: cdef bilateral_filter24_c(

    static PyObject *__pyx_f_12PygameShader_6shader_bilateral_filter24_c(__Pyx_memviewslice __pyx_v_rgb_array_, float __pyx_v_sigma_s_, float __pyx_v_sigma_i_) {
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_bilateral = { 0, 0, { 0 }, { 0 }, { 0 } };
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_xx;
      int __pyx_v_yy;
      int __pyx_v_k;
      int __pyx_v_kx;
      int __pyx_v_ky;
      float __pyx_v_gs;
      float __pyx_v_wr;
      float __pyx_v_wg;
      float __pyx_v_wb;
      float __pyx_v_ir;
      float __pyx_v_ig;
      float __pyx_v_ib;
      float __pyx_v_wpr;
      float __pyx_v_wpg;
      float __pyx_v_wpb;
      unsigned char *__pyx_v_r;
      unsigned char *__pyx_v_g;
      unsigned char *__pyx_v_b;
      float __pyx_v_sigma_i2;
      float __pyx_v_sigma_s2;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("bilateral_filter24_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __Pyx_XDECREF(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
      __Pyx_XDECREF(__pyx_t_25);
      __Pyx_XDECREF(__pyx_t_26);
      __Pyx_AddTraceback("PygameShader.shader.bilateral_filter24_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __PYX_XDEC_MEMVIEW(&__pyx_v_bilateral, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     8170:         unsigned char [:, :, :] rgb_array_,

     8171:         float sigma_s_,

     8172:         float sigma_i_

     8173: ):

     8174:     """

     8175:     A bilateral filter is a non-linear, edge-preserving, and noise-reducing

     8176:     smoothing filter for images. It replaces the intensity of each pixel with a

     8177:     weighted average of intensity values from nearby pixels. This weight can be

     8178:     based on a Gaussian distribution.

     8179:

     8180:     Here, the normalization factor and the range weight are new terms added to

     8181:     the previous equation. sigma_s  denotes the spatial extent of the kernel, i.e.

     8182:     the size of the neighborhood, and sigma_r  denotes the minimum amplitude of an edge.

     8183:     It ensures that only those pixels with intensity values similar to that of the

     8184:     central pixel are considered for blurring, while sharp intensity changes are maintained.

     8185:     The smaller the value of sigma_r  , the sharper the edge. As sigma_r  tends to infinity,

     8186:     the equation tends to a Gaussian blur.

     8187:

     8188:     :param rgb_array_: Surface, 24-32 bit format (alpha channel will be ignored)

     8189:

     8190:     :param sigma_s_: float sigma_s : Spatial extent of the kernel, size of the

     8191:     considered neighborhood

     8192:

     8193:     :param sigma_i_: float sigma_i (also call sigma_r) range kernel, minimum amplitude of an edge.

     8194:

     8195:     :return: return a filtered Surface

     8196:     """

     8197:

     8198:     cdef Py_ssize_t w, h

    +8199:     w = <object>rgb_array_.shape[ 0 ]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8199, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_w = __pyx_t_2;

    +8200:     h = <object> rgb_array_.shape[ 1 ]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8200, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_h = __pyx_t_2;

     8201:

     8202:     cdef:

    +8203:         unsigned char [:, :, :] bilateral = empty((h, w, 3), dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 8203, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_bilateral = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;

     8204:         int x, y, xx, yy

    +8205:         int k = 3

      __pyx_v_k = 3;

     8206:         int kx, ky

     8207:         float gs, wr, wg, wb, ir, ig, ib , wpr, wpg, wpb

     8208:         unsigned char *r

     8209:         unsigned char *g

     8210:         unsigned char *b

    +8211:         float sigma_i2 = 2 * sigma_i_ * sigma_i_

      __pyx_v_sigma_i2 = ((2.0 * __pyx_v_sigma_i_) * __pyx_v_sigma_i_);

    +8212:         float sigma_s2 = 2 * sigma_s_ * sigma_s_

      __pyx_v_sigma_s2 = ((2.0 * __pyx_v_sigma_s_) * __pyx_v_sigma_s_);

     8213:

    +8214:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     8215:

    +8216:         for x in prange(0, w, schedule='static', num_threads=THREADS):

            __pyx_t_2 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_8 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_8 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gs) lastprivate(__pyx_v_ib) lastprivate(__pyx_v_ig) lastprivate(__pyx_v_ir) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_r) lastprivate(__pyx_v_wb) lastprivate(__pyx_v_wg) lastprivate(__pyx_v_wpb) lastprivate(__pyx_v_wpg) lastprivate(__pyx_v_wpr) lastprivate(__pyx_v_wr) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_2 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_8 = (__pyx_t_2 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_8 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_g) lastprivate(__pyx_v_gs) lastprivate(__pyx_v_ib) lastprivate(__pyx_v_ig) lastprivate(__pyx_v_ir) lastprivate(__pyx_v_kx) lastprivate(__pyx_v_ky) lastprivate(__pyx_v_r) lastprivate(__pyx_v_wb) lastprivate(__pyx_v_wg) lastprivate(__pyx_v_wpb) lastprivate(__pyx_v_wpg) lastprivate(__pyx_v_wpr) lastprivate(__pyx_v_wr) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_8; __pyx_t_7++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_7);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((unsigned char *)1);
                                __pyx_v_g = ((unsigned char *)1);
                                __pyx_v_gs = ((float)__PYX_NAN());
                                __pyx_v_ib = ((float)__PYX_NAN());
                                __pyx_v_ig = ((float)__PYX_NAN());
                                __pyx_v_ir = ((float)__PYX_NAN());
                                __pyx_v_kx = ((int)0xbad0bad0);
                                __pyx_v_ky = ((int)0xbad0bad0);
                                __pyx_v_r = ((unsigned char *)1);
                                __pyx_v_wb = ((float)__PYX_NAN());
                                __pyx_v_wg = ((float)__PYX_NAN());
                                __pyx_v_wpb = ((float)__PYX_NAN());
                                __pyx_v_wpg = ((float)__PYX_NAN());
                                __pyx_v_wpr = ((float)__PYX_NAN());
                                __pyx_v_wr = ((float)__PYX_NAN());
                                __pyx_v_xx = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_yy = ((int)0xbad0bad0);

    +8217:             for y in range(0, h):

                                __pyx_t_9 = __pyx_v_h;
                                __pyx_t_10 = __pyx_t_9;
                                for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
                                  __pyx_v_y = __pyx_t_11;

     8218:

    +8219:                 ir, ig, ib = 0, 0, 0

                                  __pyx_t_12 = 0.0;
                                  __pyx_t_13 = 0.0;
                                  __pyx_t_14 = 0.0;
                                  __pyx_v_ir = __pyx_t_12;
                                  __pyx_v_ig = __pyx_t_13;
                                  __pyx_v_ib = __pyx_t_14;

    +8220:                 wpr, wpg, wpb = 0, 0, 0

                                  __pyx_t_14 = 0.0;
                                  __pyx_t_13 = 0.0;
                                  __pyx_t_12 = 0.0;
                                  __pyx_v_wpr = __pyx_t_14;
                                  __pyx_v_wpg = __pyx_t_13;
                                  __pyx_v_wpb = __pyx_t_12;

     8221:

    +8222:                 for ky in range(-k, k + 1):

                                  __pyx_t_15 = (__pyx_v_k + 1);
                                  __pyx_t_16 = __pyx_t_15;
                                  for (__pyx_t_17 = (-__pyx_v_k); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
                                    __pyx_v_ky = __pyx_t_17;

    +8223:                     for kx in range(-k, k + 1):

                                    __pyx_t_18 = (__pyx_v_k + 1);
                                    __pyx_t_19 = __pyx_t_18;
                                    for (__pyx_t_20 = (-__pyx_v_k); __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
                                      __pyx_v_kx = __pyx_t_20;

     8224:

    +8225:                         xx = x + kx

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kx);

    +8226:                         yy = y + ky

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_ky);

     8227:

    +8228:                         if xx < 0:

                                      __pyx_t_21 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +8229:                             xx = 0

                                        __pyx_v_xx = 0;

    +8230:                         elif xx > w:

                                      __pyx_t_21 = ((__pyx_v_xx > __pyx_v_w) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }
                                      __pyx_L16:;

    +8231:                             xx = w

                                        __pyx_v_xx = __pyx_v_w;

     8232:

    +8233:                         if yy < 0:

                                      __pyx_t_21 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +8234:                             yy = 0

                                        __pyx_v_yy = 0;

    +8235:                         elif yy > h:

                                      __pyx_t_21 = ((__pyx_v_yy > __pyx_v_h) != 0);
                                      if (__pyx_t_21) {
    /* … */
                                      }
                                      __pyx_L17:;

    +8236:                             yy = h

                                        __pyx_v_yy = __pyx_v_h;

     8237:

    +8238:                         gs = gaussian_(distance_(xx, yy, x, y), sigma_s2)

                                      __pyx_v_gs = __pyx_f_12PygameShader_6shader_gaussian_(__pyx_f_12PygameShader_6shader_distance_(__pyx_v_xx, __pyx_v_yy, __pyx_v_x, __pyx_v_y), __pyx_v_sigma_s2);

     8239:

    +8240:                         r = &rgb_array_[xx, yy, 0]

                                      __pyx_t_22 = __pyx_v_xx;
                                      __pyx_t_23 = __pyx_v_yy;
                                      __pyx_t_24 = 0;
                                      __pyx_v_r = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) ))));

    +8241:                         g = &rgb_array_[xx, yy, 1]

                                      __pyx_t_24 = __pyx_v_xx;
                                      __pyx_t_23 = __pyx_v_yy;
                                      __pyx_t_22 = 1;
                                      __pyx_v_g = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) ))));

    +8242:                         b = &rgb_array_[xx, yy, 2]

                                      __pyx_t_22 = __pyx_v_xx;
                                      __pyx_t_23 = __pyx_v_yy;
                                      __pyx_t_24 = 2;
                                      __pyx_v_b = (&(*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) ))));

     8243:

    +8244:                         wr = gaussian_(r[0] - rgb_array_[x, y, 0], sigma_i2) * gs

                                      __pyx_t_24 = __pyx_v_x;
                                      __pyx_t_23 = __pyx_v_y;
                                      __pyx_t_22 = 0;
                                      __pyx_v_wr = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_r[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

    +8245:                         wg = gaussian_(g[0] - rgb_array_[x, y, 1], sigma_i2) * gs

                                      __pyx_t_22 = __pyx_v_x;
                                      __pyx_t_23 = __pyx_v_y;
                                      __pyx_t_24 = 1;
                                      __pyx_v_wg = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_g[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_22 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

    +8246:                         wb = gaussian_(b[0] - rgb_array_[x, y, 2], sigma_i2) * gs

                                      __pyx_t_24 = __pyx_v_x;
                                      __pyx_t_23 = __pyx_v_y;
                                      __pyx_t_22 = 2;
                                      __pyx_v_wb = (__pyx_f_12PygameShader_6shader_gaussian_(((__pyx_v_b[0]) - (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_24 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_22 * __pyx_v_rgb_array_.strides[2]) )))), __pyx_v_sigma_i2) * __pyx_v_gs);

     8247:

    +8248:                         ir = ir + r[0] * wr

                                      __pyx_v_ir = (__pyx_v_ir + ((__pyx_v_r[0]) * __pyx_v_wr));

    +8249:                         ig = ig + g[0] * wg

                                      __pyx_v_ig = (__pyx_v_ig + ((__pyx_v_g[0]) * __pyx_v_wg));

    +8250:                         ib = ib + b[0] * wb

                                      __pyx_v_ib = (__pyx_v_ib + ((__pyx_v_b[0]) * __pyx_v_wb));

     8251:

    +8252:                         wpr = wpr + wr

                                      __pyx_v_wpr = (__pyx_v_wpr + __pyx_v_wr);

    +8253:                         wpg = wpg + wg

                                      __pyx_v_wpg = (__pyx_v_wpg + __pyx_v_wg);

    +8254:                         wpb = wpb + wb

                                      __pyx_v_wpb = (__pyx_v_wpb + __pyx_v_wb);
                                    }
                                  }

     8255:

    +8256:                 ir = ir / wpr

                                  __pyx_v_ir = (__pyx_v_ir / __pyx_v_wpr);

    +8257:                 ig = ig / wpg

                                  __pyx_v_ig = (__pyx_v_ig / __pyx_v_wpg);

    +8258:                 ib = ib / wpb

                                  __pyx_v_ib = (__pyx_v_ib / __pyx_v_wpb);

     8259:

    +8260:                 bilateral[y, x, 0] = <int>ir

                                  __pyx_t_22 = __pyx_v_y;
                                  __pyx_t_23 = __pyx_v_x;
                                  __pyx_t_24 = 0;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_22 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_24 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ir);

    +8261:                 bilateral[y, x, 1] = <int>ig

                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_23 = __pyx_v_x;
                                  __pyx_t_22 = 1;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_24 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_22 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ig);

    +8262:                 bilateral[y, x, 2] = <int>ib

                                  __pyx_t_22 = __pyx_v_y;
                                  __pyx_t_23 = __pyx_v_x;
                                  __pyx_t_24 = 2;
                                  *((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_bilateral.data + __pyx_t_22 * __pyx_v_bilateral.strides[0]) ) + __pyx_t_23 * __pyx_v_bilateral.strides[1]) ) + __pyx_t_24 * __pyx_v_bilateral.strides[2]) )) = ((int)__pyx_v_ib);
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     8263:

     8264:

    +8265:     return frombuffer(bilateral, (w, h), 'RGB')

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 8265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_bilateral, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_25 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_25)) __PYX_ERR(1, 8265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_26 = PyTuple_New(2); if (unlikely(!__pyx_t_26)) __PYX_ERR(1, 8265, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_26);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_26, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_25);
      PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_25);
      __pyx_t_1 = 0;
      __pyx_t_25 = 0;
      __pyx_t_25 = NULL;
      __pyx_t_11 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_25)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_25);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_11 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_4, __pyx_t_26, __pyx_n_s_RGB};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[4] = {__pyx_t_25, __pyx_t_4, __pyx_t_26, __pyx_n_s_RGB};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_25) {
          __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_25); __pyx_t_25 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_11, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_26);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_11, __pyx_t_26);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_11, __pyx_n_s_RGB);
        __pyx_t_4 = 0;
        __pyx_t_26 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8265, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     8266:

     8267:

     8268:

     8269:

     8270: EMBOSS_KERNEL = \

    +8271:     numpy.array((

      __Pyx_GetModuleGlobalName(__pyx_t_32, __pyx_n_s_numpy); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 8271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_32, __pyx_n_s_array_2); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 8271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_DECREF(__pyx_t_32); __pyx_t_32 = 0;
    /* … */
      __pyx_t_29 = __Pyx_PyObject_CallOneArg(__pyx_t_31, __pyx_t_28); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8271, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;

    +8272:         [-1, -1, -1, -1, 0],

      __pyx_t_32 = PyList_New(5); if (unlikely(!__pyx_t_32)) __PYX_ERR(1, 8272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_32);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_32, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_32, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_32, 2, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_32, 3, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_32, 4, __pyx_int_0);
    /* … */
      __pyx_t_28 = PyTuple_New(5); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 8272, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_28);
      __Pyx_GIVEREF(__pyx_t_32);
      PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_32);
      __Pyx_GIVEREF(__pyx_t_30);
      PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_28, 3, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_29);
      PyTuple_SET_ITEM(__pyx_t_28, 4, __pyx_t_29);
      __pyx_t_32 = 0;
      __pyx_t_30 = 0;
      __pyx_t_33 = 0;
      __pyx_t_2 = 0;
      __pyx_t_29 = 0;

    +8273:         [-1, -1, -1, 0,  1],

      __pyx_t_30 = PyList_New(5); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 8273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_30, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_30, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_30, 2, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_30, 3, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_30, 4, __pyx_int_1);

    +8274:         [-1, -1,  0, 1,  1],

      __pyx_t_33 = PyList_New(5); if (unlikely(!__pyx_t_33)) __PYX_ERR(1, 8274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_33, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_33, 1, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_33, 2, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_33, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_33, 4, __pyx_int_1);

    +8275:         [-1,  0,  1, 1,  1],

      __pyx_t_2 = PyList_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8275, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_neg_1);
      __Pyx_GIVEREF(__pyx_int_neg_1);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_int_neg_1);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_2, 4, __pyx_int_1);

    +8276:         [ 0,  1,  1, 1,  1])).astype(dtype=numpy.float32, order='C')

      __pyx_t_29 = PyList_New(5); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyList_SET_ITEM(__pyx_t_29, 0, __pyx_int_0);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_29, 1, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_29, 2, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_29, 3, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_29, 4, __pyx_int_1);
    /* … */
      __pyx_t_28 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s_astype); if (unlikely(!__pyx_t_28)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_28);
      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
      __pyx_t_29 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __Pyx_GetModuleGlobalName(__pyx_t_31, __pyx_n_s_numpy); if (unlikely(!__pyx_t_31)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_float32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      if (PyDict_SetItem(__pyx_t_29, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PyDict_SetItem(__pyx_t_29, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 8276, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_28, __pyx_empty_tuple, __pyx_t_29); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0;
      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_EMBOSS_KERNEL, __pyx_t_2) < 0) __PYX_ERR(1, 8270, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

     8277:

     8278: @cython.boundscheck(False)

     8279: @cython.wraparound(False)

     8280: @cython.nonecheck(False)

     8281: @cython.cdivision(True)

    +8282: cdef object emboss5x5_c(unsigned char [:, :, :] rgb_array_):

    static PyObject *__pyx_f_12PygameShader_6shader_emboss5x5_c(__Pyx_memviewslice __pyx_v_rgb_array_) {
      PyObject *__pyx_v_k_weight = NULL;
      Py_ssize_t __pyx_v_k_length;
      Py_ssize_t __pyx_v_half_kernel;
      Py_ssize_t __pyx_v_w;
      Py_ssize_t __pyx_v_h;
      __Pyx_memviewslice __pyx_v_kernel = { 0, 0, { 0 }, { 0 }, { 0 } };
      CYTHON_UNUSED float __pyx_v_kernel_weight;
      short __pyx_v_kernel_half;
      __Pyx_memviewslice __pyx_v_emboss = { 0, 0, { 0 }, { 0 }, { 0 } };
      CYTHON_UNUSED int __pyx_v_kernel_length;
      int __pyx_v_x;
      int __pyx_v_y;
      int __pyx_v_xx;
      int __pyx_v_yy;
      unsigned short __pyx_v_red;
      unsigned short __pyx_v_green;
      unsigned short __pyx_v_blue;
      short __pyx_v_kernel_offset_y;
      short __pyx_v_kernel_offset_x;
      float __pyx_v_r;
      float __pyx_v_g;
      float __pyx_v_b;
      float __pyx_v_k;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("emboss5x5_c", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_XDECREF(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_4);
      __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
      __Pyx_XDECREF(__pyx_t_29);
      __Pyx_XDECREF(__pyx_t_30);
      __Pyx_AddTraceback("PygameShader.shader.emboss5x5_c", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = 0;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_k_weight);
      __PYX_XDEC_MEMVIEW(&__pyx_v_kernel, 1);
      __PYX_XDEC_MEMVIEW(&__pyx_v_emboss, 1);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

     8283:

    +8284:     k_weight = numpy.sum(EMBOSS_KERNEL)

      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8284, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_k_weight = __pyx_t_1;
      __pyx_t_1 = 0;

    +8285:     k_length = len(EMBOSS_KERNEL)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 8285, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_k_length = __pyx_t_5;

    +8286:     half_kernel = len(EMBOSS_KERNEL) >> 1

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 8286, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_half_kernel = (__pyx_t_5 >> 1);

     8287:

     8288:     # texture sizes

     8289:     cdef Py_ssize_t w, h

    +8290:     w = <object>rgb_array_.shape[0]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[0])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_w = __pyx_t_5;

    +8291:     h = <object>rgb_array_.shape[1]

      __pyx_t_1 = PyInt_FromSsize_t((__pyx_v_rgb_array_.shape[1])); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 8291, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_h = __pyx_t_5;

     8292:

     8293:     cdef:

    +8294:         float [:, :] kernel = EMBOSS_KERNEL

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_EMBOSS_KERNEL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(1, 8294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_kernel = __pyx_t_6;
      __pyx_t_6.memview = NULL;
      __pyx_t_6.data = NULL;

    +8295:         float kernel_weight = k_weight

      __pyx_t_7 = __pyx_PyFloat_AsFloat(__pyx_v_k_weight); if (unlikely((__pyx_t_7 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 8295, __pyx_L1_error)
      __pyx_v_kernel_weight = __pyx_t_7;

    +8296:         short kernel_half = half_kernel

      __pyx_v_kernel_half = __pyx_v_half_kernel;

    +8297:         unsigned char [:, :, ::1] emboss = empty((h, w, 3), order='C', dtype=uint8)

      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_order, __pyx_n_s_C) < 0) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(1, 8297, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_emboss = __pyx_t_8;
      __pyx_t_8.memview = NULL;
      __pyx_t_8.data = NULL;

    +8298:         int kernel_length = k_length

      __pyx_v_kernel_length = __pyx_v_k_length;

     8299:         int x, y, xx, yy

     8300:         unsigned short red, green, blue,

     8301:         short kernel_offset_y, kernel_offset_x

     8302:         float r, g, b, k

     8303:

    +8304:     with nogil:

      {
          #ifdef WITH_THREAD
          PyThreadState *_save;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          #endif
          /*try:*/ {
    /* … */
          /*finally:*/ {
            /*normal exit:*/{
              #ifdef WITH_THREAD
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              #endif
              goto __pyx_L5;
            }
            __pyx_L5:;
          }
      }

     8305:

    +8306:         for x in prange(0, w, schedule='static', num_threads=THREADS):

            __pyx_t_5 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static)
    /* … */
            __pyx_t_5 = __pyx_v_w;
            if ((1 == 0)) abort();
            {
                #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                    #undef likely
                    #undef unlikely
                    #define likely(x)   (x)
                    #define unlikely(x) (x)
                #endif
                __pyx_t_10 = (__pyx_t_5 - 0 + 1 - 1/abs(1)) / 1;
                if (__pyx_t_10 > 0)
                {
                    #ifdef _OPENMP
                    #pragma omp parallel
                    #endif /* _OPENMP */
                    {
                        #ifdef _OPENMP
                        #pragma omp for lastprivate(__pyx_v_b) lastprivate(__pyx_v_blue) lastprivate(__pyx_v_g) lastprivate(__pyx_v_green) lastprivate(__pyx_v_k) lastprivate(__pyx_v_kernel_offset_x) lastprivate(__pyx_v_kernel_offset_y) lastprivate(__pyx_v_r) lastprivate(__pyx_v_red) firstprivate(__pyx_v_x) lastprivate(__pyx_v_x) lastprivate(__pyx_v_xx) lastprivate(__pyx_v_y) lastprivate(__pyx_v_yy) schedule(static) num_threads(__pyx_v_12PygameShader_6shader_THREADS)
                        #endif /* _OPENMP */
                        for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_10; __pyx_t_9++){
                            {
                                __pyx_v_x = (int)(0 + 1 * __pyx_t_9);
                                /* Initialize private variables to invalid values */
                                __pyx_v_b = ((float)__PYX_NAN());
                                __pyx_v_blue = ((unsigned short)0xbad0bad0);
                                __pyx_v_g = ((float)__PYX_NAN());
                                __pyx_v_green = ((unsigned short)0xbad0bad0);
                                __pyx_v_k = ((float)__PYX_NAN());
                                __pyx_v_kernel_offset_x = ((short)0xbad0bad0);
                                __pyx_v_kernel_offset_y = ((short)0xbad0bad0);
                                __pyx_v_r = ((float)__PYX_NAN());
                                __pyx_v_red = ((unsigned short)0xbad0bad0);
                                __pyx_v_xx = ((int)0xbad0bad0);
                                __pyx_v_y = ((int)0xbad0bad0);
                                __pyx_v_yy = ((int)0xbad0bad0);

     8307:

    +8308:             for y in range(0, h):

                                __pyx_t_11 = __pyx_v_h;
                                __pyx_t_12 = __pyx_t_11;
                                for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
                                  __pyx_v_y = __pyx_t_13;

     8309:

    +8310:                 r, g, b = 0, 0, 0

                                  __pyx_t_7 = 0.0;
                                  __pyx_t_14 = 0.0;
                                  __pyx_t_15 = 0.0;
                                  __pyx_v_r = __pyx_t_7;
                                  __pyx_v_g = __pyx_t_14;
                                  __pyx_v_b = __pyx_t_15;

     8311:

    +8312:                 for kernel_offset_y in range(-kernel_half, kernel_half + 1):

                                  __pyx_t_16 = (__pyx_v_kernel_half + 1);
                                  __pyx_t_17 = __pyx_t_16;
                                  for (__pyx_t_18 = (-__pyx_v_kernel_half); __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
                                    __pyx_v_kernel_offset_y = __pyx_t_18;

     8313:

    +8314:                     for kernel_offset_x in range(-kernel_half, kernel_half + 1):

                                    __pyx_t_19 = (__pyx_v_kernel_half + 1);
                                    __pyx_t_20 = __pyx_t_19;
                                    for (__pyx_t_21 = (-__pyx_v_kernel_half); __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
                                      __pyx_v_kernel_offset_x = __pyx_t_21;

     8315:

    +8316:                         xx = x + kernel_offset_x

                                      __pyx_v_xx = (__pyx_v_x + __pyx_v_kernel_offset_x);

    +8317:                         yy = y + kernel_offset_y

                                      __pyx_v_yy = (__pyx_v_y + __pyx_v_kernel_offset_y);

     8318:

    +8319:                         if xx < 0:

                                      __pyx_t_22 = ((__pyx_v_xx < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L16;
                                      }

    +8320:                             xx = 0

                                        __pyx_v_xx = 0;

    +8321:                         elif xx > w:

                                      __pyx_t_22 = ((__pyx_v_xx > __pyx_v_w) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L16:;

    +8322:                             xx = w

                                        __pyx_v_xx = __pyx_v_w;

     8323:

    +8324:                         if yy < 0:

                                      __pyx_t_22 = ((__pyx_v_yy < 0) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                        goto __pyx_L17;
                                      }

    +8325:                             yy = 0

                                        __pyx_v_yy = 0;

    +8326:                         elif yy > h:

                                      __pyx_t_22 = ((__pyx_v_yy > __pyx_v_h) != 0);
                                      if (__pyx_t_22) {
    /* … */
                                      }
                                      __pyx_L17:;

    +8327:                             yy = h

                                        __pyx_v_yy = __pyx_v_h;

     8328:

     8329:

     8330:                         red, green, blue = \

    +8331:                             rgb_array_[xx, yy, 0], \

                                      __pyx_t_23 = __pyx_v_xx;
                                      __pyx_t_24 = __pyx_v_yy;
                                      __pyx_t_25 = 0;
                                      __pyx_t_26 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )));

    +8332:                             rgb_array_[xx, yy, 1],\

                                      __pyx_t_25 = __pyx_v_xx;
                                      __pyx_t_24 = __pyx_v_yy;
                                      __pyx_t_23 = 1;
                                      __pyx_t_27 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_25 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_23 * __pyx_v_rgb_array_.strides[2]) )));

    +8333:                             rgb_array_[xx, yy, 2]

                                      __pyx_t_23 = __pyx_v_xx;
                                      __pyx_t_24 = __pyx_v_yy;
                                      __pyx_t_25 = 2;
                                      __pyx_t_28 = (*((unsigned char *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_rgb_array_.data + __pyx_t_23 * __pyx_v_rgb_array_.strides[0]) ) + __pyx_t_24 * __pyx_v_rgb_array_.strides[1]) ) + __pyx_t_25 * __pyx_v_rgb_array_.strides[2]) )));
                                      __pyx_v_red = __pyx_t_26;
                                      __pyx_v_green = __pyx_t_27;
                                      __pyx_v_blue = __pyx_t_28;

     8334:

    +8335:                         k = kernel[kernel_offset_y + kernel_half, kernel_offset_x + kernel_half]

                                      __pyx_t_25 = (__pyx_v_kernel_offset_y + __pyx_v_kernel_half);
                                      __pyx_t_24 = (__pyx_v_kernel_offset_x + __pyx_v_kernel_half);
                                      __pyx_v_k = (*((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_kernel.data + __pyx_t_25 * __pyx_v_kernel.strides[0]) ) + __pyx_t_24 * __pyx_v_kernel.strides[1]) )));

    +8336:                         r = r + red * k

                                      __pyx_v_r = (__pyx_v_r + (__pyx_v_red * __pyx_v_k));

    +8337:                         g = g + green * k

                                      __pyx_v_g = (__pyx_v_g + (__pyx_v_green * __pyx_v_k));

    +8338:                         b = b + blue * k

                                      __pyx_v_b = (__pyx_v_b + (__pyx_v_blue * __pyx_v_k));
                                    }
                                  }

     8339:

    +8340:                 if r < 0:

                                  __pyx_t_22 = ((__pyx_v_r < 0.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8341:                     r = 0

                                    __pyx_v_r = 0.0;

    +8342:                 if g < 0:

                                  __pyx_t_22 = ((__pyx_v_g < 0.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8343:                     g = 0

                                    __pyx_v_g = 0.0;

    +8344:                 if b < 0:

                                  __pyx_t_22 = ((__pyx_v_b < 0.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8345:                     b = 0

                                    __pyx_v_b = 0.0;

    +8346:                 if r > 255:

                                  __pyx_t_22 = ((__pyx_v_r > 255.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8347:                     r= 255

                                    __pyx_v_r = 255.0;

    +8348:                 if g > 255:

                                  __pyx_t_22 = ((__pyx_v_g > 255.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8349:                     g = 255

                                    __pyx_v_g = 255.0;

    +8350:                 if b > 255:

                                  __pyx_t_22 = ((__pyx_v_b > 255.0) != 0);
                                  if (__pyx_t_22) {
    /* … */
                                  }

    +8351:                     b = 255

                                    __pyx_v_b = 255.0;

     8352:

    +8353:                 emboss[y, x, 0], emboss[y, x, 1], \

                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_25 = __pyx_v_x;
                                  __pyx_t_23 = 0;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_24 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_23)) )) = __pyx_t_28;
                                  __pyx_t_23 = __pyx_v_y;
                                  __pyx_t_25 = __pyx_v_x;
                                  __pyx_t_24 = 1;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_23 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_24)) )) = __pyx_t_27;

    +8354:                 emboss[y, x, 2] = <unsigned char>r, <unsigned char>g, <unsigned char>b

                                  __pyx_t_28 = ((unsigned char)__pyx_v_r);
                                  __pyx_t_27 = ((unsigned char)__pyx_v_g);
                                  __pyx_t_26 = ((unsigned char)__pyx_v_b);
    /* … */
                                  __pyx_t_24 = __pyx_v_y;
                                  __pyx_t_25 = __pyx_v_x;
                                  __pyx_t_23 = 2;
                                  *((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_emboss.data + __pyx_t_24 * __pyx_v_emboss.strides[0]) ) + __pyx_t_25 * __pyx_v_emboss.strides[1]) )) + __pyx_t_23)) )) = __pyx_t_26;
                                }
                            }
                        }
                    }
                }
            }
            #if ((defined(__APPLE__) || defined(__OSX__)) && (defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))))
                #undef likely
                #undef unlikely
                #define likely(x)   __builtin_expect(!!(x), 1)
                #define unlikely(x) __builtin_expect(!!(x), 0)
            #endif
          }

     8355:

    +8356:     return frombuffer(asarray(emboss), (w, h), 'RGB')

      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_frombuffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_29 = __pyx_memoryview_fromslice(__pyx_v_emboss, 3, (PyObject *(*)(char *)) __pyx_memview_get_unsigned_char, (int (*)(char *, PyObject *)) __pyx_memview_set_unsigned_char, 0);; if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __pyx_t_30 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_30 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_30)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_30);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      __pyx_t_2 = (__pyx_t_30) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_30, __pyx_t_29) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_29);
      __Pyx_XDECREF(__pyx_t_30); __pyx_t_30 = 0;
      __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_29 = PyInt_FromSsize_t(__pyx_v_h); if (unlikely(!__pyx_t_29)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_29);
      __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) __PYX_ERR(1, 8356, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_30);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_29);
      PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_29);
      __pyx_t_1 = 0;
      __pyx_t_29 = 0;
      __pyx_t_29 = NULL;
      __pyx_t_13 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_29 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_29)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_29);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
          __pyx_t_13 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_29, __pyx_t_2, __pyx_t_30, __pyx_n_s_RGB};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[4] = {__pyx_t_29, __pyx_t_2, __pyx_t_30, __pyx_n_s_RGB};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_13, 3+__pyx_t_13); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_29); __pyx_t_29 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(3+__pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8356, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_29) {
          __Pyx_GIVEREF(__pyx_t_29); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); __pyx_t_29 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_13, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_30);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_13, __pyx_t_30);
        __Pyx_INCREF(__pyx_n_s_RGB);
        __Pyx_GIVEREF(__pyx_n_s_RGB);
        PyTuple_SET_ITEM(__pyx_t_1, 2+__pyx_t_13, __pyx_n_s_RGB);
        __pyx_t_2 = 0;
        __pyx_t_30 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 8356, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      goto __pyx_L0;

     8357:

     8358:

     8359:

     8360: