Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. #@gui Mesh blend : fx_mesh_blend, fx_mesh_blend_preview()
  2. #@gui : note = note("Universal blending algorithm. Resizes an RGBA 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. Final blended image has dimensions of bottom layer. 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(2,"Nearest","Average","Bilinear","Grid","Bicubic")
  6. #@gui : Reverse blending layers = bool(0)
  7. #@gui : Dimensions = choice("Bottom layer","Top layer")
  8. #@gui : Alpha = bool(0)
  9. #@gui : Keep mesh = bool(0)
  10. _fx_mesh_blend :
  11. r. 256,256,100%,100%,{1+$1}
  12. if $4 to_rgba else to_rgb fi
  13. if $2 rv[0,1] fi
  14. f[$3] "i(#2,255-[i(#0),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")
  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. * {1/255} f "i-0.5+(atan((i-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. fi endl
  47. rv
  48. fx_mesh_blend 0,0,$6,$7,$8,$10
  49. if $9 ac "n 0,255",rgba fi
  50. fx_blend_bomb :
  51. if {$2==0} repeat {int($!/2)} l[$>,{$>+1}] _fx_blend_bomb ${3-12} endl done
  52. elif {$2==1} repeat $! l[$>] [0] _fx_blend_bomb ${3-12} endl done fi
  53. fx_blend_bomb_preview :
  54. fx_blend_bomb $*
  55.  
  56. #@gui JIFF [JPEG] self-bomb : fx_jiff_bomb, fx_jiff_bomb_preview()
  57. #@gui : note = note("OI! TRY SMOOTHING THIS!")
  58. #@gui : note = note("<small>Adds JPEG artefacts and then self-bomb-blends.</small>")
  59. #@gui : Recompute = button(0)
  60. #@gui : Quality (%) = int(50,1,100)
  61. #@gui : Mesh X = float(16,1,256)
  62. #@gui : Mesh Y = float(16,1,256)
  63. #@gui : Mesh smoothness = float(0.5,0,10)
  64. #@gui : Contrast scheme = choice(1,"Arctan","Clip")
  65. #@gui : Mesh contrast = float(75,0,100)
  66. #@gui : Normalise = bool(0)
  67. #@gui : Output mesh = bool(0)
  68. fx_jiff_bomb :
  69. repeat $! l[$>]
  70. fx_jpeg_artefacts $2
  71. fx_blend_bomb $1,1,${3-7},0,0,${8-9}
  72. endl done
  73. fx_jiff_bomb_preview :
  74. fx_jiff_bomb $*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement