As an alternative to standard treatment of superficial lesions with surgery and/or superficial/orthovoltage x-ray irradiation, radioactive moulds can be used. However, close proximity of the source to the treatment region leads to significant dose inhomogeneities in the tissue. Analytical and fast numerical methods have been developed that can calculate a corresponding flattening filter that evens out the dose distribution at the surface. Monte Carlo transport calculations were used to enable accurate treatment of the transport through the geometry. It was found that the use of pre-calculated transport parameters like dependence of the attenuation coefficient and scattering with depth is required for fast calculation of the flattening filter shape. Only 1-2 iterations were needed for a successful convergence to the filter shape that flattens out the dose distribution at the surface to within 1%. The developed methods are very general and could be applied with some minor modifications to other problems, where shaping of the irradiation field is required.