Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias distortion {
- if (!$exists(tex.bmp)) {
- window -pfh @gentex 0 0 104 104
- drawrect -nf @gentex 1 1 0 0 105 105
- drawline -n @gentex 4 1 0 1 105 1
- drawline -n @gentex 4 1 1 0 1 105
- drawline -n @gentex 4 1 0 102 105 102
- drawline -n @gentex 4 1 102 0 102 105
- drawline -n @gentex 4 1 1 1 102 102
- drawline -n @gentex 4 1 1 102 102 1
- drawdot @gentex
- drawsave @gentex tex.bmp
- window -c @gentex
- }
- if (!$window(@distortion)) window -podC +dL @distortion 1 1 800 800
- if (!$window(@distortion.bg)) window -pdCw0h @distortion.bg 1 1 800 800
- distortion.init $1
- distortion.tick
- }
- alias picfill {
- drawpic -cnt $1 0 0 0 $2
- var %i = $pic( $2 ).width, %g = $calc(%i + $window($1).w)
- while (%i < %g) {
- drawcopy -nt $1 0 0 0 %i $pic($2).height $1 %i 0 %i $pic($2).height
- %i = $calc(%i * 2)
- }
- %i = $pic($2).height
- %g = $calc(%i + $window($1).h)
- while (%i < %g) {
- drawcopy -nt $1 0 0 0 $window($1).w %i $1 0 %i $window($1).w %i
- %i = $calc(%i * 2)
- }
- }
- alias distortion.init {
- picfill @distortion.bg $iif($1,$1,tex.bmp)
- set %distortiontick 1
- if (!%momentanquali) set %momentanquali 1
- .timerqualiinc 1 2 distortion.incquali $1
- }
- alias distortion.tick {
- ;drawrot -cn @distortion.bg 1
- var %xdist = 1, %ydist = 1, %mw = $window(@distortion).bw, %mh = $window(@distortion).bh
- var %bw = $window(@distortion.bg).bw, %bh = $window(@distortion.bg).bh, %p = $calc((%bw - %mw) / 2)
- if ($mouse.key & 1) && (@distortion isin $mouse.win) drawdot @distortion.bg 9 1 $mouse.x $mouse.y
- ;drawscroll -n @distortion.bg %xdist %ydist 0 0 %bw %bh
- radialdistort @distortion.bg $calc(%bw / 2) $calc(%bh / 2) $calc(%bh / 2) %momentanquali
- drawcopy @distortion.bg 0 0 800 800 @distortion 0 0
- drawtext -b @distortion 9 1 2 2 <Current picture: %momentanquali iterations per frame, Frame %distortiontick $+ >
- ; picfill @distortion.bg tex.jpg
- drawdot @distortion.bg
- .timerdistortion -m 1 1 distortion.tick
- inc %distortiontick
- }
- alias distortion.incquali {
- if (%distortiontick > 5) {
- inc %momentanquali $int($calc(%momentanquali * 1.5 / ($log(%momentanquali) + 1)))
- distortionreset $1
- }
- else .timerincquali 1 2 distortion.incquali
- }
- alias distortionreset {
- drawrect -fn @distortion.bg 1 1 0 0 $window(@distortion.bg).dw $window(@distortion.bg).dh
- distortion $1
- }
- alias radialdistort {
- ; radialdistort %w = $1 x y radius quality
- var %i, %r = $4, %q = $5, %x = $2, %y = $3,
- %i = %q
- var %tx, %ty, %w, %h, %tw, %th, %ttx, %tty
- while (%i > 1) {
- ;obere zwei quadranten:
- %1tx = $calc(%x - %r * (%i / %q))
- %1ty = $calc(%y - %r * (%i / %q))
- %1w = $calc(%r * (%i / %q) * 2)
- %1h = $calc(%r * (%i / %q))
- ;untere zwei quadranten:
- %2tx = %1tx
- %2ty = %y
- %2w = %1w
- %2h = %1h
- ;linke zwei quadranten
- %3tx = %1tx
- %3ty = %1ty
- %3w = $calc(%r * (%i / %q))
- %3h = $calc(%r * (%i / %q) * 2)
- ;rechte zwei quadranten:
- %4tx = %x
- %4ty = $calc(%y - %r * (%i / %q))
- %4w = %3w
- %4h = %3h
- dec %i
- ;obere zwei quadranten:
- %1ttx = $calc(%x - %r * (%i / %q))
- %1tty = $calc(%y - %r * (%i / %q))
- %1tw = $calc(%r * (%i / %q) * 2)
- %1th = $calc(%r * (%i / %q))
- ;untere zwei quadranten:
- %2ttx = %1ttx
- %2tty = %y
- %2tw = %1tw
- %2th = %1th
- ;linke zwei quadranten
- %3ttx = %1ttx
- %3tty = %1tty
- %3tw = $calc(%r * (%i / %q))
- %3th = $calc(%r * (%i / %q) * 2)
- ;rechte zwei quadranten:
- %4ttx = %x
- %4tty = $calc(%y - %r * (%i / %q))
- %4tw = %3tw
- %4th = %3th
- drawcopy -n $1 %1tx %1ty %1w %1h $1 %1ttx %1tty %1tw %1th
- drawcopy -n $1 %2tx %2ty %2w %2h $1 %2ttx %2tty %2tw %2th
- drawcopy -n $1 %3tx %3ty %3w %3h $1 %3ttx %3tty %3tw %3th
- drawcopy -n $1 %4tx %4ty %4w %4h $1 %4ttx %4tty %4tw %4t
- ;drawrot $1 180
- }
- var %ww = $calc($window($1).dw / 2), %wh = $calc($window($1).dh / 2)
- drawcopy -n $1 %ww %wh %ww %wh $1 %ww %wh $calc(%ww * -1) %wh
- %ww = $calc(%ww * 2)
- drawcopy -n $1 0 %wh %ww %wh $1 0 %wh %ww $calc( -1 * %wh)
- drawdot $1
- }
- on *:keydown:@distortion:*: {
- distortion.kill
- }
- on *:keydown:@distortion.bg:*: {
- distortion.kill
- }
- alias distortion.kill {
- unset %momentanquali
- window -c @distortion.bg
- window -c @distortion
- .timerdistortion off
- .timerqualiinc off
- .timerincquali off
- unset %distortion*
- drawpic -c
- }
- 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 }
- alias scramble {
- }
Add Comment
Please, Sign In to add comment