Advertisement
Guest User

Untitled

a guest
Sep 30th, 2018
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1. #@gui Mesh blend : fx_mesh_blend, fx_mesh_blend_preview(1)
  2. #@gui : note = note("Universal blending algorithm. Resizes an RGB&#40;A&#41; image to a 256x256 image and uses it as an RGBA LUT 'transfer function mesh' to blend two other images together. Based on method shown <a href="https://discuss.pixls.us/t/im-generating-new-blending-modes-for-krita/8104/16">on discuss.pixls.us</a>.")
  3. #@gui : sep = separator(), note = note("<small>[0] is bottom layer, [1] is top layer, [2] is mesh. Mesh origin is at bottom-left. Plugin GUI preview does not accurately show mesh.</small>")
  4. #@gui : Process as = choice(0,"Three-by-three","Self-mesh and self-blend for each layer")
  5. #@gui : Resize interpolation = choice(3,"None","Nearest","Average","Bilinear","Grid","Bicubic")
  6. #@gui : Reverse blending layers = bool(0)
  7. #@gui : Dimensions = choice("Bottom layer","Top layer")
  8. #@gui : Blend alpha channels = bool(0)
  9. #@gui : Keep mesh = bool(0)
  10. _fx_mesh_blend :
  11. r. 256,256,100%,100%,$1
  12. if $4 to_rgba else to_rgb fi
  13. if $2 rv[0,1] fi
  14. f[$3] "i(#2,i(#0),256-i(#1))"
  15. if {!$5} rm[2] fi
  16. if $3 rm[0] else rm[1] fi
  17. fx_mesh_blend :
  18. if {$1==0} repeat {int($!/3)} l[$>-{$>+2}] rv _fx_mesh_blend ${2-6} endl done
  19. elif {$1==1} repeat $! l[$>] [0]x2 _fx_mesh_blend ${2-6} endl done fi
  20. fx_mesh_blend_preview :
  21. fx_mesh_blend $*
  22.  
  23. #@gui Bomb blend : fx_blend_bomb, fx_blend_bomb_preview()
  24. #@gui : note = note("Creates a random transfer function 'mesh' and then blends images accordingly. Based on method shown <a href="https://discuss.pixls.us/t/im-generating-new-blending-modes-for-krita/8104/16">on discuss.pixls.us</a>.")
  25. #@gui : Recompute = button(0)
  26. #@gui : Process as = choice(1,"Two-by-two","Self-blend for each layer")
  27. #@gui : Mesh X = int(16,1,256)
  28. #@gui : Mesh Y = int(16,1,256)
  29. #@gui : Mesh smoothness = float(2,0,10)
  30. #@gui : Contrast scheme = choice("Arctan","Clip","Power")
  31. #@gui : Mesh contrast = float(50,0,100)
  32. #@gui : Reverse blending layers = bool(0)
  33. #@gui : Dimensions = choice("Bottom layer","Top layer")
  34. #@gui : Alpha = bool(0)
  35. #@gui : Normalise = bool(0)
  36. #@gui : Output mesh = bool(0)
  37. _fx_blend_bomb :
  38. to_rgba
  39. $1,$2,1,4 noise. 255
  40. if $8 ac. "noise 255",rgba_a fi
  41. r. 256,256 n. 0,255 blur. {$3^2}%
  42. l. if {$4==0}
  43. f "val = i/255; (val-0.5+(atan((val-0.5)*($5/10)^3)/pi)+0.5)*255" n 0,255
  44. elif {$4==1}
  45. c {($5-1/255)/2}%,{100-($5-1/255)/2}% n 0,255
  46. elif {$4==2}
  47. f "val = (2*i/255)-1; (val*(abs(val)^(0-($5/100)))+1)*255/2"
  48. fi endl
  49. rv
  50. fx_mesh_blend 0,1,$6,$7,$8,$10
  51. if $9 ac "n 0,255",rgba fi
  52. fx_blend_bomb :
  53. if {$2==0} repeat {int($!/2)} l[$>,{$>+1}] _fx_blend_bomb ${3-12} endl done
  54. elif {$2==1} repeat $! l[$>] [0] _fx_blend_bomb ${3-12} endl done fi
  55. fx_blend_bomb_preview :
  56. fx_blend_bomb $*
  57.  
  58. #@gui JIFF [JPEG] self-bomb : fx_jiff_bomb, fx_jiff_bomb_preview()
  59. #@gui : note = note("OI! TRY SMOOTHING THIS!")
  60. #@gui : note = note("<small>Adds JPEG artefacts and then self-bomb-blends. Use grid interpolation with scale factors above 1 to destroy the results even more.</small>")
  61. #@gui : Recompute = button(0)
  62. #@gui : sep = separator()
  63. #@gui : Quality (%) = int(50,1,100)
  64. #@gui : Mesh X = float(16,1,256)
  65. #@gui : Mesh Y = float(16,1,256)
  66. #@gui : Mesh smoothness = float(0.5,0,10)
  67. #@gui : Contrast scheme = choice(1,"Arctan","Clip","Power)
  68. #@gui : Mesh contrast = float(75,0,100)
  69. #@gui : Scale X = float(1,0.05,16)
  70. #@gui : Scale Y = float(1,0.05,16)
  71. #@gui : Interpolation = choice(0,"None","Nearest","Average","Bilinear","Grid","Bicubic")
  72. #@gui : Normalise = bool(0)
  73. #@gui : Output mesh = bool(0)
  74. #@gui : sep = separator()
  75. #@gui : Solidify alpha = bool(1)
  76. #@gui : Smoothness (%) = float(75,0,100)
  77. #@gui : Regularization = choice(1,"Isotropic","Delaunay-oriented","Edge-oriented")
  78. #@gui : Regularization iterations = int(20,0,100)
  79. #@gui : Dilation / erosion = int(0,-20,20)
  80. #@gui : Colorspace = choice(1,"sRGB","Linear RGB")
  81. fx_jiff_bomb :
  82. repeat $! l[$>]
  83. if $13
  84. +fx_solidify_td ${14-18}
  85. negate. rv blend alpha
  86. fi
  87. ww={w}
  88. hh={h}
  89. r {$8*100}%,{$9*100}%,100%,100%,$10
  90. fx_jpeg_artefacts $2
  91. fx_blend_bomb 0,1,${3-7},0,0,0,${11-12}
  92. r $ww,$hh,100%,100%,$10
  93. endl done
  94. fx_jiff_bomb_preview :
  95. fx_jiff_bomb $*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement