Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.38 KB | None | 0 0
  1. #@gui Cascading self glitching: fx_self_glitching_cascade, fx_self_glitching_cascade_preview(1)
  2. #@gui : note = note("Shifts images in a cascading fashion but computes values based on shifted and original images.")
  3. #@gui : note = note("<small>This filter has many channel options and many operation options allowing for extremely-distorted images. Don't always trust the preview!</small>"), sep = separator()
  4. #@gui : 1. Shift channels = choice("RGB&#47;sRGB","CMYK&#47;CMY","HSV&#47;HSV8","HSL&#47;HSL8","HSI&#47;HSI8","LCH&#47;LCH8","Lab&#47;Lab8","YCbCr&#47;YCbCr_2","YIQ&#47;YIQ8","YUV&#47;YUV8","Bayer&#47;HCY","XYZ&#47;XYZ8")
  5. #@gui : 2. Alt choice = bool(0)
  6. #@gui : 3. Process Alpha = bool(0)
  7. #@gui : 4,5. Zeroth shift = point(50,50,0,1,255,255,255,175)
  8. #@gui : 6. Boundary = choice(3,"Zero","Nearest","Periodic","Mirror")
  9. #@gui : sep = separator()
  10. #@gui : 7. Iterations = int(3,1,64)
  11. #@gui : 8. Repeat post-shift operations = bool(1)
  12. #@gui : sep = separator()
  13. #@gui : 9,10. Shift target = point(55,55,0,1,255,0,0,175)
  14. #@gui : 11. Target for final &#40;rather than first&#41; shift = bool(0)
  15. #@gui : 12,13. Cascade centre point = point(45,45,0,1,0,255,0,175)
  16. #@gui : 14. Shift randomness = float(0.75,0,4)
  17. #@gui : 15. Boundary = choice(3,"Zero","Nearest","Periodic","Mirror")
  18. #@gui : 16. Power = float(0,-5,5)
  19. #@gui : 17. Bias = float(0,-256,256)
  20. #@gui : 18. Negation = bool(0)
  21. #@gui : 19. Shift Operator = choice("Add","Multiply","Bitwise And","Bitwise Or","Bitwise Xor","Power","Reverse Power",
  22. #@gui : "Modulo","Reverse Modulo","Divide","Reverse Divide","Subtract","Reverse Subtract",
  23. #@gui : "Left Bitwise Shift","Reverse LBS","Right Bitwise Shift","Reverse RBS","Left Bitwise Rotation","Reverse LBR","Right Bitwise Rotation","Reverse RBR",
  24. #@gui : "Average","Round","Reverse Round","Sine","Reverse Sine","Cosine","Reverse Cosine","Tangent","Reverse Tangent &#40;CPU-intensive&#41;",
  25. #@gui : "Cosecant","Reverse Cosecant","Secant","Reverse Secant","Cotangent","Reverse Cotangent","Variance","Difference","Minimum","Maximum",
  26. #@gui : "Interference &#40;Add&#41;","Reverse Interference &#40;Add&#41;","Interference &#40;Multiply&#41;",
  27. #@gui : "Interference &#40;Divide&#41;","Reverse Interference &#40;Div&#41;",
  28. #@gui : "Interference &#40;Subtract&#41;","Reverse Interference &#40;Subt&#41;","Interference &#40;Rev Subt&#41;","Reverse Interference &#40;Rev Subt&#41;",
  29. #@gui : "Interference &#40;Difference&#41;","Reverse Interference &#40;Diff&#41;","Interference &#40;Variance&#41;",
  30. #@gui : "Screen","Colour Dodge","Reverse Colour Dodge","Colour Burn","Reverse Colour Burn","Soft Light &#40;illusions&#46;hu&#41;","Reverse Soft Light &#40;illusions&#46;hu&#41;",
  31. #@gui : "Geometric Mean","Bright Hard Mix","Dark Hard Mix")
  32. #@gui : 20. Multiplier 1 = float(1,-10,10)
  33. #@gui : 21. Addition 1 = int(0,-1024,1024)
  34. #@gui : 22. Post-Shift Modulo = int(256,1,1024)
  35. #@gui : 23. Multiplier 2 = float(1,-10,10)
  36. #@gui : 24. Addition 2 = int(0,-1024,1024)
  37. #@gui : 25. Custom command before shift = text(1,)
  38. #@gui : 26. Custom command after shift = text(1,)
  39. #@gui : sep = separator(), 27. Run on channel(s) = choice("All","RGBA [all]","RGB [all]","RGB [red]","RGB [green]","RGB [blue]","RGBA [alpha]","Linear RGB [all]","Linear RGB [red]","Linear RGB [green]","Linear RGB [blue]","YCbCr [luminance]","YCbCr [blue-red chrominances]","YCbCr [blue chrominance]","YCbCr [red chrominance]","YCbCr [green chrominance]","Lab [lightness]","Lab [ab-chrominances]","Lab [a-chrominance]","Lab [b-chrominance]","Lch [ch-chrominances]","Lch [c-chrominance]","Lch [h-chrominance]","HSV [hue]","HSV [saturation]","HSV [value]","HSI [intensity]","HSL [lightness]","CMYK [cyan]","CMYK [magenta]","CMYK [yellow]","CMYK [key]","YIQ [luma]","YIQ [chromas]")
  40. # #@gui : sep = separator(), 28. Preview type = choice("Full","Forward horizontal","Forward vertical","Backward horizontal","Backward vertical","Duplicate top","Duplicate left","Duplicate bottom","Duplicate right","Duplicate horizontal","Duplicate vertical","Checkered","Checkered inverse"), Preview split = point(50,50,0,0,200,200,200,0,10,0)
  41. #@gui : sep = separator(), note = note("<small>Original author: <i><a href="https://goo.gl/Ryf7Cv">David Tschumperl&#233;</a></i>&#59; extended by some nobody who calls themselves 'Joan Rake' or something.<p>Latest update: <i>2018/08/24</i>.</small>")
  42. fx_self_glitching_cascade :
  43. skip "${25=-skip ,}","${26=-skip ,}"
  44. shift {$4-50}%,{$5-50}%,0,0,$6,0
  45. repeat $! l[$>] if {!$3} split_opacity fi l[0] to_rgb
  46. if {$2}
  47. if {$1==0} rgb2srgb
  48. elif {$1==1} rgb2cmy
  49. elif {$1==2} rgb2hsv8
  50. elif {$1==3} rgb2hsl8
  51. elif {$1==4} rgb2hsi8
  52. elif {$1==5} rgb2lch8
  53. elif {$1==6} rgb2lab8
  54. elif {$1==7} rgb2ycbcrglic2
  55. elif {$1==8} rgb2yiq8
  56. elif {$1==9} rgb2yuv8
  57. elif {$1==10} rgb2hcy
  58. elif {$1==11} rgb2xyz8
  59. fi else
  60. if {$1==1} rgb2cmyk
  61. elif {$1==2} rgb2hsv
  62. elif {$1==3} rgb2hsl
  63. elif {$1==4} rgb2hsi
  64. elif {$1==5} rgb2lch
  65. elif {$1==6} rgb2lab
  66. elif {$1==7} rgb2ycbcr
  67. elif {$1==8} rgb2yiq
  68. elif {$1==9} rgb2yuv
  69. elif {$1==10} rgb2bayer 0
  70. elif {$1==11} rgb2xyz
  71. fi fi
  72. if $11 stype=$7 else stype=1 fi
  73. repeat $7
  74. +shift[0] {((([w,h]-1)*([$12,$13]-[$9,$10]+[u(-1,1),u(-1,1)]*sqrt((($12-$9)^2)+(($13-$10)^2))*($14^3)))/$stype)/100},0,0,$15
  75. m "_fx_custom_code_csg1_start : "$25"
  76. l[0] _fx_custom_code_csg1_start endl
  77. uncommand _fx_custom_code_csg1_start
  78. f.. "begin(
  79. const sign = $18?-1:1;
  80. );
  81. operate(mode,s1,s2,mult,power) =
  82. (mode==0?(s1 + s2):
  83. mode==1?(s1 * s2):
  84. mode==2?(s1 & s2):
  85. mode==3?(s1 | s2):
  86. mode==4?xor(s1,s2):
  87. mode==5?(s1^(s2*0.01)):
  88. mode==6?(s2^(s1*0.01)):
  89. mode==7?(s1%s2):
  90. mode==8?(s2%s1):
  91. mode==9?(s1 / s2):
  92. mode==10?(s2 / s1):
  93. mode==11?(s2 - s1):
  94. mode==12?(s1 - s2):
  95. mode==13?(s1 << s2):
  96. mode==14?(s2 << s1):
  97. mode==15?(s1 >> s2):
  98. mode==16?(s2 >> s1):
  99. mode==17?for(n=0,n<(s2%32),n++,rol(s1)):
  100. mode==18?for(n=0,n<(s1%32),n++,rol(s2)):
  101. mode==19?for(n=0,n<(s2%32),n++,ror(s1)):
  102. mode==20?for(n=0,n<(s1%32),n++,ror(s2)):
  103. mode==21?avg(s2,s1):
  104. mode==22?round(s1,s2,0):
  105. mode==23?round(s2,s1,0):
  106. mode==24?s2*sin(s1*2*pi/mult):
  107. mode==25?s1*sin(s2*2*pi/mult):
  108. mode==26?sign*s2*cos(s1*2*pi/mult):
  109. mode==27?sign*s1*cos(s2*2*pi/mult):
  110. mode==28?s2*tan(s1*pi/mult):
  111. mode==29?s1*tan(s2*pi/mult):
  112. mode==30?s2*sin(mult/(s1*2*pi)):
  113. mode==31?s1*sin(mult/(s2*2*pi)):
  114. mode==32?sign*s2*cos(mult/(s1*2*pi)):
  115. mode==33?sign*s1*cos(mult/(s2*2*pi)):
  116. mode==34?s2*tan(mult/(s1*pi)):
  117. mode==35?s1*tan(mult/(s2*pi)):
  118. mode==36?mult*var(s1,s2):
  119. mode==37?abs(s2 - s1):
  120. mode==38?min(s2,s1):
  121. mode==39?max(s2,s1):
  122. mode==40?0.005*s2*(((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power))+s1):
  123. mode==41?0.005*s1*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)+s2):
  124. mode==42?0.1*s2*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)*s1:
  125. mode==43?0.1*s2*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)/s1:
  126. mode==44?0.1*s1*(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)/s2:
  127. mode==45?0.001*s2*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s1):
  128. mode==46?0.001*s1*((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s2):
  129. mode==47?0.001*s2*(s1-(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
  130. mode==48?0.001*s1*(s2-(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
  131. mode==49?0.001*s2*abs((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s1):
  132. mode==50?0.001*s1*abs((j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)-s2):
  133. mode==51?0.00001*mult*var(s1,s2,(j(#-1,0,0,0,(c+1)%(s(#0)-1)+1)*2^power)):
  134. mode==52?(255-((255-s1)*(255-s2))):
  135. mode==53?(s1/(255-s2)):
  136. mode==54?(s2/(255-s1)):
  137. mode==55?((255-s2)/s1*255):
  138. mode==56?((255-s1)/s2*255):
  139. mode==57?((((s1)/255)^2)^(2*(0.5-(s2/255))))*255:
  140. mode==58?((((s2)/255)^2)^(2*(0.5-(s1/255))))*255:
  141. mode==59?sqrt(abs(s1*s2)):
  142. mode==60?(if((s1+s2)>=255,255,0)):
  143. (if((s1+s2)<=255,0,255)));
  144. val = sign*((2^$16)*j(#-1) + $17);operate($19,val,i,$20,$16);
  145. " rm.
  146. if {$8}
  147. f "((((i*$20)+$21)%$22)*$23)+$24;"
  148. fi
  149. done
  150. if {!$8}
  151. f "((((i*$20)+$21)%$22)*$23)+$24;"
  152. fi
  153. if {$2}
  154. if {$1==0} srgb2rgb
  155. elif {$1==1} cmy2rgb
  156. elif {$1==2} hsv82rgb
  157. elif {$1==3} hsl82rgb
  158. elif {$1==4} hsi82rgb
  159. elif {$1==5} lch82rgb
  160. elif {$1==6} lab82rgb
  161. elif {$1==7} ycbcrglic2rgb
  162. elif {$1==8} yiq82rgb
  163. elif {$1==9} yuv82rgb
  164. elif {$1==10} hcy2rgb
  165. elif {$1==11} xyz82rgb
  166. fi else
  167. if {$1==1} cmyk2rgb
  168. elif {$1==2} hsv2rgb
  169. elif {$1==3} hsl2rgb
  170. elif {$1==4} hsi2rgb
  171. elif {$1==5} lch2rgb
  172. elif {$1==6} lab2rgb
  173. elif {$1==7} ycbcr2rgb
  174. elif {$1==8} yiq2rgb
  175. elif {$1==9} yuv2rgb
  176. elif {$1==10} bayer2rgb 0,0,0
  177. elif {$1==11} xyz2rgb
  178. fi fi
  179. endl a c endl done
  180. fx_self_glitching_cascade_preview :
  181. fx_self_glitching_cascade $*
  182. #repeat {max(0,l)}
  183. #ac[$>] "-fx_self_glitching_cascade $*",$27
  184. #done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement