private Color calculateColour(PColorSpace colorSpace, float s,
                                  float t0, float t1) {

        // find colour at point 1
        float t = parametrixValue(s, t0, t1, extend);
        // find colour at point 
        float[] input = new float[1];
        input[0] = t;

        if (function != null) {
            float[] output = function.calculate(input);
            if (output != null) {
                if (!(colorSpace instanceof DeviceN)) {
                    output = PColorSpace.reverse(output);
                }
                return colorSpace.getColor(output);
            } else {
                return null;
            }

        } else {
            logger.fine("Error processing Shading Type 3 Pattern.");
            return null;
        }

    }