;Trying to reproduce this selection here: http://gimpchat.com/viewtopic.php?f=15&t=13064&p=177076&hilit=how+to+set+feather+border#p177075
(define (script-fu-start-with-a-pen-for-pegleg44 image layer 
			border-width-pixels
			color-curve-preset
         )
	
		(let* 
		   (
		   (width (car (gimp-image-width image)))
		   (height (car (gimp-image-height image)))
		   )
			;(gimp-image-undo-disable image); DN = NO UNDO
			(gimp-context-push)
			(gimp-image-undo-group-start image)                   ;undo-group in one step
			()

			;deselect an entire image
			;stroke path with white color on mask
		    (gimp-selection-none image)
			(define active-vectors (car (gimp-image-get-active-vectors image)))
			
			;make it hard brush and size 1
			;(define new-brush (car (gimp-brush-new "1 pixel line")))
			;(define hardness (car (gimp-brush-set-hardness new-brush 100)))
			;(gimp-message (string-append "brush hardness" (number->string hardness)))
			;(define radius (car (gimp-brush-set-radius new-brush 0.5)))
			;(gimp-message (string-append "brush radius" (number->string radius)))
			;(define shape (car (gimp-brush-set-shape new-brush BRUSH-GENERATED-CIRCLE)))
			;(gimp-message (string-append "brush shape" (number->string shape)))
			
			(gimp-context-set-opacity 100)
			(gimp-context-set-brush-size 1)
			
			
			(gimp-context-set-foreground '(255 255 255))
			(define black-mask (car (gimp-layer-create-mask layer ADD-SELECTION-MASK)))
			(gimp-layer-add-mask layer black-mask)
			
			;(gimp-context-set-brush new-brush)
			;(gimp-context-set-brush-size 0.5)
			;(gimp-context-set-antialias FALSE)
			;(gimp-context-set-feather FALSE)
			;(gimp-context-set-dynamics "Dynamics Off")
			
			;The below actually allows us to select/load a Mask of a path that is 1 pixel wide.
			;calls python fu written by Reinoud Elhorst https://github.com/reinhrst/nl.claude.tools/tree/master/gimp-fu
			(python-fu-vector-to-line-stroke 1 image active-vectors black-mask "#FFFFFF" 1 ;color width
			                                                                    "round" ;capstyle "butt","square","round"
                                                                                "round" ;joinstyle "miter","round","bevel"
																				10 ;miterlimit google if don't understand what this is)
																				"crispEdges"
			)
			;(gimp-edit-stroke-vectors black-mask active-vectors)
			;(gimp-threshold black-mask 64 255) ;using threshold to get continous line, there are points on the line when it's 2 pixel wide.
			
			(gimp-selection-load black-mask)
			(gimp-layer-remove-mask layer MASK-DISCARD)
			
			;(gimp-brush-delete new-brush)
			
			
			
			
			;below steps is the same as V-selection script the steps are identical after we have a solid line of the path selected.
			(gimp-context-set-feather TRUE) ;seems to have no effect as border seem to feather always...hmmmm oh well that's what we want anyways so we're in luck
			(gimp-selection-border image border-width-pixels)
		
			(define layer-copy layer)
			(define mask-selection (car (gimp-layer-create-mask layer-copy ADD-SELECTION-MASK)))
			(gimp-layer-add-mask layer-copy mask-selection)
			(gimp-selection-all image)
			(python-fu-apply-color-curves-preset 1 image mask-selection color-curve-preset)
			(gimp-selection-load mask-selection)
			(gimp-layer-remove-mask layer-copy MASK-DISCARD)
			(gimp-image-set-active-layer image layer-copy)
			
			
			
			
			
			
			
		   ;(gimp-image-undo-enable image) ;DN = NO UNDO
			(gimp-image-undo-group-end image)                     ;undo group in one step
			(gimp-context-pop)
			(gimp-displays-flush)
	    )
	
	
    
) ;end of define
(script-fu-register
  "script-fu-start-with-a-pen-for-pegleg44"         ;function name
  "<Image>/Script-Fu/Start-with-a-pen-for-pegleg44 ..."    ;menu register
  "Steps described by PegLeg44 "       ;description
  "Tin Tran"                          ;author name
  "copyright info and description"         ;copyright info or description
  "2016"                          ;date
  "RGB*, GRAY*"                        ;mode
  SF-IMAGE      "Image" 0                   
  SF-DRAWABLE   "Layer" 0
  ;SF-GRADIENT   "Gradient 1"           ""
  ;SF-GRADIENT   "Gradient 2"           ""
  SF-ADJUSTMENT   "Border width pixels" '(50 0 1000 1 10 0 0)
  SF-OPTION     "Color Curves Preset" (strbreakup (car (python-fu-get-color-curves-presets-names 1)) ",")
)
