Skip to content

Commit acb2a13

Browse files
authored
Registration prompts improved
Clearer description and default values
1 parent e777c80 commit acb2a13

File tree

1 file changed

+73
-53
lines changed

1 file changed

+73
-53
lines changed

lasm-lab-color-punch.scm

Lines changed: 73 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
;
44
; Advanced Photo LAB Color Punch script for GIMP 2.4
55
; Copyright (C) 2005 Lasm <[email protected]>
6-
; http://www.godsimmediatecontact.com
7-
; http://www.godsdirectcontact.org
8-
; http://www.raindesigninc.com
6+
; http://www. gods immediatecontact.com
7+
; http://www. gods directcontact.org
8+
; http://www. rain designinc.com
99
;
1010
; Tags: color
1111
;
1212
; Latest scripts/packages available at
13-
; http://sourceforge.net/projects/lasmz/
14-
; http://groups.yahoo.com/group/script-fu/
13+
; http: // sourceforge.net/projects/lasmz/
14+
; http:// groups.yahoo.com/group/script-fu/
1515
;
1616
; Welcome to the Line Art Coffee House
1717
; This Photo LAB Color Punch script is for kung-fu connisseurs only
@@ -153,9 +153,9 @@
153153
(let* ((curve-value (cons-array 8 'byte)))
154154
(aset curve-value 0 0)
155155
(aset curve-value 1 0)
156-
(aset curve-value 2 0)
156+
(aset curve-value 2 1) ; was 0
157157
(aset curve-value 3 wuji)
158-
(aset curve-value 4 255)
158+
(aset curve-value 4 254) ; was 255
159159
(aset curve-value 5 (- 255 wuji))
160160
(aset curve-value 6 255)
161161
(aset curve-value 7 255)
@@ -165,8 +165,12 @@
165165

166166
(define (get-lab-curves saturate? curvestr)
167167
(if (eqv? saturate? TRUE)
168-
(curve0 curvestr)
169-
(curve1 curvestr)
168+
(begin
169+
(curve0 curvestr)
170+
)
171+
(begin
172+
(curve1 curvestr)
173+
)
170174
)
171175
)
172176

@@ -198,9 +202,10 @@
198202
(if (< Bc 2) ;; sat/desat
199203
(append '(1) ((L-list Lc)))
200204
(if (= Bc 2) ;; color-tint
201-
(append '(2) ((L-list Lc)))
202-
(append '(0) ((L-list Lc))))
205+
(append '(2) ((L-list Lc)))
206+
(append '(0) ((L-list Lc)))
203207
)
208+
)
204209
)
205210
)
206211
(define (B-locked Ac Lc)
@@ -209,8 +214,9 @@
209214
(append '(1) ((L-list Lc)))
210215
(if (= Ac 2) ;; color-tint
211216
(append '(2) ((L-list Lc)))
212-
(append '(0) ((L-list Lc))))
217+
(append '(0) ((L-list Lc)))
213218
)
219+
)
214220
)
215221
)
216222
(define (A-list Ac lB? Bc Lc)
@@ -221,21 +227,28 @@
221227
(append '(1) ((B-locked Ac Lc)))
222228
(if (= Ac 2) ;; color-tint
223229
(append '(2) ((B-locked Ac Lc)))
224-
(append '(0) ((B-locked Ac Lc)))))
230+
(append '(0) ((B-locked Ac Lc)))
231+
)
225232
)
233+
)
226234
(begin ;; B is un-locked
227235
(if (< Ac 2) ;; sat and desat
228236
(append '(1) ((B-list Bc Lc)))
229237
(if (= Ac 2) ;; color-tint
230-
(append '(2) ((B-list Bc Lc)))
231-
(append '(0) ((B-list Bc Lc))))))) ;;; A-B-L
238+
(append '(2) ((B-list Bc Lc)))
239+
(append '(0) ((B-list Bc Lc)))
240+
)
241+
)
242+
)
243+
) ;;; A-B-L
232244
)
233245
)
234246
(define (read-list ls) ;; cumulative sum of list
235247
(if (null? ls)
236248
0
237249
(+ (car ls)
238-
(read-list (cdr ls))))
250+
(read-list (cdr ls)))
251+
)
239252
)
240253
; ((A-list Achl lckB? Bchl Lchl))
241254
(if (> Hchl 0)
@@ -250,8 +263,10 @@
250263
;
251264
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
252265
(define (calc-color-tint curvestr)
253-
(let* ((color-tint (* 2 curvestr)))
254-
color-tint
266+
(let* (
267+
(color-tint (* 2 curvestr))
268+
)
269+
color-tint
255270
)
256271
)
257272

@@ -338,7 +353,7 @@
338353
; (number->string stat-L)))
339354

340355
(if (= stat-H 1) ;; start of H channel create mask magic
341-
(begin
356+
(begin
342357
(set! hisdw-img (car (gimp-image-new width height 0)))
343358
(set! hisdw-color-layer (car (gimp-layer-new-from-drawable inLayer hisdw-img)))
344359
(gimp-image-insert-layer hisdw-img hisdw-color-layer 0 -1)
@@ -367,32 +382,32 @@
367382
(gimp-layer-set-apply-mask hisdw-A-layer hisdw-maskA)
368383
)
369384
)
370-
(if (= stat-B 1) ;; create B mask and apply it
371-
(begin
372-
(gimp-image-set-active-layer gray-img B-layer)
373-
(set! hisdw-B-layer (copylayer B-layer "B copy"))
374-
(gimp-image-insert-layer gray-img hisdw-B-layer 0 -1)
375-
(set! hisdw-B-mask (car (gimp-layer-create-mask hisdw-B-layer 0)))
376-
(gimp-layer-add-mask hisdw-B-layer hisdw-B-mask)
377-
(set! hisdw-maskB (car (gimp-edit-paste hisdw-B-mask TRUE)))
378-
(gimp-floating-sel-anchor hisdw-maskB)
379-
(gimp-layer-set-apply-mask hisdw-B-layer hisdw-maskB)
385+
(if (= stat-B 1) ;; create B mask and apply it
386+
(begin
387+
(gimp-image-set-active-layer gray-img B-layer)
388+
(set! hisdw-B-layer (copylayer B-layer "B copy"))
389+
(gimp-image-insert-layer gray-img hisdw-B-layer 0 -1)
390+
(set! hisdw-B-mask (car (gimp-layer-create-mask hisdw-B-layer 0)))
391+
(gimp-layer-add-mask hisdw-B-layer hisdw-B-mask)
392+
(set! hisdw-maskB (car (gimp-edit-paste hisdw-B-mask TRUE)))
393+
(gimp-floating-sel-anchor hisdw-maskB)
394+
(gimp-layer-set-apply-mask hisdw-B-layer hisdw-maskB)
395+
)
380396
)
381-
)
382-
(if (= stat-L 1) ;; create L mask and apply it
383-
(begin
384-
(gimp-image-set-active-layer gray-img L-layer)
385-
(set! hisdw-L-layer (copylayer L-layer "L copy"))
386-
(gimp-image-insert-layer gray-img hisdw-L-layer 0 -1)
387-
(set! hisdw-L-mask (car (gimp-layer-create-mask hisdw-L-layer 0)))
388-
(gimp-layer-add-mask hisdw-L-layer hisdw-L-mask)
389-
(set! hisdw-maskL (car (gimp-edit-paste hisdw-L-mask TRUE)))
390-
(gimp-floating-sel-anchor hisdw-maskL)
391-
(gimp-layer-set-apply-mask hisdw-L-layer hisdw-maskL)
397+
(if (= stat-L 1) ;; create L mask and apply it
398+
(begin
399+
(gimp-image-set-active-layer gray-img L-layer)
400+
(set! hisdw-L-layer (copylayer L-layer "L copy"))
401+
(gimp-image-insert-layer gray-img hisdw-L-layer 0 -1)
402+
(set! hisdw-L-mask (car (gimp-layer-create-mask hisdw-L-layer 0)))
403+
(gimp-layer-add-mask hisdw-L-layer hisdw-L-mask)
404+
(set! hisdw-maskL (car (gimp-edit-paste hisdw-L-mask TRUE)))
405+
(gimp-floating-sel-anchor hisdw-maskL)
406+
(gimp-layer-set-apply-mask hisdw-L-layer hisdw-maskL)
407+
)
392408
)
393-
)
394-
)
395-
) ;; end of H channel create mask magic
409+
)
410+
) ;; end of H channel create mask magic
396411

397412
(if (= Achannel 0)
398413
(begin
@@ -472,13 +487,17 @@
472487
)
473488
) ;; end of A tint
474489

475-
490+
476491
(if (eqv? lockB? FALSE)
477492
(begin
478493
(if (= Bchannel 0)
479-
(gimp-curves-spline B-layer 0 8 (get-lab-curves TRUE curvestr2))
480-
(if (= Bchannel 1)
481-
(gimp-curves-spline B-layer 0 8 (get-lab-curves FALSE curvestr2))
494+
(begin
495+
(gimp-curves-spline B-layer 0 8 (get-lab-curves TRUE curvestr2))
496+
)
497+
(begin
498+
(if (= Bchannel 1)
499+
(gimp-curves-spline B-layer 0 8 (get-lab-curves FALSE curvestr2))
500+
)
482501
)
483502
)
484503

@@ -565,7 +584,7 @@
565584
)
566585
)
567586
)
568-
587+
569588
(set! comp-img (car
570589
(plug-in-drawable-compose RUN-NONINTERACTIVE gray-img L-layer A-layer B-layer 0 "Lab")))
571590
(set! tt-d (car (gimp-display-new comp-img))) ;; working
@@ -596,6 +615,7 @@
596615

597616
(gimp-context-set-background old-bg)
598617
(gimp-context-set-foreground old-fg)
618+
(gc); garbage collect; memory cleanup; arrays were used
599619

600620
)
601621

@@ -605,7 +625,7 @@
605625
(script-fu-register
606626
"script-fu-lab-color-punch"
607627
"<Toolbox>/Script-Fu/Colors/Lasm/Lasm LAB Color Punch"
608-
"Lasm's famous special effect for photographs. This works on any RGB image. LAB Color Punch gives you the power and freedom to change the color you want ! Caution: it runs slowly on large images. \n file:lasm-lab-color-punch.scm"
628+
"Lasm's famous special effect for photographs. This works on any RGB image. Allows for power saturation or color-tint. Color tint uses the Strength to determine shade between the 2 colors. Caution: it runs slowly on large images. \n file:lasm-lab-color-punch.scm"
609629
"lasm"
610630
"Copyright 2005, lasm"
611631
"Nov 1, 2005"
@@ -615,12 +635,12 @@
615635
SF-OPTION "Highlight/Shadow" SCRIPT-FU-LAB-COLOR-PUNCH-CHOICE3
616636
SF-ADJUSTMENT "Sensitivity" '(64 0 127 1 10 0 0)
617637
SF-OPTION "Green/Red" SCRIPT-FU-LAB-COLOR-PUNCH-CHOICE1
618-
SF-ADJUSTMENT "Strength" '(64 0 127 1 10 1 0)
619-
SF-TOGGLE "Lock Blue/Yellow" TRUE
638+
SF-ADJUSTMENT "Gr-Red Strength (0 to 127)" '(94 0 127 1 10 1 0)
639+
SF-TOGGLE "Lock Blue/Yellow" FALSE
620640
SF-OPTION "Blue/Yellow" SCRIPT-FU-LAB-COLOR-PUNCH-CHOICE1
621-
SF-ADJUSTMENT "Strength" '(64 0 127 1 10 1 0)
641+
SF-ADJUSTMENT "Blu-Yel Strength (0-127)" '(85 0 127 1 10 1 0)
622642
SF-OPTION "Luminosity" SCRIPT-FU-LAB-COLOR-PUNCH-CHOICE2
623-
SF-ADJUSTMENT "Strength" '(64 0 127 1 10 1 0)
643+
SF-ADJUSTMENT "Strength (0-127)" '(64 0 127 1 10 1 0)
624644
SF-TOGGLE "New Layer" TRUE
625645
)
626646

0 commit comments

Comments
 (0)