public synchronized void init() {

        if (inited) {
            return;
        }

        // shading dictionary
        if (shading == null) {
            shading = library.getDictionary(entries, "Shading");
        }

        shadingType = library.getInt(shading, "ShadingType");
        bBox = library.getRectangle(shading, "BBox");
        colorSpace = PColorSpace.getColorSpace(library,
                library.getObject(shading, "ColorSpace"));
        if (library.getObject(shading, "Background") != null &&
                library.getObject(shading, "Background") instanceof Vector) {
            background = (Vector) library.getObject(shading, "Background");
        }
        antiAlias = library.getBoolean(shading, "AntiAlias");

        // get type 2 specific data.
        if (library.getObject(shading, "Domain") instanceof Vector) {
            domain = (Vector<Number>) library.getObject(shading, "Domain");
        } else {
            domain = new Vector<Number>(2);
            domain.add(new Float(0.0));
            domain.add(new Float(1.0));
        }

        if (library.getObject(shading, "Coords") instanceof Vector) {
            coords = (Vector) library.getObject(shading, "Coords");
        }
        if (library.getObject(shading, "Extend") instanceof Vector) {
            extend = (Vector) library.getObject(shading, "Extend");
        } else {
            extend = new Vector<Boolean>(2);
            extend.add(false);
            extend.add(false);
        }
        Object tmp = library.getObject(shading, "Function");
        if (tmp != null) {
            if (!(tmp instanceof Vector)){
                function = new Function[]{Function.getFunction(library,
                        tmp)};
            }else{
                Vector functionTemp = (Vector)tmp;
                function = new Function[functionTemp.size()];
                for (int i = 0; i < functionTemp.size(); i++) {
                    function[i] = Function.getFunction(library, functionTemp.get(i));
                }
            }
        }

        float t0 = domain.get(0).floatValue();
        float t1 = domain.get(1).floatValue();
        float s[] = new float[]{0.0f, 0.25f, 0.5f, 0.75f, 1.0f};

        Point2D.Float center = new Point2D.Float(
                ((Number) coords.get(0)).floatValue(),
                ((Number) coords.get(1)).floatValue());

        Point2D.Float focus = new Point2D.Float(
                ((Number) coords.get(3)).floatValue(),
                ((Number) coords.get(4)).floatValue());

        float radius = ((Number) coords.get(2)).floatValue();
        float radius2 = ((Number) coords.get(5)).floatValue();

        // approximation, as we don't full support radial point via the paint
        // class. 
        if (radius2 > radius) {
            radius = radius2;
        }

        // get the number off components in the colour
        Color color1 = calculateColour(colorSpace, s[0], t0, t1);
        Color color2 = calculateColour(colorSpace, s[1], t0, t1);
        Color color3 = calculateColour(colorSpace, s[2], t0, t1);
        Color color4 = calculateColour(colorSpace, s[3], t0, t1);
        Color color5 = calculateColour(colorSpace, s[4], t0, t1);

        if (color1 == null || color2 == null) {
            return;
        }
        // Construct a LinearGradientPaint object to be use by java2D
        Color[] colors = {color1, color2, color3, color4, color5};

        radialGradientPaint = new RadialGradientPaint(
                center, radius,
                focus,
                s,
                colors,
                MultipleGradientPaint.NO_CYCLE,
                MultipleGradientPaint.LINEAR_RGB,
                matrix);

        // get type 3 specific data.
        inited = true;
    }