def generateSoftnessMask(self): #new layer tempLayer = Layer('tempLayer', None, self.size, self.size) brush.new( tempLayer.pointer, True, self.shape, self.size, self.opacity, self.soft, self.color[0], self.color[1], self.color[2]) #get pixBuf array tempPixelArray = tempLayer.pixbuf.get_pixels_array() #init softnessArray self.softnessMask = [] for row in tempPixelArray: tempRow = [] for column in row: tempRow.append([column[3]]) self.softnessMask.append(tempRow)
def new(self): del(self.brush) self.brush = Layer('brush', None, self.size, self.size) brush.new( self.brush.pointer, True, self.shape, self.size, self.opacity, self.soft, self.color[0], self.color[1], self.color[2]) #regenerate pre computed softness mask self.generateSoftnessMask() if not main.documents.active: return hud = main.documents.active.canvas.hud fixed_size = self.size - ((self.size * (self.soft/2) / 100) / 2) if self.shape == 0: hud.set_cursor('square', fixed_size) elif self.shape == 1: hud.set_cursor('circle', fixed_size)
def new_color(self): """Change brush color with no opacity re-calculation for better performance at color change.""" brush.new( self.brush.pointer, False, 0, self.size, 0, 0, self.color[0], self.color[1], self.color[2])