When I take a screen shot and want to highlight certain areas, I add a layer on top, set the opacity to like 30-50, then use an eraser to uncover the part. Then I set the layer to "difference" and put the opacity at like 20-25.
Here's an example...



It is and it isn't. The problem I had was getting the layer into the mask of another layer. In theory I needed a channel object, then could plug that in as the mask. However, for the life of me, I couldn't figure out how to get a reference to a channel of the layer. I still don't know how. I spent (ie. wasted) much of yesterday working on it. Finally, instead of doing that, I just copy the layer, and paste it into the mask. I had tried this and couldn't get that to work either. A couple hours later I realized I need to invert the colors first, then it worked. Here's the interesting part of the code...
I had to do a few other tricks. I'll post the full code at the end. One included a general function to get the layer below the selected layer. That kind of thing.
(gimp-invert inDrawable)
(gimp-layer-set-opacity inDrawable 100)
(set! shadowMask (car(gimp-layer-create-mask shadowLayer ADD-ALPHA-MASK)))
(gimp-layer-add-mask shadowLayer shadowMask)
(gimp-selection-all inImage)
(gimp-edit-copy inDrawable)
(set! floatingSel (car (gimp-edit-paste shadowMask FALSE)))
(gimp-floating-sel-anchor floatingSel)
(gimp-layer-remove-mask shadowLayer MASK-APPLY)
(gimp-invert inDrawable)
(gimp-layer-set-opacity inDrawable 20)
(gimp-layer-set-mode inDrawable DIFFERENCE-MODE)
Anyway, using the plug in works as follows. Get a screen shot into gimp. Add a layer, all white. Set the opacity to whatever you want so you can see through. Use the eraser to cut out parts. (By the way, how to draw straight lines in gimp). Once that's done, just run the script. Make sure the cut out layer is selected. That's it. Make sure its white and selected. The script handles setting the opacity, putting it in "difference" mode, etc.
Put it together with my script from yesterday and you've got one fancy screen shot for web pages...

Full code...
(define (internal-getLayerBelow
inImage
inLayer
)
(set! layerArray (car(cdr(gimp-image-get-layers inImage))))
(internal-getLayerBelowRecurse
inLayer
layerArray
0
)
)
(define (internal-getLayerBelowRecurse
inLayer
layerArray
index
)
(set! currentLayer (aref layerArray index))
(if (= currentLayer inLayer)
(aref layerArray (+ index 1))
(internal-getLayerBelowRecurse
inLayer
layerArray
(+ index 1)
)
)
)
(define (script-fu-kev-style-cutout
inImage
inDrawable
)
(script-fu-drop-shadow
inImage
inDrawable
2
2
3
'(0 0 0)
80
0)
(set! shadowLayer (internal-getLayerBelow
inImage
inDrawable
)
)
(gimp-invert inDrawable)
(gimp-layer-set-opacity inDrawable 100)
(set! shadowMask (car(gimp-layer-create-mask shadowLayer ADD-ALPHA-MASK)))
(gimp-layer-add-mask shadowLayer shadowMask)
(gimp-selection-all inImage)
(gimp-edit-copy inDrawable)
(set! floatingSel (car (gimp-edit-paste shadowMask FALSE)))
(gimp-floating-sel-anchor floatingSel)
(gimp-layer-remove-mask shadowLayer MASK-APPLY)
(gimp-invert inDrawable)
(gimp-layer-set-opacity inDrawable 20)
(gimp-layer-set-mode inDrawable DIFFERENCE-MODE)
;(gimp-selection-all inImage)
;(gimp-edit-copy inDrawable)
;(set! floatingSel (car (gimp-edit-paste shadowMask FALSE)))
;(gimp-floating-sel-anchor floatingSel)
;(gimp-image-remove-layer inImage (internal-getLayerBelow
; inImage
; inDrawable
; )
;)
)
(script-fu-register
"script-fu-kev-style-cutout" ;func name
"Kev Styleize Cutout" ;menu label
"Make the cutout areas pretty" ;description
"Kevin Galligan" ;author
"copyright 2007, Kevin Galligan" ;copyright notice
"January 21, 2007" ;date created
"*"
SF-IMAGE "Input image" 0
SF-DRAWABLE "Input drawable" 0
)
(script-fu-menu-register "script-fu-kev-style-cutout" "/Script-Fu/Kev")
No comments:
Post a Comment