Advertisement
Guest User

Untitled

a guest
Aug 26th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. #@gui Joyful colormap 2 : fx_joyful_colormap_2, fx_joyful_colormap_2_preview
  2. #@gui : Background color = color(200,200,200)
  3. #@gui : Display blob controls = bool(1)
  4. #@gui : sep = separator()
  5. #@gui : Blob 1 = point(25,25,1,1,0,0,0,0,5)
  6. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  7. #@gui : Blob 1 color = color(255,0,0)
  8. #@gui : Previous = value(-1,-1,-1,-1)
  9. #@gui : sep = separator()
  10. #@gui : Blob2 = point(75,25,1,1,0,0,0,0,5)
  11. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  12. #@gui : Blob 2 color = color(0,255,0)
  13. #@gui : Previous = value(-1,-1,-1,-1)
  14. #@gui : sep = separator()
  15. #@gui : Blob 3 = point(50,75,1,1,0,0,0,0,5)
  16. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  17. #@gui : Blob 3 color = color(0,0,255)
  18. #@gui : Previous = value(-1,-1,-1,-1)
  19. #@gui : sep = separator()
  20. #@gui : Blob 4 = point(85,85,-1,1,0,0,0,0,5)
  21. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  22. #@gui : Blob 4 color = color(255,255,0)
  23. #@gui : Previous = value(-1,-1,-1,-1)
  24. #@gui : sep = separator()
  25. #@gui : Blob 5 = point(85,85,-1,1,0,0,0,0,5)
  26. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  27. #@gui : Blob 5 color = color(255,0,255)
  28. #@gui : Previous = value(-1,-1,-1,-1)
  29. #@gui : sep = separator()
  30. #@gui : Blob 6 = point(85,85,-1,1,0,0,0,0,5)
  31. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  32. #@gui : Blob 6 color = color(0,255,255)
  33. #@gui : Previous = value(-1,-1,-1,-1)
  34. #@gui : sep = separator()
  35. #@gui : Blob 7 = point(85,85,-1,1,0,0,0,0,5)
  36. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  37. #@gui : Blob 7 color = color(255,255,255)
  38. #@gui : Previous = value(-1,-1,-1,-1)
  39. #@gui : sep = separator()
  40. #@gui : Blob 8 = point(85,85,-1,1,0,0,0,0,5)
  41. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  42. #@gui : Blob 8 color = color(0,0,0)
  43. #@gui : Previous = value(-1,-1,-1,-1)
  44. #@gui : sep = separator()
  45. #@gui : Blob 9 = point(85,85,-1,1,0,0,0,0,5)
  46. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  47. #@gui : Blob 9 color = color(127,127,127)
  48. #@gui : Previous = value(-1,-1,-1,-1)
  49. #@gui : sep = separator()
  50. #@gui : Blob 10 = point(85,85,-1,1,0,0,0,0,5)
  51. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  52. #@gui : Blob 10 color = color(127,0,0)
  53. #@gui : Previous = value(-1,-1,-1,-1)
  54. #@gui : sep = separator()
  55. #@gui : Blob 11 = point(85,85,-1,1,0,0,0,0,5)
  56. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  57. #@gui : Blob 11 color = color(0,127,0)
  58. #@gui : Previous = value(-1,-1,-1,-1)
  59. #@gui : sep = separator()
  60. #@gui : Blob 12 = point(85,85,-1,1,0,0,0,0,5)
  61. #@gui : Radius = point(50,50,0,1,0,0,0,0,5,0)
  62. #@gui : Blob 12 color = color(0,0,127)
  63. #@gui : Previous = value(-1,-1,-1,-1)
  64. #@gui : sep = separator()
  65. #@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>.")
  66. #@gui : sep = separator(), note = note("<small>Author: <i><a href="https://goo.gl/Ryf7Cv">David Tschumperl&#233;</a></i>. Latest update: <i>2018/08/24</i>.</small>")
  67. fx_joyful_colormap_2 :
  68. bgR,bgG,bgB,display_controls,\
  69. x0,y0,rx0,ry0,R0,G0,B0,p_x0,p_y0,p_rx0,p_ry0,\
  70. x1,y1,rx1,ry1,R1,G1,B1,p_x1,p_y1,p_rx1,p_ry1,\
  71. x2,y2,rx2,ry2,R2,G2,B2,p_x2,p_y2,p_rx2,p_ry2,\
  72. x3,y3,rx3,ry3,R3,G3,B3,p_x3,p_y3,p_rx3,p_ry3,\
  73. x4,y4,rx4,ry4,R4,G4,B4,p_x4,p_y4,p_rx4,p_ry4,\
  74. x5,y5,rx5,ry5,R5,G5,B5,p_x5,p_y5,p_rx5,p_ry5,\
  75. x6,y6,rx6,ry6,R6,G6,B6,p_x6,p_y6,p_rx6,p_ry6,\
  76. x7,y7,rx7,ry7,R7,G7,B7,p_x7,p_y7,p_rx7,p_ry7,\
  77. x8,y8,rx8,ry8,R8,G8,B8,p_x8,p_y8,p_rx8,p_ry8,\
  78. x9,y9,rx9,ry9,R9,G9,B9,p_x9,p_y9,p_rx9,p_ry9,\
  79. x10,y10,rx10,ry10,R10,G10,B10,p_x10,p_y10,p_rx10,p_ry10,\
  80. x11,y11,rx11,ry11,R11,G11,B11,p_x11,p_y11,p_rx11,p_ry11,\
  81. =$"*"
  82. if {!0$_is_preview} display_controls=0 fi
  83. k[0] f 0 100%,100%,1,1,1e-8
  84. N=12
  85. repeat $N
  86. 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"}
  87. 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$>}])}
  88. if {!isnan($x)}
  89. r={max(1,round(norm($x-$rx,$y-$ry)))}
  90. 100%,100% =. 1,$x,$y distance. 1
  91. f. "*
  92. init(
  93. color = ["$R,$G,$B"];
  94. r2 = 3*"($r)"^2;
  95. );
  96. d = i^2;
  97. val = exp(-d/r2);
  98. I(#0) += color*val;
  99. i(#1) += val;
  100. " rm.
  101. fi
  102. done
  103. /.. . ge. 0.7 +fc[0] $bgR,$bgG,$bgB j. ...,0,0,0,0,1,.. k.
  104. repeat $N
  105. 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$>}])}
  106. if {!isnan($x)" && "$display_controls}
  107. circle $x,$y,3,0.85,0xFFFFFFFF,{avg(crop($x-3,$y-3,7,7))>128?0:255}
  108. 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}
  109. line $x,$y,$rx,$ry,0.5,0xF0F0F0F0,255 line $x,$y,$rx,$ry,0.5,0x0F0F0F0F,0
  110. fi
  111. done
  112. if 0$_is_preview
  113. u \{$bgR,$bgG,$bgB\}\{$display_controls\}\
  114. \{$x0,$y0\}\{$rx0,$ry0\}\{$R0,$G0,$B0\}\{$x0,$y0,$rx0,$ry0\}\
  115. \{$x1,$y1\}\{$rx1,$ry1\}\{$R1,$G1,$B1\}\{$x1,$y1,$rx1,$ry1\}\
  116. \{$x2,$y2\}\{$rx2,$ry2\}\{$R2,$G2,$B2\}\{$x2,$y2,$rx2,$ry2\}\
  117. \{$x3,$y3\}\{$rx3,$ry3\}\{$R3,$G3,$B3\}\{$x3,$y3,$rx3,$ry3\}\
  118. \{$x4,$y4\}\{$rx4,$ry4\}\{$R4,$G4,$B4\}\{$x4,$y4,$rx4,$ry4\}\
  119. \{$x5,$y5\}\{$rx5,$ry5\}\{$R5,$G5,$B5\}\{$x5,$y5,$rx5,$ry5\}\
  120. \{$x6,$y6\}\{$rx6,$ry6\}\{$R6,$G6,$B6\}\{$x6,$y6,$rx6,$ry6\}\
  121. \{$x7,$y7\}\{$rx7,$ry7\}\{$R7,$G7,$B7\}\{$x7,$y7,$rx7,$ry7\}\
  122. \{$x8,$y8\}\{$rx8,$ry8\}\{$R8,$G8,$B8\}\{$x8,$y8,$rx8,$ry8\}\
  123. \{$x9,$y9\}\{$rx9,$ry9\}\{$R9,$G9,$B9\}\{$x9,$y9,$rx9,$ry9\}\
  124. \{$x10,$y10\}\{$rx10,$ry10\}\{$R10,$G10,$B10\}\{$x10,$y10,$rx10,$ry10\}\
  125. \{$x11,$y11\}\{$rx11,$ry11\}\{$R11,$G11,$B11\}\{$x11,$y11,$rx11,$ry11\}
  126. fi
  127. fx_joyful_colormap_2_preview :
  128. _is_preview=1
  129. rm {[$_preview_width,$_preview_height]/1.5},1,3
  130. fx_joyful_colormap_2 $*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement