

def fill(self):
    if (len(self.pathStr) == 0):
        return
    shapeStr = []
    shapeStr.append('<v:shape style="position:absolute;width:10;height:10;" coordsize="100,100" fillcolor="')
    shapeStr.append(self.context.fillStyle)
    shapeStr.append('" stroked="f" path="')
    shapeStr.append(self.pathStr.join())
    shapeStr.append(' e"><v:fill opacity="')
    shapeStr.append(str((self.context.globalAlpha * self.context.fillAlpha)))
    if ((self.context.fillGradient is not None) and (len(self.context.fillGradient.colorStops) > 0)):
        colorStops = self.context.fillGradient.colorStops
        shapeStr.append('" color="')
        shapeStr.append(str(colorStops[0].color))
        shapeStr.append('" color2="')
        shapeStr.append(str(colorStops[(colorStops.size() - 1)].color))
        shapeStr.append('" type="')
        shapeStr.append(self.context.fillGradient.type)
        minX = self.pathStr.getMinCoordX()
        maxX = self.pathStr.getMaxCoordX()
        minY = self.pathStr.getMinCoordY()
        maxY = self.pathStr.getMaxCoordY()
        dx = (maxX - minX)
        dy = (maxY - minY)
        fillLength = math.sqrt(((dx * dx) + (dy * dy)))
        gradLength = len(self.context.fillGradient)
        colors = ''
        for i in range(1, len(colorStops)):
            cs = colorStops[i]
            stopPosn = (cs.offset * gradLength)
            colors += ('%d%%' % (100 - int(((stopPosn / fillLength) * 100))))
            colors += (str(cs.color) + ',')
            if (stopPosn > fillLength):
                break
        shapeStr.append('" colors="')
        shapeStr.append('50% white,51% #0f0,100% #fff,')
        shapeStr.append('" angle="')
        shapeStr.append(('180' + ''))
    shapeStr.append('"></v:fill></v:shape>')
    daStr = ''.join(shapeStr)
    self.insert(self.context.globalCompositeOperation, daStr)

dataset/ETHPy150Open anandology/pyjamas/library/gwt/Canvas/GWTCanvasImplIE6.py GWTCanvasImplIE6.fill/original