Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #@gui Joyful colormap 2 : fx_joyful_colormap_2, fx_joyful_colormap_2_preview
- #@gui : Background color = color(200,200,200)
- #@gui : Display blob controls = bool(1)
- #@gui : sep = separator()
- #@gui : Blob 1 = point(25,25,1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 1 color = color(255,0,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob2 = point(75,25,1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 2 color = color(0,255,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 3 = point(50,75,1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 3 color = color(0,0,255)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 4 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 4 color = color(255,255,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 5 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 5 color = color(255,0,255)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 6 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 6 color = color(0,255,255)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 7 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 7 color = color(255,255,255)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 8 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 8 color = color(0,0,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 9 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 9 color = color(127,127,127)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 10 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 10 color = color(127,0,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 11 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 11 color = color(0,127,0)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : Blob 12 = point(85,85,-1,1,0,0,0,0,5)
- #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
- #@gui : Blob 12 color = color(0,0,127)
- #@gui : Previous = value(-1,-1,-1,-1)
- #@gui : sep = separator()
- #@gui : note = note("This filter can be used to create custom palettes with given color shades. It has been inspired by <a href="https://research.adobe.com/project/playful-palette-an-interactive-parametric-color-mixer-for-artists/">Adobe's Playful Palette</a>.")
- #@gui : sep = separator(), note = note("<small>Author: <i><a href="https://goo.gl/Ryf7Cv">David Tschumperlé</a></i>. Latest update: <i>2018/08/24</i>.</small>")
- fx_joyful_colormap_2 :
- bgR,bgG,bgB,display_controls,\
- x0,y0,rx0,ry0,R0,G0,B0,p_x0,p_y0,p_rx0,p_ry0,\
- x1,y1,rx1,ry1,R1,G1,B1,p_x1,p_y1,p_rx1,p_ry1,\
- x2,y2,rx2,ry2,R2,G2,B2,p_x2,p_y2,p_rx2,p_ry2,\
- x3,y3,rx3,ry3,R3,G3,B3,p_x3,p_y3,p_rx3,p_ry3,\
- x4,y4,rx4,ry4,R4,G4,B4,p_x4,p_y4,p_rx4,p_ry4,\
- x5,y5,rx5,ry5,R5,G5,B5,p_x5,p_y5,p_rx5,p_ry5,\
- x6,y6,rx6,ry6,R6,G6,B6,p_x6,p_y6,p_rx6,p_ry6,\
- x7,y7,rx7,ry7,R7,G7,B7,p_x7,p_y7,p_rx7,p_ry7,\
- x8,y8,rx8,ry8,R8,G8,B8,p_x8,p_y8,p_rx8,p_ry8,\
- x9,y9,rx9,ry9,R9,G9,B9,p_x9,p_y9,p_rx9,p_ry9,\
- x10,y10,rx10,ry10,R10,G10,B10,p_x10,p_y10,p_rx10,p_ry10,\
- x11,y11,rx11,ry11,R11,G11,B11,p_x11,p_y11,p_rx11,p_ry11,\
- =$"*"
- if {!0$_is_preview} display_controls=0 fi
- k[0] f 0 100%,100%,1,1,1e-8
- N=12
- repeat $N
- rx$>,ry$>={"P = ["${x$>},${y$>}"]; R = ["${rx$>},${ry$>}"]; oP = ["${p_x$>},${p_y$>}"]; oP==[-1,-1]?P + [8,0]:P!=oP?R + P - oP:R"}
- x,y,rx,ry,R,G,B={"const w1 = (w - 1)%; const h1 = (h -1)%; "round([${x$>}*w1,${y$>}*h1,${rx$>}*w1,${ry$>}*h1,${R$>},${G$>},${B$>}])}
- if {!isnan($x)}
- r={max(1,round(norm($x-$rx,$y-$ry)))}
- 100%,100% =. 1,$x,$y distance. 1
- f. "*
- init(
- color = ["$R,$G,$B"];
- r2 = 3*"($r)"^2;
- );
- d = i^2;
- val = exp(-d/r2);
- I(#0) += color*val;
- i(#1) += val;
- " rm.
- fi
- done
- /.. . ge. 0.7 +fc[0] $bgR,$bgG,$bgB j. ...,0,0,0,0,1,.. k.
- repeat $N
- x,y,rx,ry,R,G,B={"const w1 = (w - 1)%; const h1 = (h -1)%; "round([${x$>}*w1,${y$>}*h1,${rx$>}*w1,${ry$>}*h1,${R$>},${G$>},${B$>}])}
- if {!isnan($x)" && "$display_controls}
- circle $x,$y,3,0.85,0xFFFFFFFF,{avg(crop($x-3,$y-3,7,7))>128?0:255}
- rectangle {"const x = "$rx"; const y = "$ry"; [x-2,y-2,x+2,y+2]"},0.85,0xFFFFFFFF,{avg(crop($rx-3,$ry-3,7,7))>128?0:255}
- line $x,$y,$rx,$ry,0.5,0xF0F0F0F0,255 line $x,$y,$rx,$ry,0.5,0x0F0F0F0F,0
- fi
- done
- if 0$_is_preview
- u \{$bgR,$bgG,$bgB\}\{$display_controls\}\
- \{$x0,$y0\}\{$rx0,$ry0\}\{$R0,$G0,$B0\}\{$x0,$y0,$rx0,$ry0\}\
- \{$x1,$y1\}\{$rx1,$ry1\}\{$R1,$G1,$B1\}\{$x1,$y1,$rx1,$ry1\}\
- \{$x2,$y2\}\{$rx2,$ry2\}\{$R2,$G2,$B2\}\{$x2,$y2,$rx2,$ry2\}\
- \{$x3,$y3\}\{$rx3,$ry3\}\{$R3,$G3,$B3\}\{$x3,$y3,$rx3,$ry3\}\
- \{$x4,$y4\}\{$rx4,$ry4\}\{$R4,$G4,$B4\}\{$x4,$y4,$rx4,$ry4\}\
- \{$x5,$y5\}\{$rx5,$ry5\}\{$R5,$G5,$B5\}\{$x5,$y5,$rx5,$ry5\}\
- \{$x6,$y6\}\{$rx6,$ry6\}\{$R6,$G6,$B6\}\{$x6,$y6,$rx6,$ry6\}\
- \{$x7,$y7\}\{$rx7,$ry7\}\{$R7,$G7,$B7\}\{$x7,$y7,$rx7,$ry7\}\
- \{$x8,$y8\}\{$rx8,$ry8\}\{$R8,$G8,$B8\}\{$x8,$y8,$rx8,$ry8\}\
- \{$x9,$y9\}\{$rx9,$ry9\}\{$R9,$G9,$B9\}\{$x9,$y9,$rx9,$ry9\}\
- \{$x10,$y10\}\{$rx10,$ry10\}\{$R10,$G10,$B10\}\{$x10,$y10,$rx10,$ry10\}\
- \{$x11,$y11\}\{$rx11,$ry11\}\{$R11,$G11,$B11\}\{$x11,$y11,$rx11,$ry11\}
- fi
- fx_joyful_colormap_2_preview :
- _is_preview=1
- rm {[$_preview_width,$_preview_height]/1.5},1,3
- fx_joyful_colormap_2 $*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement