Guest User

Untitled

a guest
Apr 10th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. alias distortion {
  2. if (!$exists(tex.bmp)) {
  3. window -pfh @gentex 0 0 104 104
  4. drawrect -nf @gentex 1 1 0 0 105 105
  5. drawline -n @gentex 4 1 0 1 105 1
  6. drawline -n @gentex 4 1 1 0 1 105
  7. drawline -n @gentex 4 1 0 102 105 102
  8. drawline -n @gentex 4 1 102 0 102 105
  9. drawline -n @gentex 4 1 1 1 102 102
  10. drawline -n @gentex 4 1 1 102 102 1
  11. drawdot @gentex
  12. drawsave @gentex tex.bmp
  13. window -c @gentex
  14. }
  15. if (!$window(@distortion)) window -podC +dL @distortion 1 1 800 800
  16. if (!$window(@distortion.bg)) window -pdCw0h @distortion.bg 1 1 800 800
  17. distortion.init $1
  18. distortion.tick
  19. }
  20. alias picfill {
  21. drawpic -cnt $1 0 0 0 $2
  22. var %i = $pic( $2 ).width, %g = $calc(%i + $window($1).w)
  23. while (%i < %g) {
  24. drawcopy -nt $1 0 0 0 %i $pic($2).height $1 %i 0 %i $pic($2).height
  25. %i = $calc(%i * 2)
  26. }
  27. %i = $pic($2).height
  28. %g = $calc(%i + $window($1).h)
  29. while (%i < %g) {
  30. drawcopy -nt $1 0 0 0 $window($1).w %i $1 0 %i $window($1).w %i
  31. %i = $calc(%i * 2)
  32. }
  33. }
  34. alias distortion.init {
  35. picfill @distortion.bg $iif($1,$1,tex.bmp)
  36. set %distortiontick 1
  37. if (!%momentanquali) set %momentanquali 1
  38. .timerqualiinc 1 2 distortion.incquali $1
  39. }
  40. alias distortion.tick {
  41. ;drawrot -cn @distortion.bg 1
  42.  
  43. var %xdist = 1, %ydist = 1, %mw = $window(@distortion).bw, %mh = $window(@distortion).bh
  44. var %bw = $window(@distortion.bg).bw, %bh = $window(@distortion.bg).bh, %p = $calc((%bw - %mw) / 2)
  45. if ($mouse.key & 1) && (@distortion isin $mouse.win) drawdot @distortion.bg 9 1 $mouse.x $mouse.y
  46.  
  47. ;drawscroll -n @distortion.bg %xdist %ydist 0 0 %bw %bh
  48.  
  49. radialdistort @distortion.bg $calc(%bw / 2) $calc(%bh / 2) $calc(%bh / 2) %momentanquali
  50. drawcopy @distortion.bg 0 0 800 800 @distortion 0 0
  51. drawtext -b @distortion 9 1 2 2 <Current picture: %momentanquali iterations per frame, Frame %distortiontick $+ >
  52. ; picfill @distortion.bg tex.jpg
  53.  
  54. drawdot @distortion.bg
  55. .timerdistortion -m 1 1 distortion.tick
  56. inc %distortiontick
  57. }
  58. alias distortion.incquali {
  59. if (%distortiontick > 5) {
  60. inc %momentanquali $int($calc(%momentanquali * 1.5 / ($log(%momentanquali) + 1)))
  61. distortionreset $1
  62. }
  63. else .timerincquali 1 2 distortion.incquali
  64. }
  65. alias distortionreset {
  66. drawrect -fn @distortion.bg 1 1 0 0 $window(@distortion.bg).dw $window(@distortion.bg).dh
  67. distortion $1
  68. }
  69. alias radialdistort {
  70. ; radialdistort %w = $1 x y radius quality
  71. var %i, %r = $4, %q = $5, %x = $2, %y = $3,
  72. %i = %q
  73. var %tx, %ty, %w, %h, %tw, %th, %ttx, %tty
  74. while (%i > 1) {
  75.  
  76. ;obere zwei quadranten:
  77. %1tx = $calc(%x - %r * (%i / %q))
  78. %1ty = $calc(%y - %r * (%i / %q))
  79. %1w = $calc(%r * (%i / %q) * 2)
  80. %1h = $calc(%r * (%i / %q))
  81.  
  82. ;untere zwei quadranten:
  83. %2tx = %1tx
  84. %2ty = %y
  85. %2w = %1w
  86. %2h = %1h
  87.  
  88. ;linke zwei quadranten
  89. %3tx = %1tx
  90. %3ty = %1ty
  91. %3w = $calc(%r * (%i / %q))
  92. %3h = $calc(%r * (%i / %q) * 2)
  93.  
  94. ;rechte zwei quadranten:
  95. %4tx = %x
  96. %4ty = $calc(%y - %r * (%i / %q))
  97. %4w = %3w
  98. %4h = %3h
  99.  
  100. dec %i
  101.  
  102. ;obere zwei quadranten:
  103. %1ttx = $calc(%x - %r * (%i / %q))
  104. %1tty = $calc(%y - %r * (%i / %q))
  105. %1tw = $calc(%r * (%i / %q) * 2)
  106. %1th = $calc(%r * (%i / %q))
  107.  
  108. ;untere zwei quadranten:
  109. %2ttx = %1ttx
  110. %2tty = %y
  111. %2tw = %1tw
  112. %2th = %1th
  113.  
  114. ;linke zwei quadranten
  115. %3ttx = %1ttx
  116. %3tty = %1tty
  117. %3tw = $calc(%r * (%i / %q))
  118. %3th = $calc(%r * (%i / %q) * 2)
  119.  
  120. ;rechte zwei quadranten:
  121. %4ttx = %x
  122. %4tty = $calc(%y - %r * (%i / %q))
  123. %4tw = %3tw
  124. %4th = %3th
  125.  
  126. drawcopy -n $1 %1tx %1ty %1w %1h $1 %1ttx %1tty %1tw %1th
  127. drawcopy -n $1 %2tx %2ty %2w %2h $1 %2ttx %2tty %2tw %2th
  128. drawcopy -n $1 %3tx %3ty %3w %3h $1 %3ttx %3tty %3tw %3th
  129. drawcopy -n $1 %4tx %4ty %4w %4h $1 %4ttx %4tty %4tw %4t
  130.  
  131.  
  132. ;drawrot $1 180
  133. }
  134.  
  135. var %ww = $calc($window($1).dw / 2), %wh = $calc($window($1).dh / 2)
  136. drawcopy -n $1 %ww %wh %ww %wh $1 %ww %wh $calc(%ww * -1) %wh
  137. %ww = $calc(%ww * 2)
  138. drawcopy -n $1 0 %wh %ww %wh $1 0 %wh %ww $calc( -1 * %wh)
  139.  
  140. drawdot $1
  141. }
  142. on *:keydown:@distortion:*: {
  143. distortion.kill
  144. }
  145. on *:keydown:@distortion.bg:*: {
  146. distortion.kill
  147. }
  148. alias distortion.kill {
  149. unset %momentanquali
  150. window -c @distortion.bg
  151. window -c @distortion
  152. .timerdistortion off
  153. .timerqualiinc off
  154. .timerincquali off
  155. unset %distortion*
  156. drawpic -c
  157. }
  158. alias scramblegen { var %x = UDLRFB,%y = '2,%n = 1,%r,%p,%t | while %n <= $iif($1,$1,25) { %t = $remove(%x,%p,$replace(%p,u,d,d,u,l,r,r,l,b,f,f,b)) | %p = $mid(%t,$rand(1,4),1) | %r = %r %p $+ $iif($mid(%y,$rand(1,6),1),$v1) | inc %n } | return %r }
  159. alias scramble {
  160. }
Add Comment
Please, Sign In to add comment