![]() Pdb.gimp_drawable_brightness_contrast(layer2, -0.5, -0.1) Pdb.gimp_image_insert_layer(self.image, layer3, group, 3) Pdb.gimp_image_insert_layer(self.image, layer2, group, 2) Layer3 = pdb.gimp_layer_copy(layer, True) Layer2 = pdb.gimp_layer_copy(layer, True) # take our now single lighting layer and do some more blurry things to it Layer = pdb.gimp_image_merge_down(self.image, layer, CLIP_TO_IMAGE) Layer = pdb.gimp_image_merge_down(self.image, layer1, CLIP_TO_IMAGE) Pdb.gimp_drawable_brightness_contrast(layer4, -0.3, 0) Pdb.gimp_drawable_brightness_contrast(layer3, -0.2, 0) Pdb.gimp_drawable_brightness_contrast(layer2, 0.3, 0.3) Pdb.gimp_image_insert_layer(self.image, layer1, group, 1) Pdb.gimp_image_insert_layer(self.image, layer2, group, 1) Pdb.gimp_image_insert_layer(self.image, layer3, group, 1) Pdb.gimp_image_insert_layer(self.image, layer4, group, 1) Pdb.gimp_image_remove_layer(self.image, layerc) Layer4 = pdb.gimp_layer_copy(layerc, True) Layer3 = pdb.gimp_layer_copy(layerc, True) Layer2 = pdb.gimp_layer_copy(layerc, True) Layer1 = pdb.gimp_layer_copy(layerc, True) ![]() Pdb.gimp_progress_set_text("Drawing main bolt (lighting). Pdb.gimp_image_remove_vectors(self.image, vectors) Pdb.gimp_drawable_edit_stroke_item(layer, vectors) Pdb.gimp_image_insert_layer(self.image, layer, group, 0) Layer = pdb.gimp_layer_new(self.image,, , RGBA_IMAGE, "Main Bolt", 100.00, LAYER_MODE_NORMAL) ''' and draw the bezier curve - solid color, no messing around with gradient overlays etc ''' Pdb.gimp_vectors_stroke_new_from_points(vectors, VECTORS_STROKE_TYPE_BEZIER, len(self.beziers), self.beziers, False) Pdb.gimp_image_insert_vectors(self.image, vectors, None, 0) Vectors = pdb.gimp_vectors_new(self.image, "Lightning Path") ''' plot the bezier curve as a gimp path ''' ![]() ''' trebles each of the path coords so gimp can draw the curve ''' Y = int(item.x * math.sin(self.angle) + item.y * s(self.angle)) X = int(item.x * s(self.angle) - item.y * math.sin(self.angle)) ''' rotates that wave to follow our real start->end line ''' N = int(normalize(pn.fractal(i, self.hgrid, self.lacunarity, self.gain)) * self.amplitude) - self.amplitude/2 Pn = PerlinNoise(self.octaves, 0.1, self.scale) ''' makes a noisy wave along a straight line ''' Pdb.gimp_context_set_brush_hardness(0.75) Pdb.gimp_context_set_brush_size(self.brush_size) Pdb.gimp_context_set_paint_method("gimp-paintbrush") # make sure we have the right tool selected in this context else gimp errors when you have a non-painting tool selected Self.brush_size = max(1, int(self.brush_size / pth)) Index = random.randint(0, len(self.path)-1) ''' because random.choice(path) only returns the Point object of a path and I want the index too ''' Obj = LightningPath(self.image, self.start, other.end, pth) ''' adds two paths together does NOT check that they are continuous, in the same image, nor of the same depth ''' Self.octaves, self.lacunarity, self.gain, self.scale, self.amplitude, self.hgrid = noise_defaults Self.branch_point = self.length - (self.length / (pth+1)) # minimum possible starting point for branches # NOTE length is the as-the-crow-flies distance AND NOT the length of the actual path/beziers class LightningPath(object):ĭef _init_(self, image, start, end, depth=1): The commentary below is for version 0.1 the full code of the latest version is available at GitHub. Draws a customizable bolt of lightning, and leaves the new layers intact so that you can tweak them afterwards.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |