Differences

This shows you the differences between two versions of the page.

wiki:old:users:oliviermehani:trucsenvrac [2009/11/17 22:56] (current)
Line 1: Line 1:
 +====== Miscellaneous =====
 +
 +
 +===== Draw lines using Python-FU =====
 +<code python>
 +def draw_line(img, p1, p2):
 +  curbrush = pdb.gimp_context_get_brush()
 +  pdb.gimp_brushes_set_brush("Circle (01)")
 +  pdb.gimp_path_set_points(img, "", 1, 15, p1 + (1.0,) + p1 + (2.0,) + p2 + (2.0,) + p2 + (1.0,) + p2 + (2.0,))
 +  pdb.gimp_path_stroke_current(img)
 +  pdb.gimp_path_delete(img,"")
 +  pdb.gimp_brushes_set_brush(curbrush)
 +
 +width = 500
 +height = 500
 +
 +img = pdb.gimp_image_new(width, height, 0)
 +lay = pdb.gimp_layer_new(img, width, height, 0, "layer", 100, 0) # Create a 100% opaque layer
 +pdb.gimp_drawable_fill(lay, 2) # Fill it with white
 +pdb.gimp_image_add_layer(img, lay, -1)
 +
 +dpy = pdb.gimp_display_new(img)
 +
 +# Draw a cross
 +draw_line(img, (0, 0), (width, height))
 +draw_line(img, (0, height), (width, 0))
 +</code>
 +
 +
 +
 +===== Make an unified patch from SVN's output =====
 +   svn diff -r REVISION | sed -n "/^=\+/T;s/^Index: \(.*\)/diff -urN \1 \1/;p" > PATCHFILE.diff
 
wiki/old/users/oliviermehani/trucsenvrac.txt · Last modified: 2009/11/17 22:56 (external edit)
Recent changes · Show pagesource · Login