         UIGraphicsEndImageContext()
         return coloredImg
     }
+    /*generating image with custom background*/
     func getBarCustomImage(image:UIImage, textColor:UIColor)->UIImage{
         
         // Setup text parameters

            var croppedImage:CGImageRef = CGImageCreateWithImageInRect (im2.CGImage, newRect)
            UIImage(CGImage:croppedImage)!.drawInRect(CGRectMake(0,0,ceil(im1.size.width*percent),im1.size.height))
        }
        var newImage = UIGraphicsGetImageFromCurrentImageContext()
        
        UIGraphicsEndImageContext()
        return newImage
    }
    
    func getBarImage(color:UIColor, textColor:UIColor)->UIImage{
        
        // Setup text parameters

            self.useImages = false
            self.updateImages()
        }
        
        self.backgroundImage.image = self.getMixedImages(progressPercent, im1:self.completedImage, im2:self.loadingImage)
        self.backgroundImage.clipsToBounds = true
        self.layer.masksToBounds = true
    }
    
    func getMixedImages(percent:CGFloat,im1:UIImage,im2:UIImage)->UIImage{
        UIGraphicsBeginImageContext(im1.size)
        im1.drawInRect(CGRectMake(0,0,im1.size.width,im1.size.height))
        
        if(percent > 0 && percent <= 1.0){
