Exemple #1
0
    def ApplyGlitchCollage(self, layer, groups, linecomponents):

        for g in groups:
            if len(g) < 2:
                continue

            templayer = GSLayer()
            templayer.paths = g
            G.remove_overlap(templayer)

            linetype = False

            for p in templayer.paths:

                nodelen = len(p.nodes)
                if nodelen < 4:
                    continue

                roundedpath = RoundPath(p, "nodes")
                roundedpath = convertToFitpath(roundedpath, True)
                if not roundedpath:
                    continue

                if random.choice([0, 1, 2, 3]) == 1:
                    tr = random.choice([0, 2])
                    if tr == 1:
                        self.HalftoneShape(layer, p, "triangle")
                    elif tr == 0:
                        self.HalftoneShape(layer, p, "square")
                    else:
                        layer.paths.append(roundedpath)
                else:
                    if nodelen > 9:

                        if nodelen > 20:
                            noodlepaths = self.expandMonolineFromPathlist(
                                [roundedpath], 6)
                            AddAllPathsToLayer(noodlepaths, layer)
                        else:

                            if random.choice([0, 1]) == 0:

                                if linetype == False:
                                    direction = "vertical"
                                else:
                                    direction = "horizontal"

                                linetype = not linetype
                                linecomps = Fill_Drawlines(
                                    layer, roundedpath, direction, 15,
                                    linecomponents)
                                AddAllComponentsToLayer(linecomps, layer)

                            else:
                                self.Fill_Halftone(layer, roundedpath,
                                                   "circle")
                    else:
                        layer.paths.append(p)

            del templayer
Exemple #2
0
    def ApplyCollageGraphixxx(self, layer, groups, drawtype, linecomponents):

        for g in groups:
            if len(g) < 2:
                continue

            templayer = GSLayer()
            templayer.paths = g
            G.remove_overlap(templayer)

            for p in templayer.paths:
                nodelen = len(p.nodes)
                if nodelen < 4:
                    continue

                roundedpath = RoundPath(p, "nodes")
                roundedpath = convertToFitpath(roundedpath, True)
                if not roundedpath:
                    continue

                if drawtype == "vertical" or drawtype == "horizontal":

                    rw = roundedpath.bounds.size.width
                    rh = roundedpath.bounds.size.height
                    if (rw > 130 or rh > 130):
                        all_lines = Fill_Drawlines(layer, roundedpath,
                                                   drawtype, 20,
                                                   linecomponents)
                        AddAllComponentsToLayer(all_lines, layer)

                if drawtype == "blob":
                    # disallow small blobs
                    rw = roundedpath.bounds.size.width
                    rh = roundedpath.bounds.size.height
                    if (rw > 80 and rh > 80) and (rw < 180 or rh < 180):
                        ConvertPathDirection(roundedpath, -1)
                        layer.paths.append(roundedpath)

            del templayer