From 1267aa4c8481eaf6a780419ff1a17f9306ec6401 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 27 Sep 2017 13:57:50 +1300 Subject: [PATCH] Building ports framework --- README.md | 25 +- archives/presets/a6000.rin | 5 - archives/presets/album.rin | 45 --- archives/presets/album_demo.rin | 56 ---- archives/presets/album_duomic.rin | 45 --- archives/presets/album_extra.rin | 43 --- archives/presets/album_laeisthic.rin | 42 --- archives/presets/album_malice.rin | 25 -- archives/presets/album_soundtrack.rin | 42 --- archives/presets/blank.rin | 7 - archives/presets/camilare.rin | 21 -- archives/presets/default.rin | 13 - archives/presets/dictionarism.rin | 23 -- archives/presets/flower.rin | 10 - archives/presets/glyph.rin | 15 - archives/presets/icon.rin | 6 - archives/presets/itch.rin | 10 - archives/presets/logo.rin | 16 -- archives/presets/logo_nataniev.rin | 8 - archives/presets/logo_ronin.rin | 12 - archives/presets/marabu.rin | 12 - archives/presets/neauoire.rin | 12 - archives/presets/rabbits.rin | 7 - archives/presets/radial.rin | 22 -- archives/presets/ronin_splash.rin | 14 - archives/presets/rune.rin | 4 - archives/presets/symmetry.rin | 13 - archives/scripts/core/command.js | 149 ---------- archives/scripts/core/keyboard.js | 115 -------- archives/scripts/core/ronin.js | 175 ------------ archives/scripts/filters/balance.js | 21 -- archives/scripts/filters/chromatic.js | 64 ----- archives/scripts/filters/contrast.js | 23 -- archives/scripts/filters/filter.js | 93 ------ archives/scripts/filters/grey.js | 22 -- archives/scripts/filters/invert.js | 27 -- archives/scripts/filters/saturate.js | 22 -- archives/scripts/filters/sharpen.js | 57 ---- archives/scripts/filters/stencil.js | 83 ------ archives/scripts/modules/brush.js | 138 --------- archives/scripts/modules/brush.pointer.js | 146 ---------- archives/scripts/modules/cursor.js | 301 -------------------- archives/scripts/modules/default.js | 42 --- archives/scripts/modules/eye.js | 32 --- archives/scripts/modules/frame.js | 205 ------------- archives/scripts/modules/layer.js | 187 ------------ archives/scripts/modules/magnet.js | 99 ------- archives/scripts/modules/module.js | 167 ----------- archives/scripts/modules/overlay.js | 221 -------------- archives/scripts/modules/path.js | 149 ---------- archives/scripts/modules/render.js | 37 --- archives/scripts/modules/source.js | 147 ---------- archives/scripts/modules/terminal.js | 135 --------- archives/scripts/modules/terminal.widget.js | 21 -- archives/scripts/modules/type.js | 62 ---- archives/scripts/units/angle.js | 13 - archives/scripts/units/any.js | 12 - archives/scripts/units/bang.js | 11 - archives/scripts/units/color.js | 48 ---- archives/scripts/units/filepath.js | 12 - archives/scripts/units/method.js | 37 --- archives/scripts/units/mode.js | 13 - archives/scripts/units/option.js | 7 - archives/scripts/units/position.js | 56 ---- archives/scripts/units/range.js | 15 - archives/scripts/units/rect.js | 16 -- archives/scripts/units/setting.js | 39 --- archives/scripts/units/unit.js | 5 - archives/scripts/units/value.js | 14 - sources/index.html | 3 +- sources/scripts/docs.js | 9 +- sources/scripts/modules/brush.js | 32 +-- sources/scripts/modules/line.js | 1 - sources/scripts/port.js | 9 + sources/scripts/ronin.js | 2 - 75 files changed, 43 insertions(+), 3804 deletions(-) delete mode 100644 archives/presets/a6000.rin delete mode 100644 archives/presets/album.rin delete mode 100644 archives/presets/album_demo.rin delete mode 100644 archives/presets/album_duomic.rin delete mode 100644 archives/presets/album_extra.rin delete mode 100644 archives/presets/album_laeisthic.rin delete mode 100644 archives/presets/album_malice.rin delete mode 100644 archives/presets/album_soundtrack.rin delete mode 100644 archives/presets/blank.rin delete mode 100644 archives/presets/camilare.rin delete mode 100644 archives/presets/default.rin delete mode 100644 archives/presets/dictionarism.rin delete mode 100644 archives/presets/flower.rin delete mode 100644 archives/presets/glyph.rin delete mode 100644 archives/presets/icon.rin delete mode 100644 archives/presets/itch.rin delete mode 100644 archives/presets/logo.rin delete mode 100644 archives/presets/logo_nataniev.rin delete mode 100644 archives/presets/logo_ronin.rin delete mode 100644 archives/presets/marabu.rin delete mode 100644 archives/presets/neauoire.rin delete mode 100644 archives/presets/rabbits.rin delete mode 100644 archives/presets/radial.rin delete mode 100644 archives/presets/ronin_splash.rin delete mode 100644 archives/presets/rune.rin delete mode 100644 archives/presets/symmetry.rin delete mode 100644 archives/scripts/core/command.js delete mode 100644 archives/scripts/core/keyboard.js delete mode 100644 archives/scripts/core/ronin.js delete mode 100644 archives/scripts/filters/balance.js delete mode 100644 archives/scripts/filters/chromatic.js delete mode 100644 archives/scripts/filters/contrast.js delete mode 100644 archives/scripts/filters/filter.js delete mode 100644 archives/scripts/filters/grey.js delete mode 100644 archives/scripts/filters/invert.js delete mode 100644 archives/scripts/filters/saturate.js delete mode 100644 archives/scripts/filters/sharpen.js delete mode 100644 archives/scripts/filters/stencil.js delete mode 100644 archives/scripts/modules/brush.js delete mode 100644 archives/scripts/modules/brush.pointer.js delete mode 100644 archives/scripts/modules/cursor.js delete mode 100644 archives/scripts/modules/default.js delete mode 100644 archives/scripts/modules/eye.js delete mode 100644 archives/scripts/modules/frame.js delete mode 100644 archives/scripts/modules/layer.js delete mode 100644 archives/scripts/modules/magnet.js delete mode 100644 archives/scripts/modules/module.js delete mode 100644 archives/scripts/modules/overlay.js delete mode 100644 archives/scripts/modules/path.js delete mode 100644 archives/scripts/modules/render.js delete mode 100644 archives/scripts/modules/source.js delete mode 100644 archives/scripts/modules/terminal.js delete mode 100644 archives/scripts/modules/terminal.widget.js delete mode 100644 archives/scripts/modules/type.js delete mode 100644 archives/scripts/units/angle.js delete mode 100644 archives/scripts/units/any.js delete mode 100644 archives/scripts/units/bang.js delete mode 100644 archives/scripts/units/color.js delete mode 100644 archives/scripts/units/filepath.js delete mode 100644 archives/scripts/units/method.js delete mode 100644 archives/scripts/units/mode.js delete mode 100644 archives/scripts/units/option.js delete mode 100644 archives/scripts/units/position.js delete mode 100644 archives/scripts/units/range.js delete mode 100644 archives/scripts/units/rect.js delete mode 100644 archives/scripts/units/setting.js delete mode 100644 archives/scripts/units/unit.js delete mode 100644 archives/scripts/units/value.js create mode 100644 sources/scripts/port.js diff --git a/README.md b/README.md index fe1ef54..79138a0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Ronin Ronin is a simple open-source graphic design tool. + ## Modules ## brush @@ -9,14 +10,11 @@ Ronin is a simple open-source graphic design tool. - `opacity`, default 1 ### Methods ### Ports -- `speed`, no details. -- `distance`, no details. -- `red`, no details. -- `green`, no details. -- `blue`, no details. -- `alpha`, no details. -- `x`, no details. -- `noise`, no details. +- `->speed`{false,true}, **0/50** The cursor speed. +- `->distance`{false,true}, **0/null** The cursor distance. +- `->red`{true,true}, **0/255** The brush color value(red). +- `->green`{true,true}, **0/255** The brush color value(green). +- `->blue`{true,true}, **0/255** The brush color value(blue). ## eraser ### Settings ### Methods @@ -26,17 +24,16 @@ Ronin is a simple open-source graphic design tool. - `width`, default 930 - `height`, default 540 ### Methods -- `resize`, no details. -- `rescale`, no details. -- `crop`, no details. +- `resize:`, no details. +- `rescale:`, no details. +- `crop:`, no details. ### Ports ## line ### Settings - `steps`, default 100 ### Methods -- `tween`, no details. -- `stroke`, no details. +- `tween:`, no details. +- `stroke:`, no details. ### Ports -- `index`, no details. ## License See the [LICENSE](LICENSE.md) file for license rights and limitations (CC). diff --git a/archives/presets/a6000.rin b/archives/presets/a6000.rin deleted file mode 100644 index 1a17f96..0000000 --- a/archives/presets/a6000.rin +++ /dev/null @@ -1,5 +0,0 @@ -frame.resize 795x450 -source.load /target.jpg x450 -source:format jpg -source:quality 0.9 -source.save \ No newline at end of file diff --git a/archives/presets/album.rin b/archives/presets/album.rin deleted file mode 100644 index 6b3f8d2..0000000 --- a/archives/presets/album.rin +++ /dev/null @@ -1,45 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #ffffff - -~ PART 1 -layer.fill #b3b3b3 -source.load /duomic_1.jpg x700 -90,100 -type.write 400,67 "OPAL INQUISITORS" - -~ PART 2 -~ layer.fill #a6a6a6 -~ source.load /duomic_2.jpg x700 -65,100 -~ type.write 400,67 "PORTALION" - -~ PART 3 -~ layer.fill #b3b3b3 -~ source.load /duomic_3.jpg x700 -75,100 -~ type.write 400,67 "DEI DAIN" - -source.load /nataniev.small.white.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "DUOMIC" -type:font DIN -type:size 10 - -~ PART 1 -type.write 250,82 "2015.09" -type.write 400,82 "4 TRACKS" -type.write 110,83 "PART 1" - -~ PART 2 -~ type.write 250,82 "2016.10" -~ type.write 400,82 "4 TRACKS" -~ type.write 110,83 "PART 2" - -~ PART 3 -~ type.write 250,82 "2013.06" -~ type.write 400,82 "10 TRACKS" -~ type.write 110,83 "PART 3" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_demo.rin b/archives/presets/album_demo.rin deleted file mode 100644 index 1559a71..0000000 --- a/archives/presets/album_demo.rin +++ /dev/null @@ -1,56 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #000 -layer.fill #A1A1A1 - -~ PART 1 -type.write 400,67 "SUPERVISITOR" - -~ PART 2 -~ type.write 400,67 "SUPERWORKER" - -source.load /nataniev.small.black.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "DEMO" -type:font DIN -type:size 10 - -~ PART 1 -type.write 250,82 "2012.04" -type.write 400,82 "4 TRACKS" -type.write 110,83 "MICROBRUTE" -path:line_color black ; -path:line_width 20 ; -path:line_cap square ; -path.stroke M240,400 l60,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 M300,440 a20,20 0 0,1 20,20 l0,20 M240,400 l0,80 ; -path.stroke M360,400 l0,60 a20,20 0 0,0 20,20 l40,0 a20,-20 0 0,0 20,-20 l0,-60 M440,460 l0,20 ; -path.stroke M480,400 l80,0 M520,400 l0,80 ; -path.stroke M120,400 l60,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 M180,440 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 ; -path:line_color #A1A1A1 ; -path:line_cap round ; -path:line_width 1 ; -path.stroke M110,400 l70,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-70,0 M180,440 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-70,0 M240,490 l0,-90 l60,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 M300,440 a20,20 0 0,1 20,20 l0,30 M360,390 l0,70 a20,20 0 0,0 20,20 l40,0 a20,-20 0 0,0 20,-20 l0,-70 l0,100 M470,400 l100,0 M520,400 l0,90 ; -type:size 20 -type.write 110,550 "ARTURIA'S MICROBRUTE" - -~ PART 2 -~ type.write 250,82 "2017.04" -~ type.write 400,82 "3 TRACKS" -~ type.write 110,83 "オフィス" -~ magnet.grid 20x20 4,4 -~ path:line_color black -~ path:line_width 20 -~ path:line_cap butt -~ path.stroke M280,400 a40,40 0 0,1 40,40 a-40,40 0 0,1 -40,40 l0,0 a-40,-40 0 0,1 -40,-40 a40,-40 0 0,1 40,-40 M120,490 l0,-90 l60,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 M350,400 l70,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-40,0 a-20,20 0 0,0 -20,20 l0,20 l90,0 M480,390 l0,30 a20,20 0 0,0 20,20 l60,0 M560,390 l0,100 ; -~ path:line_color #A1A1A1 -~ path:line_cap round -~ path:line_width 1 -~ path.stroke M280,400 a40,40 0 0,1 40,40 a-40,40 0 0,1 -40,40 l0,0 a-40,-40 0 0,1 -40,-40 a40,-40 0 0,1 40,-40 M120,490 l0,-90 l60,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-60,0 M350,400 l70,0 a20,20 0 0,1 20,20 a-20,20 0 0,1 -20,20 l-40,0 a-20,20 0 0,0 -20,20 l0,20 l90,0 M480,390 l0,30 a20,20 0 0,0 20,20 l60,0 M560,390 l0,100 ; -~ type:size 20 -~ type.write 110,550 "TEENAGE ENGINEERING'S POCKET OPERATOR 24" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_duomic.rin b/archives/presets/album_duomic.rin deleted file mode 100644 index 0613fb9..0000000 --- a/archives/presets/album_duomic.rin +++ /dev/null @@ -1,45 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #ffffff - -~ PART 1 -~ layer.fill #b3b3b3 -~ source.load /duomic_1.jpg x700 -90,100 -~ type.write 400,67 "OPAL INQUISITORS" - -~ PART 2 -~ layer.fill #a6a6a6 -~ source.load /duomic_2.jpg x700 -65,100 -~ type.write 400,67 "PORTALION" - -~ PART 3 -layer.fill #b3b3b3 -source.load /duomic_3.jpg x700 -75,100 -type.write 400,67 "DEI DAIN" - -source.load /nataniev.small.white.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "DUOMIC" -type:font DIN -type:size 10 - -~ PART 1 -~ type.write 250,82 "2015.09" -~ type.write 400,82 "4 TRACKS" -~ type.write 110,83 "PART 1" - -~ PART 2 -~ type.write 250,82 "2016.10" -~ type.write 400,82 "4 TRACKS" -~ type.write 110,83 "PART 2" - -~ PART 3 -type.write 250,82 "2013.06" -type.write 400,82 "10 TRACKS" -type.write 110,83 "PART 3" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_extra.rin b/archives/presets/album_extra.rin deleted file mode 100644 index 9c496f3..0000000 --- a/archives/presets/album_extra.rin +++ /dev/null @@ -1,43 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #fff -layer.fill #1a1a1a - -~ PART 1 -~ source.load /soundtrack_oquonie.jpg x800 -235,0 -~ type.write 400,67 "IMPOSSIBLE SPACES" - -~ PART 2 -~ source.load /soundtrack_rabbits.jpg x800 0,0 -~ type.write 400,67 "RABBITS" - -~ PART 3 -source.load /extra_4.jpg x800 0,20 -type.write 400,67 "DAMOISEAU CANALX" - -source.load /nataniev.small.white.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "EXTRA" -type:font DIN -type:size 10 - -~ PART 1 -~ type.write 250,82 "2014.02" -~ type.write 400,82 "18 TRACKS" -~ type.write 110,83 "OQUONIE" - -~ PART 2 -~ type.write 250,82 "2014.03" -~ type.write 400,82 "OPEN" -~ type.write 110,83 "HUNDRED RABBITS" - -~ PART 3 -type.write 250,82 "2014.08" -type.write 400,82 "4 TRACKS" -type.write 110,83 "PART 4" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_laeisthic.rin b/archives/presets/album_laeisthic.rin deleted file mode 100644 index 1418b9a..0000000 --- a/archives/presets/album_laeisthic.rin +++ /dev/null @@ -1,42 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #000 - -~ PART 1 -~ source.load /laeisth_1.jpg x800 -250,0 -~ type.write 400,67 "CHILDREN OF BRAMBLE" - -~ PART 2 -source.load /laeisth_2.jpg x800 -250,0 -type.write 400,67 "KNOWN MAGYE" - -~ PART 3 -~ source.load /laeisth_3.jpg x800 -250,0 -~ type.write 400,67 "EXTENDED SLEEP" - -source.load /nataniev.small.black.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "LAEISTHIC" -type:font DIN -type:size 10 - -~ PART 1 -~ type.write 250,82 "2012.04" -~ type.write 400,82 "4 TRACKS" -~ type.write 110,83 "PART 1" - -~ PART 2 -type.write 250,82 "2014.03" -type.write 400,82 "6 TRACKS" -type.write 110,83 "PART 2" - -~ PART 3 -~ type.write 250,82 "2015.05" -~ type.write 400,82 "4 TRACKS" -~ type.write 110,83 "PART 3" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_malice.rin b/archives/presets/album_malice.rin deleted file mode 100644 index 3dd072c..0000000 --- a/archives/presets/album_malice.rin +++ /dev/null @@ -1,25 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #ffffff - -~ PART 1 -layer.fill #72dec2 -source.load /malice_1.jpg x800 -90,0 -type.write 400,67 "COLLECTED WORKS" - -source.load /nataniev.small.white.svg x40 50,50 -type.write 250,67 "害意" -type.write 110,67 "MALICE" -type:font DIN -type:size 10 - -~ PART 1 -type.write 250,82 "2016.07" -type.write 400,82 "4 TRACKS" -type.write 110,83 "2008-2015" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/album_soundtrack.rin b/archives/presets/album_soundtrack.rin deleted file mode 100644 index bbb5325..0000000 --- a/archives/presets/album_soundtrack.rin +++ /dev/null @@ -1,42 +0,0 @@ -frame.resize 800x800 -type:size 13 -type:font DIN Medium -type:color #000 - -~ PART 1 -~ source.load /soundtrack_oquonie.jpg x800 -235,0 -~ type.write 400,67 "IMPOSSIBLE SPACES" - -~ PART 2 -~ source.load /soundtrack_rabbits.jpg x800 0,0 -~ type.write 400,67 "RABBITS" - -~ PART 3 -source.load /soundtrack_purgateus.jpg x800 0,0 -type.write 400,67 "WHERE UNDERWATER IS" - -source.load /nataniev.small.black.svg x40 50,50 -type.write 250,67 "ALICEFFEKT" -type.write 110,67 "SOUNDTRACK" -type:font DIN -type:size 10 - -~ PART 1 -~ type.write 250,82 "2014.02" -~ type.write 400,82 "18 TRACKS" -~ type.write 110,83 "OQUONIE" - -~ PART 2 -~ type.write 250,82 "2014.03" -~ type.write 400,82 "OPEN" -~ type.write 110,83 "HUNDRED RABBITS" - -~ PART 3 -type.write 250,82 "2014.05" -type.write 400,82 "6 TRACKS" -type.write 110,83 "PURGATEUS" - -~ Save -source:format jpg -source:quality 1 -source.save \ No newline at end of file diff --git a/archives/presets/blank.rin b/archives/presets/blank.rin deleted file mode 100644 index a5a96eb..0000000 --- a/archives/presets/blank.rin +++ /dev/null @@ -1,7 +0,0 @@ -frame.resize 500x500 -layer.fill #eeeeee -brush:color #000000 -brush:size 3 -frame.select main -brush.add 1,1 -brush.add -1,-1 \ No newline at end of file diff --git a/archives/presets/camilare.rin b/archives/presets/camilare.rin deleted file mode 100644 index d04a27b..0000000 --- a/archives/presets/camilare.rin +++ /dev/null @@ -1,21 +0,0 @@ -frame.resize 300x300 -layer.fill #000000 -path:line_width 28 -path:line_cap butt -magnet:color #999 -magnet.grid 15x15 4,4 -frame.select logo~ -brush:color #72dec2 -path:line_cap round -path.stroke M150,240 l0,-30 a60,-60 0 0,1 60,-60 l30,0 l0,30 l-30,0 a-30,30 0 0,0 -30,30 l0,30 l30,0 l0,-30 -path.stroke M150,60 l0,30 a-60,60 0 0,1 -60,60 l-30,0 l0,-30 l30,0 a30,-30 0 0,0 30,-30 l0,-30 l-30,0 l0,30 -path.stroke M120,240 l0,-30 a-30,-30 0 0,0 -30,-30 l-30,0 l0,30 l30,0 -path.stroke M180,60 l0,30 a30,30 0 0,0 30,30 l30,0 l0,-30 l-30,0 -path:line_cap square -path.stroke M150,75 l0,-15 M180,75 l0,-15 M150,225 l0,15 M120,225 l0,15 -path:line_cap round -path.stroke M90,210 l0,30 M210,210 l30,0 M210,90 l0,-30 M90,90 l-30,0 -path.stroke M90,240 l-30,0 M60,90 l0,-30 M210,60 l30,0 M240,210 l0,30 -path:line_cap square -path.stroke M240,225 l0,15 M75,240 l-15,0 M60,75 l0,-15 M225,60 l15,0 -magnet.clear \ No newline at end of file diff --git a/archives/presets/default.rin b/archives/presets/default.rin deleted file mode 100644 index a8ed64e..0000000 --- a/archives/presets/default.rin +++ /dev/null @@ -1,13 +0,0 @@ -frame.resize 300x300 -frame.select background -~ layer.fill #f1f1f1 -frame.select main -frame.select logo -path:line_width 30 -path:line_color #000 -path.stroke M60,60 l120,0 a60,60 0 0,1 60,60 a-60,60 0 0,1 -60,60 l-120,0 M180,180 a60,60 0 0,1 60,60 -magnet.grid 15x15 4,4 -magnet.clear -brush:color #72dec2 -brush:size 10 -source.save \ No newline at end of file diff --git a/archives/presets/dictionarism.rin b/archives/presets/dictionarism.rin deleted file mode 100644 index 347fc67..0000000 --- a/archives/presets/dictionarism.rin +++ /dev/null @@ -1,23 +0,0 @@ -frame.resize 420x420 ; -brush:color #ff0000 ; -magnet.grid 15x15 4,4 ; -frame.select main ; -path:line_width 30 ; -path:line_color #ffffff ; -path.stroke M240,180 l0,-90 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 a-30,30 0 0,1 -30,30 l-180,0 a-30,-30 0 0,1 -30,-30 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 l0,180 a-30,30 0 0,1 -30,30 a-30,-30 0 0,1 -30,-30 a30,-30 0 0,1 30,-30 l180,0 a30,30 0 0,1 30,30 a-30,30 0 0,1 -30,30 a-30,-30 0 0,1 -30,-30 l0,-90 ; -path:line_width 1 ; -path:line_color #000000 ; -path.stroke M240,180 l0,-90 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 a-30,30 0 0,1 -30,30 l-180,0 a-30,-30 0 0,1 -30,-30 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 l0,180 a-30,30 0 0,1 -30,30 a-30,-30 0 0,1 -30,-30 a30,-30 0 0,1 30,-30 l180,0 a30,30 0 0,1 30,30 a-30,30 0 0,1 -30,30 a-30,-30 0 0,1 -30,-30 l0,-90 ; -path:line_color #ffffff ; -path:line_width 4 ; -path:line_cap butt ; -path.stroke M105,120 l30,0 M240,105 l0,30 M225,240 l30,0 M120,225 l0,30 ; -path:line_width 1 ; -path:line_color #000000 ; -path.stroke M120,105 l0,30 M225,120 l30,0 M240,225 l0,30 M135,240 l-30,0 ; -path:line_width 10 ; -path:line_color #cccccc ; -path.stroke M100,105 l0,30 M140,105 l0,30 M260,225 l0,30 M220,225 l0,30 M225,100 l30,0 M225,140 l30,0 M105,220 l30,0 M105,260 l30,0; -magnet.grid 1x1 ; -layer.rotate 180,180 45' ; -layer.translate 30,30 ; \ No newline at end of file diff --git a/archives/presets/flower.rin b/archives/presets/flower.rin deleted file mode 100644 index adeb5d8..0000000 --- a/archives/presets/flower.rin +++ /dev/null @@ -1,10 +0,0 @@ -frame.resize 300x300 -layer.fill #111111 -magnet.grid 15x15 4,4 -path:line_color #ffffff -path:line_width 10 -path.stroke M60,60 A1,1 0 0,0 240,60 A1,1 0 0,0 240,240 -path.stroke M240,240 A1,1 0 0,0 60,240 A1,1 0 0,0 60,60 -magnet.grid 1x1 -brush.add_pointer #ff0000 1 -source.save \ No newline at end of file diff --git a/archives/presets/glyph.rin b/archives/presets/glyph.rin deleted file mode 100644 index 94943c2..0000000 --- a/archives/presets/glyph.rin +++ /dev/null @@ -1,15 +0,0 @@ -frame.resize 300x300 -~ layer.fill #A1A1A1 -brush:color #ff0000 -path:line_width 28 -path:line_color #000 -path:line_cap butt -magnet.grid 15x15 4,4 -frame.select work -~ OQUONIE -~ path.stroke M45,60 l210,0 M45,240 l210,0 M255,60 a-15,15 0 0,0 -15,15 a-15,-15 0 0,0 -15,-15 M75,60 a-15,15 0 0,0 -15,15 a-15,-15 0 0,0 -15,-15 M255,240 a-15,-15 0 0,1 -15,-15 a-15,15 0 0,1 -15,15 M75,240 a-15,-15 0 0,1 -15,-15 a-15,15 0 0,1 -15,15 M60,75 l0,150 M240,75 l0,150 M60,150 l180,0 -~ THOUSAND ROOMS -~ path.stroke M45,60 l210,0 M45,240 l210,0 M255,60 a-15,15 0 0,0 -15,15 a-15,-15 0 0,0 -15,-15 M75,60 a-15,15 0 0,0 -15,15 a-15,-15 0 0,0 -15,-15 M255,240 a-15,-15 0 0,1 -15,-15 a-15,15 0 0,1 -15,15 M75,240 a-15,-15 0 0,1 -15,-15 a-15,15 0 0,1 -15,15 M240,75 l0,150 M60,75 l0,150 M180,60 l0,180 M60,180 l180,0 M195,60 a-15,15 0 0,0 -15,15 a-15,-15 0 0,0 -15,-15 M165,240 a15,-15 0 0,0 15,-15 a15,15 0 0,0 15,15 -~ DONSOL -~ path.stroke M150,60 l-90,90 l90,90 l90,-90 l-90,-90 -source.save \ No newline at end of file diff --git a/archives/presets/icon.rin b/archives/presets/icon.rin deleted file mode 100644 index 644d5a8..0000000 --- a/archives/presets/icon.rin +++ /dev/null @@ -1,6 +0,0 @@ -frame.resize 360x360 -frame.select background -layer.fill #A1A1A1 -brush:color #ff0000 -magnet.grid 15x15 4,4 -frame.select main \ No newline at end of file diff --git a/archives/presets/itch.rin b/archives/presets/itch.rin deleted file mode 100644 index 9b5403a..0000000 --- a/archives/presets/itch.rin +++ /dev/null @@ -1,10 +0,0 @@ -frame.resize 315x250 -layer.fill #111 -magnet:color #999 -magnet.grid 15x15 3,4 -path:line_color #ffffff -path:line_width 5 -path:line_cap square -path:fill_color #fff -source.load /badge.donsol.png 82.5,45 150x -source.save diff --git a/archives/presets/logo.rin b/archives/presets/logo.rin deleted file mode 100644 index 8a27924..0000000 --- a/archives/presets/logo.rin +++ /dev/null @@ -1,16 +0,0 @@ -~ TRY 1 -frame.resize 420x330 -layer.fill #EEE -brush:color #ff0000 -path:line_color #222 -magnet.grid 15x15 4,4 -frame.select work -path:line_cap butt -path:line_width 60 -path.stroke M60,60 a30,30 0 0,1 30,30 l0,120 a30,30 0 0,0 30,30 a30,-30 0 0,0 30,-30 l0,-120 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 l0,120 a30,30 0 0,0 30,30 a30,-30 0 0,0 30,-30 l0,-120 a30,-30 0 0,1 30,-30 -path:line_cap butt -path:line_width 1 -path:line_color #EEE -path.stroke M90,60 a30,30 0 0,1 30,30 l0,120 a30,30 0 0,0 30,30 a30,-30 0 0,0 30,-30 l0,-120 a30,-30 0 0,1 30,-30 a30,30 0 0,1 30,30 l0,120 a30,30 0 0,0 30,30 a30,-30 0 0,0 30,-30 l0,-120 a30,-30 0 0,1 30,-30 -path.stroke M90,60 a-30,30 0 0,0 -30,30 -magnet.clear \ No newline at end of file diff --git a/archives/presets/logo_nataniev.rin b/archives/presets/logo_nataniev.rin deleted file mode 100644 index 9c123d9..0000000 --- a/archives/presets/logo_nataniev.rin +++ /dev/null @@ -1,8 +0,0 @@ -frame.resize 300x300 -layer.fill #ff0000 -path:line_width 28 -path:line_cap round -magnet.grid 30x30 2,2 -frame.select logo -path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 M90,240 l0,-60 a30,-30 0 0,1 30,-30 -magnet.grid 1x1 2,2 \ No newline at end of file diff --git a/archives/presets/logo_ronin.rin b/archives/presets/logo_ronin.rin deleted file mode 100644 index 60d05fe..0000000 --- a/archives/presets/logo_ronin.rin +++ /dev/null @@ -1,12 +0,0 @@ -frame.resize 300x300 -layer.fill #ff0000 -path:line_width 28 -path:line_cap butt -magnet.grid 15x15 4,4 -frame.select logo -path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M90,240 l0,-60 a30,-30 0 0,1 30,-30 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 -path.stroke M45,60 l15,0 M45,90 l15,0 M210,45 l0,15 M240,45 l0,15 M255,210 l-15,0 M255,240 l-15,0 M90,255 l0,-15 M60,255 l0,-15 -path:line_cap round -path.stroke M120,60 a60,60 0 0,1 60,60 M240,120 a-60,60 0 0,1 -60,60 M180,240 a-60,-60 0 0,1 -60,-60 M60,180 a60,-60 0 0,1 60,-60 -path.stroke M120,90 a30,30 0 0,1 30,30 M210,120 a-30,30 0 0,1 -30,30 M180,210 a-30,-30 0 0,1 -30,-30 M90,180 a30,-30 0 0,1 30,-30 -magnet.grid 1x1 4,4 \ No newline at end of file diff --git a/archives/presets/marabu.rin b/archives/presets/marabu.rin deleted file mode 100644 index 81468e4..0000000 --- a/archives/presets/marabu.rin +++ /dev/null @@ -1,12 +0,0 @@ -frame.resize 300x300 -frame.select background -layer.fill #f1f1f1 -frame.select main -frame.select logo -path:line_width 30 -path:line_color #000 -~ path.stroke M60,60 l120,0 a60,60 0 0,1 60,60 a-60,60 0 0,1 -60,60 l-120,0 M180,180 a60,60 0 0,1 60,60 -magnet.grid 15x15 4,4 -~ magnet.grid 1x1 4,4 -brush:color #72dec2 -brush:size 10 \ No newline at end of file diff --git a/archives/presets/neauoire.rin b/archives/presets/neauoire.rin deleted file mode 100644 index 684c904..0000000 --- a/archives/presets/neauoire.rin +++ /dev/null @@ -1,12 +0,0 @@ -frame.resize 300x300 -layer.fill #000 -path:line_width 28 -path:line_cap square -magnet.grid 30x30 2,2 -frame.select logo -path.stroke M120,60 a0,90 0 0,0 0,90 a30,30 0 0,0 30,30 M90,60 l0,90 a60,60 0 0,0 60,60 M60,60 l0,90 a90,90 0 0,0 90,90 M180,240 l0,-90 a-30,-30 0 0,0 -30,-30 M210,240 l0,-90 a-60,-60 0 0,0 -60,-60 M240,240 l0,-90 a-90,-90 0 0,0 -90,-90 -magnet.grid 1x1 2,2 -type:size 30 -type:color white -type.write "∴" 45,255 -source.save \ No newline at end of file diff --git a/archives/presets/rabbits.rin b/archives/presets/rabbits.rin deleted file mode 100644 index 8ec6f99..0000000 --- a/archives/presets/rabbits.rin +++ /dev/null @@ -1,7 +0,0 @@ -frame.resize 795x450 -frame.select "photo" -frame.select "logo" -source.load /hundred.rabbits.logo.white.svg 70x70 0,380 -frame.select "photo" -source:format jpg -source:quality 0.9 \ No newline at end of file diff --git a/archives/presets/radial.rin b/archives/presets/radial.rin deleted file mode 100644 index 53f726d..0000000 --- a/archives/presets/radial.rin +++ /dev/null @@ -1,22 +0,0 @@ -frame.resize 500x500 -brush:color #000000 - -~ Radial 45' -~ brush.add 250,250 45' -~ brush.add 250,250 90' -~ brush.add 250,250 135' -~ brush.add 250,250 180' -~ brush.add 250,250 225' -~ brush.add 250,250 270' -~ brush.add 250,250 315' - -~ Radial 72' -brush.add 250,250 72' -brush.add 250,250 144' -brush.add 250,250 216' -brush.add 250,250 288' - -~ Radial 90' -~ brush.add 250,250 90' -~ brush.add 250,250 180' -~ brush.add 250,250 270' \ No newline at end of file diff --git a/archives/presets/ronin_splash.rin b/archives/presets/ronin_splash.rin deleted file mode 100644 index 658e4fa..0000000 --- a/archives/presets/ronin_splash.rin +++ /dev/null @@ -1,14 +0,0 @@ -frame.resize 640x400 -layer.fill #000000 -path:line_width 28 -path:line_cap butt -magnet.grid 15x15 4,4 -frame.select logo -path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M90,240 l0,-60 a30,-30 0 0,1 30,-30 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 -path.stroke M45,60 l15,0 M45,90 l15,0 M210,45 l0,15 M240,45 l0,15 M255,210 l-15,0 M255,240 l-15,0 M90,255 l0,-15 M60,255 l0,-15 -path:line_cap round -path.stroke M120,60 a60,60 0 0,1 60,60 M240,120 a-60,60 0 0,1 -60,60 M180,240 a-60,-60 0 0,1 -60,-60 M60,180 a60,-60 0 0,1 60,-60 -path.stroke M120,90 a30,30 0 0,1 30,30 M210,120 a-30,30 0 0,1 -30,30 M180,210 a-30,-30 0 0,1 -30,-30 M90,180 a30,-30 0 0,1 30,-30 -magnet.grid 1x1 4,4 -layer.translate 170,40 -source.save \ No newline at end of file diff --git a/archives/presets/rune.rin b/archives/presets/rune.rin deleted file mode 100644 index 10b8fbe..0000000 --- a/archives/presets/rune.rin +++ /dev/null @@ -1,4 +0,0 @@ -frame.resize 240x360 -layer.fill #A1A1A1 -magnet.grid 15x15 4,4 -path:line_color #ffffff \ No newline at end of file diff --git a/archives/presets/symmetry.rin b/archives/presets/symmetry.rin deleted file mode 100644 index 644beb8..0000000 --- a/archives/presets/symmetry.rin +++ /dev/null @@ -1,13 +0,0 @@ -frame.resize 800x400 -frame.select background -layer.fill #fff -frame.select drawing -brush:color #000000 -brush:size 3 -brush.clear -brush.add 0,0 -brush.add 1,1 -brush.add -1,-1 -brush.add 0,0 mirror_x=400 -brush.add 1,1 mirror_x=400 -brush.add -1,-1 mirror_x=400 \ No newline at end of file diff --git a/archives/scripts/core/command.js b/archives/scripts/core/command.js deleted file mode 100644 index 7073739..0000000 --- a/archives/scripts/core/command.js +++ /dev/null @@ -1,149 +0,0 @@ -function Command(content) -{ - this.content = content; - this.parts = content.split(" "); - - this.module_name = null; - this.method_name = null; - this.setting_name = null; - this.module = null; - this.setthing = null; - - this.module = function() - { - var module_name = null; - - if(this.parts[0].indexOf(".") > -1){ - module_name = this.parts[0].split(" ")[0].split(".")[0] - } - else if(this.parts[0].indexOf(":") > -1){ - module_name = this.parts[0].split(" ")[0].split(":")[0] - } - else{ - module_name = this.parts[0].split(" ")[0]; - } - return ronin.modules[module_name] ? ronin.modules[module_name] : null; - } - - this.method = function() - { - var module = this.module(); - if(!module || content.indexOf(".") < 0){ return null; } - - var method_name = content.indexOf(".") > -1 ? content.split(" ")[0].split(".")[1] : "default"; - return module.methods[method_name] ? module.methods[method_name] : null; - } - - this.setting = function() - { - var content = this.content; - var module = this.module(); - - if(!module){ return null; } - if(content.indexOf(":") < 0){ return null; } - - var setting_name = this.parts[0].split(":")[1]; - return module.settings[setting_name] ? setting_name : null; - } - - this.values = function() - { - var a = this.content.split(" "); - a.shift(); - return a.join(" ").trim(); - } - - - this.inject_position = function(injection) - { - console.log("> "+injection); - console.log("- "+content); - } - - // Parser - - this.any = function() - { - return new Any(this.content); - } - - this.rect = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("x") >= 0 && this.parts[i].indexOf("/") < 0){ return new Rect(this.parts[i]); } - } - return null; - } - - this.position = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf(",") >= 0){ return new Position(this.parts[i]); } - } - return null; - } - - this.color = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("#") >= 0){ return new Color(this.parts[i]); } - } - return null; - } - - this.filepath = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("/") >= 0){ return new Filepath(this.parts[i]); } - } - return null; - } - - this.value = function() - { - for (i = 0; i < this.parts.length; i++) { - var test = /[^$\-\d]/.test(this.parts[i]); - if(!test && this.parts[i] !== ""){ return new Value(this.parts[i]); } - } - return null; - } - - this.range = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("..") >= 0){ return new Range(this.parts[i]); } - } - return null; - } - - this.option = function(name) - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf(name+"=") >= 0){ return new Option(this.parts[i]); } - } - return null; - } - - this.bang = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("!") >= 0){ return new Bang(); } - } - return null; - } - - this.angle = function() - { - for (i = 0; i < this.parts.length; i++) { - if(this.parts[i].indexOf("'") >= 0){ return new Angle(this.parts[i]); } - } - return null; - } - - this.text = function() - { - var content_str = this.parts.join(" "); - if(content_str.indexOf("\"") < 0){ return null; } - return content_str.split("\"")[1]; - } -} \ No newline at end of file diff --git a/archives/scripts/core/keyboard.js b/archives/scripts/core/keyboard.js deleted file mode 100644 index 40247f3..0000000 --- a/archives/scripts/core/keyboard.js +++ /dev/null @@ -1,115 +0,0 @@ -function Keyboard() -{ - this.shift_held = false; - this.alt_held = false; - - this.listen_onkeydown = function(event) - { - if(event.shiftKey == true){ - this.shift_held = true; - } - if(event.altKey == true){ - this.alt_held = true; - } - - // Autocomplete with tab - if(event.keyCode === 9){ - event.preventDefault(); - var ac = ronin.terminal.find_autocomplete(); - if(ac){ - ronin.terminal.input.value += ac; - } - } - - ronin.cursor.update(event); - ronin.widget.update(); - ronin.terminal.update(); - } - - this.listen_onkeyup = function(event) - { - this.shift_held = false; - this.alt_held = false; - - event.preventDefault(); - - switch (event.key || event.keyCode || event.which) { - case "Enter": this.key_enter(); break; - case "ArrowUp": this.key_arrow_up(); break; - case "ArrowDown": this.key_arrow_down(); break; - case "ArrowLeft": this.key_arrow_left(); break; - case "ArrowRight": this.key_arrow_right(); break; - case "]": ronin.brush.size_up(); break; - case "[": ronin.brush.size_down(); break; - case ":": this.key_colon(); break; - case "Escape": this.key_escape(); break; - case 13: this.key_enter(); break; - case 186: if(event.shiftKey){this.key_colon();} break; - case 27: this.key_escape(); break; - case 219: ronin.brush.size_up(); break; - case 221: ronin.brush.size_down(); break; - case 38: this.key_arrow_up(); break; - case 40: this.key_arrow_down(); break; - case 8: this.key_delete(); break; - } - - console.log(event) - - // Passive - ronin.widget.update(); - ronin.terminal.update(); - ronin.cursor.update(); - }; - - this.key_tab = function() - { - } - - this.key_enter = function() - { - ronin.terminal.run(); - } - - this.key_space = function() - { - } - - this.key_arrow_up = function() - { - ronin.frame.select_layer(ronin.frame.layer_above()); - } - - this.key_arrow_down = function() - { - ronin.frame.select_layer(ronin.frame.layer_below()); - } - - this.key_arrow_left = function() - { - if(ronin.module){ ronin.module.key_arrow_left(); } - } - - this.key_arrow_right = function() - { - if(ronin.module){ ronin.module.key_arrow_right(); } - } - - this.key_colon = function() - { - return false; - } - - this.key_escape = function() - { - ronin.overlay.key_escape(); - - for(var key in ronin.modules){ - ronin.modules[key].key_escape(); - } - } - - this.key_delete = function() - { - if(ronin.module){ ronin.module.key_delete(); } - } -} diff --git a/archives/scripts/core/ronin.js b/archives/scripts/core/ronin.js deleted file mode 100644 index f14bc4d..0000000 --- a/archives/scripts/core/ronin.js +++ /dev/null @@ -1,175 +0,0 @@ -function Ronin() -{ - this.modules = {}; - this.element = document.getElementById('ronin'); - - this.default = new Default("`"); - - this.frame = new Frame("@"); - this.path = new Path("+"); - this.type = new Type("&"); - this.brush = new Brush("-"); - - this.source = new Source("$"); - - this.eye = new Eye("*"); - this.render = new Render("%"); - this.magnet = new Magnet("^"); - - this.overlay = new Overlay("|"); - this.terminal = new Terminal(">"); - this.cursor = new Cursor("."); - this.widget = new Widget("?"); - - this.modules[this.frame.name] = this.frame; - this.modules[this.type.name] = this.type; - this.modules[this.path.name] = this.path; - - this.modules[this.brush.name] = this.brush; - - this.modules[this.source.name] = this.source; - this.modules[this.render.name] = this.render; - this.modules[this.eye.name] = this.eye; - this.modules[this.magnet.name] = this.magnet; - - this.modules[this.cursor.name] = this.cursor; - this.modules[this.terminal.name] = this.terminal; - - // document.addEventListener('contextmenu', function(ev){ ev.preventDefault(); return false;}, false); - window.addEventListener('resize', function(){ ronin.on_resize(); }, true); - - this.install = function() - { - ronin.frame.element = document.getElementById('frame'); - ronin.cursor.element = document.getElementById('cursor'); - ronin.terminal.element = document.getElementById('terminal'); - - for(var key in this.modules){ - this.modules[key].install(); - } - - this.widget.install(); - ronin.cursor.mode = ronin.brush; - this.on_drag(); - } - - this.start = function(hash = null) - { - var target_file = hash.length > 2 ? hash.substr(1,hash.length-1)+".rin" : "default.rin" - - ronin.terminal.update(); - ronin.widget.update(); - ronin.terminal.input.focus(); - // ronin.load(target_file); - } - - this.hint = function(method) - { - var html = ""; - if(this.terminal.input.value){ - for(id in ronin.modules){ - if(this.terminal.input.value != ronin.modules[id].name.substr(0,this.terminal.input.value.length)){ continue; } - html += ""+ronin.modules[id].name+" "; - } - } - else{ - for(id in ronin.modules){ - html += ""+ronin.modules[id].name+" "; - } - } - return html; - } - - this.cursors = []; - - this.position_in_canvas = function(e) - { - // x -= parseInt(this.frame.element.style.left) - parseInt(this.frame.element.style.width/2); - var x = e.clientX - parseInt(this.frame.element.style.left); - var y = e.clientY - parseInt(this.frame.element.style.top); - return new Position(x,y); - } - - this.timestamp = function() - { - var currentdate = new Date(); - var date = currentdate.getFullYear()+""+(currentdate.getMonth()+1)+""+currentdate.getDate(); - return date+" "+currentdate.getHours()+":"+currentdate.getMinutes()+":"+currentdate.getSeconds(); - } - - this.on_resize = function() - { - ronin.frame.center(); - } - - this.on_drag = function() - { - // Position Background - var bg_offset_parts = ronin.element.style.backgroundPosition == "" ? [0,0] : ronin.element.style.backgroundPosition.split(" "); - - var x = parseInt(ronin.frame.element.style.left)/4; - var y = parseInt(ronin.frame.element.style.top)/4; - - ronin.element.style.backgroundPosition = x+"px "+y+"px"; - } - - this.filename = "default.rin"; - - this.load = function readTextFile(name) - { - return; - this.filename = name; - var file = "presets/"+name+'?'+new Date().getTime(); - var rawFile = new XMLHttpRequest(); - rawFile.open("GET", file, false); - rawFile.onreadystatechange = function () - { - if(rawFile.readyState === 4) - { - if(rawFile.status === 200 || rawFile.status == 0) - { - var allText = rawFile.responseText; - ronin.terminal.log(new Log(null,"Loaded file "+name)); - ronin.terminal.run_multi(allText.split("\n").join(";")); - } - } - } - rawFile.send(null); - ronin.widget.update(); - ronin.terminal.update(); - } - - // Drag file on canvas - - this.element.addEventListener('dragover',function(e) - { - e.stopPropagation(); e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; - }); - - this.element.addEventListener('drop', function(e) - { - e.stopPropagation(); - e.preventDefault(); - var files = e.dataTransfer.files; - var file = files[0]; - - if (!file.type.match(/image.*/)) { console.log("Not image"); return false; } - - var reader = new FileReader(); - - reader.onload = function(event) - { - base_image = new Image(); - base_image.src = event.target.result; - - var width = base_image.naturalWidth; - var height = base_image.naturalHeight; - - // Display as large as the canvas - var ratio = ronin.frame.size.width/width; - ronin.frame.active_layer.context().drawImage(base_image, 0,0,width * ratio,height * ratio); - } - reader.readAsDataURL(file); - }); - -} \ No newline at end of file diff --git a/archives/scripts/filters/balance.js b/archives/scripts/filters/balance.js deleted file mode 100644 index b12bbd5..0000000 --- a/archives/scripts/filters/balance.js +++ /dev/null @@ -1,21 +0,0 @@ -function Filter_Balance() -{ - Filter.call(this); - - this.parameters = [Color]; - - this.render = function(params) - { - var color = params.color() ? params.color().floats() : new Color("#999999").floats(); - var originalData = ronin.frame.context().getImageData(0, 0, ronin.frame.size.width*2, ronin.frame.size.height*2); - var data = originalData.data; - - for(var i = 0; i < data.length; i += 4) { - data[i] = data[i] * (color.r + 0.5); - data[i + 1] = data[i + 1] * (color.g + 0.5); - data[i + 2] = data[i + 2] * (color.b + 0.5); - } - - ronin.frame.context().putImageData(originalData, 0, 0); - } -} \ No newline at end of file diff --git a/archives/scripts/filters/chromatic.js b/archives/scripts/filters/chromatic.js deleted file mode 100644 index e6f0a5f..0000000 --- a/archives/scripts/filters/chromatic.js +++ /dev/null @@ -1,64 +0,0 @@ -function Filter_Chromatic() -{ - Filter.call(this); - - this.parameters = [Value, Position]; - //value is maximum distance pixels are shifted - //position is where the pixels are shifted from, defaults to half the image - - this.render = function(cmd) - { - var position = cmd.position() ? cmd.position() : new Position(ronin.frame.size.width,ronin.frame.size.height); - var value = cmd.value() ? cmd.value().float : 5; - - this.draw(this.context(),value,position); - } - - this.preview = function(cmd) - { - if(cmd.position()){ - ronin.overlay.draw(cmd.position()); - } - } - - this.draw = function(context = this.context(), value, position) - { - var w = ronin.frame.size.width; - var h = ronin.frame.size.height; - - //no longer letting you set how far each chanel is shifted, not sure how to receive extra data any more - var s = {r:value,g:value*.5,b:0}; - - var context = ronin.frame.context(); - - //now need two imagedatas to sample off of, for some reason I cant just dump the new pixels into an empty array :/ - var originalData = context.getImageData(0, 0, w*2, h*2); - var imageData = context.getImageData(0, 0, w*2, h*2); - - var maxLength = Math.sqrt(w*w+h*h); - for (var i=0; i● "+this.settings["size"].to_f(); - } - } - - this.mouse_down = function(position) - { - if(position.is_outside()){ return; } - - if(keyboard.shift_held == true){ - this.erase(); - } - else{ - if(ronin.brush.pointers.length < 1){ ronin.terminal.log(new Log(this,"Brush has no pointers!"))} - for (i = 0; i < ronin.brush.pointers.length; i++) { - ronin.brush.pointers[i].start(); - } - } - } - - this.mouse_move = function(position,rect) - { - if(!this.mouse_held){ return; } - - if(keyboard.shift_held == true){ - this.erase(); - } - else{ - for (i = 0; i < ronin.brush.pointers.length; i++) { - ronin.brush.pointers[i].draw(); - } - } - } - - this.mouse_up = function(position,rect) - { - for (i = 0; i < ronin.brush.pointers.length; i++) { - ronin.brush.pointers[i].stop(); - } - this.position_prev = null; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/brush.pointer.js b/archives/scripts/modules/brush.pointer.js deleted file mode 100644 index d37da5a..0000000 --- a/archives/scripts/modules/brush.pointer.js +++ /dev/null @@ -1,146 +0,0 @@ -function Pointer(offset = new Position(), color = null, scale = 1, angle = 1) -{ - this.offset = offset; - this.color = color; - this.scale = scale; - this.angle = null; - - this.mirror_x = null; - this.mirror_y = null; - - this.position_prev = null; - this.distance = 0; - - // Parameters - - this.actual_thickness = 0; - - this.thickness = function() - { - var radius = ronin.brush.settings["size"].to_f() * this.scale; - var ratio = 1 - this.position().distance_to((this.position_prev ? this.position_prev[0] : 1)) / 10; - var target = radius * ratio; - var rate = ronin.brush.settings["size"].to_f()/8; - - if(this.actual_thickness < target){ this.actual_thickness += rate; } - if(this.actual_thickness > target){ this.actual_thickness -= rate; } - - return this.actual_thickness; - } - - // - - this.draw = function() - { - if(!this.position_prev){this.position_prev = [this.position()]; return; } - - var position = this.position(); - var position_prev = this.position_prev[0]; - - //remove stale previous positions - if (this.position_prev.length > 3) this.position_prev.pop(); - - this.distance += position.distance_to(position_prev); - - ronin.frame.context().beginPath(); - - ronin.frame.context().globalCompositeOperation="source-over"; - ronin.frame.context().moveTo(position_prev.x,position_prev.y); - - //Choose direct line or curve line based on how many samples available - if(this.position_prev.length > 1 && position.distance_to(position_prev) > 5){ - - var d = position.distance_to(position_prev)/position_prev.distance_to(this.position_prev[1]); - - //caluclate a control point for the quad curve - var ppx = position_prev.x - (this.position_prev[1].x - position_prev.x); - var ppy = position_prev.y - (this.position_prev[1].y - position_prev.y); - var px = (position.x + position_prev.x)/2; - var py = (position.y + position_prev.y)/2; - var tx = px + (ppx - px) * 0.2 * d; - var ty = py + (ppy - py) * 0.2 * d; - - ronin.frame.context().quadraticCurveTo(tx,ty,position.x,position.y); - } - else { - ronin.frame.context().lineTo(position.x,position.y); - } - - ronin.frame.context().lineCap="round"; - ronin.frame.context().lineWidth = this.thickness(); - ronin.frame.context().strokeStyle = this.color ? this.color : ronin.brush.settings["color"].value; - ronin.frame.context().stroke(); - ronin.frame.context().closePath(); - - this.position_prev.unshift(position); - } - - this.position = function() - { - if(this.mirror_x && this.mirror_x > 0){ - return this.position_mirror_x(); - } - if(this.mirror_y && this.mirror_y > 0){ - return this.position_mirror_y(); - } - - if(this.angle && this.offset){ - return this.position_rotation(); - } - else if(this.mirror && this.mirror.height > 0){ - return this.position_mirror_y(); - } - return this.position_default(); - } - - // Effects - - this.position_default = function() - { - return ronin.cursor.position.add(this.offset); - } - - this.position_mirror_x = function() - { - return new Position((2 * this.mirror_x) - (ronin.cursor.position.x + this.offset.x), 0 + (ronin.cursor.position.y + this.offset.y)); - } - - this.position_mirror_y = function() - { - return new Position((ronin.cursor.position.x + this.offset.x), (2 * this.mirror_y) - (ronin.cursor.position.y + this.offset.y)); - } - - this.position_rotation = function() - { - var angle_radian = this.angle * Math.PI / 180; - var deltaX = ronin.cursor.position.x - this.offset.x; - var deltaY = ronin.cursor.position.y - this.offset.y; - var t = Math.atan2(deltaY, deltaX) + angle_radian; - var radius = ronin.cursor.position.distance_to(this.offset); - var x = Math.cos(t) * radius; - var y = Math.sin(t) * radius; - return new Position(x + this.offset.x,y + this.offset.y); - } - - this.start = function() - { - var radius = ronin.brush.settings["size"].to_f() * this.scale; - this.actual_thickness = radius/4; - ronin.frame.context().beginPath(); - ronin.frame.context().arc(this.position().x, this.position().y, this.thickness(), 0, 2 * Math.PI, false); - ronin.frame.context().lineWidth = 0; - ronin.frame.context().fillStyle = this.color ? this.color : ronin.brush.settings["color"].value; - ronin.frame.context().fill(); - ronin.frame.context().closePath(); - } - - this.stop = function() - { - this.position_prev = null; - } - - this.widget = function() - { - return this.offset.toString(); - } -} \ No newline at end of file diff --git a/archives/scripts/modules/cursor.js b/archives/scripts/modules/cursor.js deleted file mode 100644 index 9d37896..0000000 --- a/archives/scripts/modules/cursor.js +++ /dev/null @@ -1,301 +0,0 @@ -function Cursor(rune) -{ - Module.call(this,rune); - - this.add_setting(new Setting("color","#000000")); - this.add_setting(new Setting("color_alt","#fffffff")); - - this.mode = null; - this.position = new Position(); - this.position_in_window = new Position(); - - document.addEventListener('mousedown', function(e){ ronin.cursor.mouse_down(ronin.position_in_canvas(e),e);}, false); - document.addEventListener('mousemove', function(e){ ronin.cursor.mouse_move(ronin.position_in_canvas(e),e);}, false); - document.addEventListener('mouseup', function(e){ ronin.cursor.mouse_up(ronin.position_in_canvas(e),e);}, false); - - this.update = function(event = null) - { - if(ronin.terminal.cmd().module()){ - this.set_mode(ronin.terminal.cmd().module()); - } - else if(keyboard.shift_held,keyboard.alt_held){ - this.set_mode(ronin.frame.active_layer); - } - else if(this.is_inside){ - this.set_mode(ronin.default) - } - else{ - this.set_mode(ronin.brush); - } - } - - this.set_mode = function(mode = ronin.brush) - { - if(!mode){ return; } - - if(this.mode == mode){ return; } - this.mode = mode; - document.body.setAttribute("class",this.mode.name); - ronin.widget.update(); - } - - this.mouse_down = function(position,e) - { - var true_pos = e.clientX; - var better_pos = (e.clientX/parseFloat(window.innerWidth)) * window.innerWidth; - - if(this.layer){ this.layer.clear(); } - - this.position = ronin.magnet.update_mouse(position); - this.position_in_window = new Position(e.clientX,e.clientY); - - if(this.mode.constructor.name != Cursor.name){ - this.mode.mouse_from = this.position; - this.mode.mouse_held = true; - if(!position.is_outside()){ - this.mode.mouse_down(this.position); - } - else{ - ronin.cursor.set_mode(ronin.default); - ronin.default.mouse_down(this.position); - } - } - } - - this.mouse_move = function(position,e) - { - if(!this.layer){ this.create_layer(); } - - // On/Out - if(position.is_outside()){ this.mouse_outside(); } - else{ this.mouse_inside(); } - - this.layer.clear(); - - // Magnet - this.position = ronin.magnet.update_mouse(position); - this.position_in_window = new Position(e.clientX,e.clientY); - - if(this.mode){this.mode.mouse_pointer(this.position);} - else{ this.mouse_pointer(this.position);} - - if(this.mode.mouse_from == null){ return; } - - var rect = new Rect(); - rect.width = this.position.x - this.mode.mouse_from.x; - rect.height = this.position.y - this.mode.mouse_from.y; - - if(this.mode.constructor.name != Cursor.name){ - this.mode.mouse_move(this.position,rect); - this.mode.mouse_prev = this.position; - } - } - - this.mouse_up = function(position,e) - { - this.position = ronin.magnet.update_mouse(position); - this.position_in_window = new Position(e.clientX,e.clientY); - - if(this.mode.mouse_from){ - var rect = new Rect(); - rect.width = this.position.x - this.mode.mouse_from.x; - rect.height = this.position.y - this.mode.mouse_from.y; - } - - if(!this.mode){ return; } - - if(this.mode.constructor.name != Cursor.name){ - if(!position.is_outside()){ - this.mode.mouse_up(this.position,rect); - } - this.mode.mouse_held = false; - } - this.mode.mouse_from = null; - } - - // over/out - - this.is_inside = false; - - this.mouse_outside = function() - { - if(this.is_inside){ return; } - - this.is_inside = true; - this.update(); - } - - this.mouse_inside = function() - { - if(!this.is_inside){ return; } - - this.is_inside = false; - this.update(); - } - - this.draw_pointer_arrow = function(position,size = 1) - { - if(!this.layer){ this.create_layer(); } - - this.pointer_last = this.pointer_last ? this.pointer_last : position; - - this.layer.context().beginPath(); - - // Background - this.layer.context().moveTo(position.x + 5,position.y); - this.layer.context().lineTo(position.x,position.y); - this.layer.context().lineTo(position.x,position.y + 5); - - this.layer.context().lineCap="square"; - this.layer.context().lineWidth = 2; - this.layer.context().strokeStyle = "#000000"; - this.layer.context().stroke(); - - this.layer.context().lineCap="round"; - this.layer.context().lineWidth = 1; - this.layer.context().strokeStyle = "#ffffff"; - this.layer.context().stroke(); - - this.layer.context().closePath(); - - this.pointer_last = position; - } - - this.draw_pointer_no_pointer = function(position,size = 2) - { - if(!this.layer){ this.create_layer(); } - - var radius = 4000; - - this.pointer_last = this.pointer_last ? this.pointer_last : position; - - this.layer.context().beginPath(); - - this.layer.context().moveTo(position.x - radius,position.y + radius); - this.layer.context().lineTo(position.x - size,position.y + size); - this.layer.context().moveTo(position.x + radius,position.y + radius); - this.layer.context().lineTo(position.x + size,position.y + size); - - this.layer.context().moveTo(position.x - radius,position.y - radius); - this.layer.context().lineTo(position.x - size,position.y - size); - this.layer.context().moveTo(position.x + radius,position.y - radius); - this.layer.context().lineTo(position.x + size,position.y - size); - - this.layer.context().lineCap="square"; - this.layer.context().lineWidth = 2; - this.layer.context().strokeStyle = "#000000"; - this.layer.context().stroke(); - - this.layer.context().lineCap="round"; - this.layer.context().lineWidth = 1; - this.layer.context().strokeStyle = "#ffffff"; - this.layer.context().stroke(); - - this.layer.context().closePath(); - - this.pointer_last = position; - } - - this.draw_pointer_brush = function(position,size = 1) - { - if(!this.layer){ this.create_layer(); } - - this.pointer_last = this.pointer_last ? this.pointer_last : position; - - this.layer.context().beginPath(); - - this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false); - - this.layer.context().lineWidth = 2; - this.layer.context().strokeStyle = "#000000"; - this.layer.context().stroke(); - - this.layer.context().arc(position.x, position.y, size/2, 0, 2 * Math.PI, false); - - this.layer.context().lineWidth = 1; - this.layer.context().strokeStyle = ronin.brush.settings["color"].value != "#000000" ? ronin.brush.settings["color"].value : "#ffffff"; - this.layer.context().stroke(); - - this.layer.context().closePath(); - - this.pointer_last = position; - } - - this.draw_pointer_circle_eraser = function(position,size = 1) - { - if(!this.layer){ this.create_layer(); } - - this.pointer_last = this.pointer_last ? this.pointer_last : position; - - this.layer.context().beginPath(); - this.layer.context().arc(position.x, position.y, (size/2), 0, 2 * Math.PI, false); - - this.layer.context().lineCap="square"; - this.layer.context().lineWidth = 2; - this.layer.context().strokeStyle = "#000000"; - this.layer.context().stroke(); - - this.layer.context().lineCap="round"; - this.layer.context().lineWidth = 1; - this.layer.context().strokeStyle = "#ffffff"; - this.layer.context().stroke(); - - this.layer.context().closePath(); - - this.pointer_last = position; - } - - this.draw_pointer_drag = function(position) - { - if(!this.layer){ this.create_layer(); } - - this.pointer_last = this.pointer_last ? this.pointer_last : position; - - this.layer.context().beginPath(); - - var radius = 5; - - this.layer.context().moveTo(position.x,position.y - radius); - this.layer.context().lineTo(position.x,position.y + radius); - this.layer.context().moveTo(position.x - radius/2,position.y - radius); - this.layer.context().lineTo(position.x - radius/2,position.y + radius); - this.layer.context().moveTo(position.x + radius/2,position.y - radius); - this.layer.context().lineTo(position.x + radius/2,position.y + radius); - this.layer.context().moveTo(position.x + radius,position.y - radius); - this.layer.context().lineTo(position.x + radius,position.y + radius); - this.layer.context().moveTo(position.x - radius,position.y - radius); - this.layer.context().lineTo(position.x - radius,position.y + radius); - - this.layer.context().lineCap="square"; - this.layer.context().lineWidth = 2; - this.layer.context().strokeStyle = "#000000"; - this.layer.context().stroke(); - - this.layer.context().lineCap="round"; - this.layer.context().lineWidth = 1; - this.layer.context().strokeStyle = "#ffffff"; - this.layer.context().stroke(); - - this.layer.context().closePath(); - - this.pointer_last = position; - } - - this.release = function() - { - this.mode.mouse_held = false; - this.mode.mouse_from = null; - this.mode = ronin.brush; - ronin.terminal.input.focus(); - } - - this.widget = function() - { - return ""+this.mode.name+"."+this.mode.mouse_mode()+""; - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - } -} \ No newline at end of file diff --git a/archives/scripts/modules/default.js b/archives/scripts/modules/default.js deleted file mode 100644 index 8190214..0000000 --- a/archives/scripts/modules/default.js +++ /dev/null @@ -1,42 +0,0 @@ -function Default(rune) -{ - Module.call(this,rune); - - // Cursor - - this.mouse_mode = function() - { - return "Drag"; - } - - this.mouse_pointer = function(position) - { - return ronin.cursor.draw_pointer_drag(position); - } - - this.drag_from = null; - - this.mouse_down = function(position) - { - this.drag_from = ronin.cursor.position_in_window; - } - - this.mouse_move = function(position) - { - if(this.drag_from === null){ return; } - - var offset = ronin.cursor.position_in_window.offset(this.drag_from); - - ronin.frame.element.style.left = parseInt(ronin.frame.element.style.left) + offset.x; - ronin.frame.element.style.top = parseInt(ronin.frame.element.style.top) + offset.y; - - ronin.on_drag(); - - this.drag_from = ronin.cursor.position_in_window; - } - - this.mouse_up = function(event) - { - this.drag_from = null; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/eye.js b/archives/scripts/modules/eye.js deleted file mode 100644 index 93108ac..0000000 --- a/archives/scripts/modules/eye.js +++ /dev/null @@ -1,32 +0,0 @@ -function Eye(rune) -{ - Module.call(this,rune); - - this.add_mode(new Mode("picker")); - - // TODO: If a rect is given, return the average color - this.color_picker = function(position,rect = null) - { - var pixel = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data; - var hex = new Color().rgb_to_hex({r:pixel[0],g:pixel[1],b:pixel[2]}); - ronin.terminal.log(new Log(this,"Pixel on "+ronin.frame.active_layer.name+" layer at "+position.toString()+" is "+hex)); - ronin.terminal.input.focus(); - } - - // Mouse - - this.mouse_down = function(position) - { - this.color_picker(position); - } - - this.mouse_move = function(position,rect) - { - this.color_picker(position); - } - - this.mouse_up = function(position,rect) - { - this.color_picker(position); - } -} \ No newline at end of file diff --git a/archives/scripts/modules/frame.js b/archives/scripts/modules/frame.js deleted file mode 100644 index 5a29b23..0000000 --- a/archives/scripts/modules/frame.js +++ /dev/null @@ -1,205 +0,0 @@ -function Frame(rune) -{ - Module.call(this,rune); - - this.element = null; - - this.size = new Rect("200x200"); - - this.layers = {}; - this.active_layer = null; - this.render_layer = null; - - this.add_method(new Method("resize",[new Position().name,new Rect().name])); - this.add_method(new Method("select",["text"])); - this.add_mode(new Mode("resize")); - - this.install = function() - { - this.select(new Command("frame.select background")); - - // Canvas - var starting_canvas = new Rect(); - starting_canvas.width = window.innerWidth - 100; - starting_canvas.height = window.innerHeight - 100; - - // Clamp - - starting_canvas.width = parseInt(starting_canvas.width/40) * 40 - 40; - starting_canvas.height = parseInt(starting_canvas.height/40) * 40 - 40; - - this.resize(new Command(starting_canvas.width+"x"+starting_canvas.height)); - } - - // Methods - - this.resize = function(cmd, preview = false) - { - var rect = cmd.rect(); - var position = cmd.position() ? cmd.position() : new Position(0,0); - - if(preview){ ronin.overlay.draw(position,rect); return; } - - for(layer_name in ronin.frame.layers){ - ronin.frame.layers[layer_name].resize(rect); - } - - ronin.frame.element.width = rect.width * 2; - ronin.frame.element.height = rect.height * 2; - ronin.frame.element.style.width = rect.width+"px"; - ronin.frame.element.style.height = rect.height+"px"; - - ronin.frame.element.style.left = (window.innerWidth - rect.width)/2; - ronin.frame.element.style.top = (window.innerHeight - rect.height)/2; - - ronin.on_resize(); - - this.size = rect; - - return 1, "Resized to "+this.size.toString(); - } - - this.select = function(cmd, preview = false) - { - if(preview){ return; } - - var layer_name = cmd.values(); - - if(!ronin.frame.layers[layer_name]){ - this.add_layer(new Layer(layer_name)); - } - this.select_layer(this.layers[layer_name]); - ronin.modules["layer"] = this.layers[layer_name]; - ronin.layer = this.layers[layer_name]; - - return 1, "Selected "+this.active_layer.name; - } - - this.context = function() - { - return this.active_layer.context(); - } - - // Misc - - this.blink = function() - { - Object.keys(ronin.frame.layers).forEach(function (key) { - ronin.frame.layers[key].blink(); - }); - setTimeout(function(){ ronin.frame.blink(); }, 30); - } - - this.center = function() - { - ronin.frame.element.style.left = (window.innerWidth/2) - (ronin.frame.element.width/4); - ronin.frame.element.style.top = (window.innerHeight/2) - (ronin.frame.element.height/4) - 30; - } - - this.select_layer = function(layer) - { - if(!layer || layer.manager){ return; } - this.active_layer = layer; - } - - this.add_layer = function(layer) - { - if(this.active_layer){layer.set_depth(this.active_layer.depth+1);} - layer.resize(this.size); - this.layers[layer.name] = layer; - this.element.appendChild(layer.element); - } - - // Commands - - this.layer_above = function() - { - var keys = Object.keys(ronin.frame.layers); - var loc = keys.indexOf(this.active_layer.name); - - if(loc >= keys.length-1){ console.log("Reached end"); return false; } - - if(keys[loc+1] != null){ return ronin.frame.layers[keys[loc+1]]; } - } - - this.layer_below = function() - { - var keys = Object.keys(ronin.frame.layers); - var loc = keys.indexOf(this.active_layer.name); - - if(keys[loc-1] != null){ return ronin.frame.layers[keys[loc-1]]; } - } - - // Cursor - - this.mouse_mode = function() - { - return "crop"; - } - - this.mouse_down = function(position) - { - ronin.overlay.draw(position); - } - this.mouse_move = function(position,rect) - { - ronin.overlay.draw(this.mouse_from,rect); - } - - this.mouse_up = function(position,rect) - { - ronin.overlay.draw(this.mouse_from,rect)+" "+rect.toString(); - - var line = "frame.resize "+this.mouse_from.toString()+" "+rect.toString(); - ronin.terminal.update(line); - } - - this.widget = function() - { - var html = "" - - html += this.size.toString()+" "; - html += this.active_layer.name+" "; - - var user_layers = 0; - var managed_layers = 0; - - count = 0; - for(id in this.layers){ - if(this.layers[id].manager){ - managed_layers += 1; - } - else{ - user_layers += 1; - } - count += 1; - } - - html += user_layers+"&"+managed_layers+" "; - - html += this.widget_map()+" " - - return html - } - - this.widget_map = function() - { - html = "" - var keys = Object.keys(ronin.frame.layers); - var loc = keys.indexOf(this.active_layer.name); - i = 0; - while(i < keys.length){ - if(i == loc){ - html += "|"; - } - else if(this.layers[keys[i]].manager){ - html += "|"; - } - else{ - html += "|"; - } - i += 1; - } - return html; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/layer.js b/archives/scripts/modules/layer.js deleted file mode 100644 index d7a02c3..0000000 --- a/archives/scripts/modules/layer.js +++ /dev/null @@ -1,187 +0,0 @@ -function Layer(name,manager = null) -{ - Module.call(this,"#"); - - this.add_method(new Method("translate",["position"])); - this.add_method(new Method("rotate",["position","angle"])); - this.add_method(new Method("scale",["float"])); - this.add_method(new Method("clear",[])); - this.add_method(new Method("rotate",["position","angle"])); - this.add_method(new Method("mirror",["position"])); - this.add_method(new Method("fill",["color","position","rect"])); - - this.add_method(new Method("rename",["text"])); - - this.name = name; - this.rune = "#"; - this.manager = manager; - this.element = document.createElement("canvas"); - this.element.setAttribute("id","_"+name); - this.element.setAttribute("class","layer"); - this.depth = 0; - - this.scale = function(cmd,preview = false) - { - if(preview){ return; } - - var ratio = parseFloat(cmd.values()); - var data = ronin.frame.context().canvas; - - ronin.render.get_layer().clear(); - ronin.render.context().drawImage(ronin.frame.context().canvas,0,0,w,h); - - ronin.frame.context().drawImage(ronin.render.context().canvas, -position.x, -position.y,w,h) - - ronin.frame.context().drawImage(data,0,0,ronin.frame.size.width * ratio,ronin.frame.size.height * ratio); - } - - this.rotate = function(params, preview = false) - { - if(preview){ ronin.overlay.draw_pointer(params.position()); return; } - if(!params.position()){ return; } - - var position = params.position(); - var angle = params.angle().degrees; - - var w = ronin.frame.size.width; - var h = ronin.frame.size.height; - - ronin.render.get_layer().clear(); - ronin.render.context().drawImage(ronin.frame.context().canvas,0,0,w,h); - ronin.frame.active_layer.clear(); - - ronin.frame.context().save(); - ronin.frame.context().translate(position.x,position.y); - ronin.frame.context().rotate(angle*Math.PI/180); - - ronin.frame.context().drawImage(ronin.render.context().canvas, -position.x, -position.y,w,h) - - ronin.frame.context().rotate(-angle*Math.PI/180); - ronin.frame.context().restore(); - ronin.render.get_layer().clear(); - - return 1, "ok"; - } - - this.translate = function(params,preview = false) - { - if(preview){ return; } - if(!params.position()){ return; } - - var data = this.data(); - this.clear(); - this.context().putImageData(data, params.position().x * 2, params.position().y * 2); - ronin.overlay.get_layer(true).clear(); - - return 1, "ok"; - } - - this.fill = function(params,preview = false) - { - if(!params.color()){ return 0, "Color?"; } - if(preview){ return 0, "No Preview"; } - - var rect = params.rect() ? params.rect() : new Rect(this.element.width+"x"+this.element.height); - var position = params.position() ? params.position() : new Position("0,0"); - - this.context().beginPath(); - this.context().rect(position.x, position.y, rect.width, rect.height); - this.context().fillStyle = params.color().hex; - this.context().fill(); - - return 1, "ok"; - } - - this.clear = function(params, preview = false) - { - if(preview){ return; } - - this.context().clearRect(0, 0, this.element.width, this.element.height); - } - - this.resize = function(rect) - { - var pixels_rect = new Rect(this.element.width+"x"+this.element.height); - - this.element.width = rect.width * 2; - this.element.height = rect.height * 2; - this.element.style.width = rect.width+"px"; - this.element.style.height = rect.height+"px"; - - this.context().scale(2,2); - } - - this.remove = function(manager) - { - manager.layer = null; - ronin.frame.layers[this.name].element.outerHTML = ""; - delete ronin.frame.layers[this.name]; - } - - this.context = function() - { - return this.element.getContext('2d'); - } - - this.set_depth = function(depth) - { - this.depth = depth; - this.element.setAttribute("z-index",depth); - } - - this.image = function() - { - return this.element.toDataURL('image/png'); - } - - this.data = function() - { - return this.context().getImageData(0, 0, ronin.frame.size.width * 2, ronin.frame.size.height * 2); - } - - // - - this.mouse_pointer = function(position) - { - return ronin.cursor.draw_pointer_arrow(position); - } - - this.mouse_mode = function() - { - return "Move"; - } - - this.drag_from = null; - - this.mouse_down = function(position) - { - this.drag_from = ronin.cursor.position_in_window; - } - - this.mouse_move = function(position) - { - if(this.drag_from === null){ return; } - - var offset = ronin.cursor.position_in_window.offset(this.drag_from); - - var data = this.data(); - this.clear(); - this.context().putImageData(data, offset.x * 2, offset.y * 2); - - this.drag_from = ronin.cursor.position_in_window; - } - - this.mouse_up = function(position) - { - this.drag_from = null; - } - - // Blink - - this.is_blinking = false; - - this.blink = function() - { - this.element.setAttribute("class","layer blink") - } -} \ No newline at end of file diff --git a/archives/scripts/modules/magnet.js b/archives/scripts/modules/magnet.js deleted file mode 100644 index 8c348ce..0000000 --- a/archives/scripts/modules/magnet.js +++ /dev/null @@ -1,99 +0,0 @@ -function Magnet(rune) -{ - Module.call(this,rune); - - this.size = new Rect("1x1"); - this.rate = new Position("4,4"); - - this.add_setting(new Setting("color","#000000")); - - this.add_method(new Method("grid",["rect","position"])); - this.add_method(new Method("clear",[])); - - this.grid = function(cmd,preview = false) - { - if(!cmd.rect()){ return 0, "Rect?"; } - - if(!this.layer){ this.create_layer(); } - - this.layer.clear(); - this.draw_grid(cmd.rect(),cmd.position()); - - if(preview == false){ - if(cmd.rect()){ this.size = cmd.rect(); } - if(cmd.position()){ this.rate = cmd.position(); } - } - - return 1, preview ? "preview" : "ok"; - } - - this.clear = function(cmd,preview = false) - { - this.layer.clear(); - - this.size = new Rect("1x1"); - this.rate = this.rate; - } - - this.draw_grid = function(rect,position) - { - if(!rect){ rect = new Rect("20x20"); } - if(!position){ position = new Position("4,4"); } - - this.size = rect; - this.rate = position; - - if(rect.width < 5 || rect.height < 5){ return; } - - var horizontal = ronin.frame.size.width/rect.width; - var vertical = ronin.frame.size.height/rect.height; - - for (var x = 1; x < horizontal; x++) { - for (var y = 1; y < vertical; y++) { - var dot_position = new Position(x * rect.width, y * rect.height); - var size = 0.5; - if(this.rate && x % this.rate.x == 0 && y % this.rate.y == 0){ size = 1; } - this.draw_marker(dot_position,size); - } - } - } - - this.draw_marker = function(position,size = 0.5) - { - this.context().beginPath(); - this.context().arc(position.x, position.y, size, 0, 2 * Math.PI, false); - this.context().fillStyle = this.settings["color"].value; - this.context().fill(); - this.context().closePath(); - } - - this.magnetic_position = function(position) - { - var x = parseInt(position.x / this.size.width) * this.size.width; - var y = parseInt(position.y / this.size.width) * this.size.width; - - return new Position(x,y); - } - - this.update_mouse = function(position) - { - if(this.size.width > 4 || this.size.height > 4){ - if(!this.layer){ this.create_layer(); } - this.layer.clear(); - this.draw_grid(this.size,this.rate); - } - - return this.magnetic_position(position); - } - - this.widget = function() - { - if(this.size.width < 2 || this.size.height < 2){ return ""; } - return this.size.value; - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - } -} \ No newline at end of file diff --git a/archives/scripts/modules/module.js b/archives/scripts/modules/module.js deleted file mode 100644 index 92531e8..0000000 --- a/archives/scripts/modules/module.js +++ /dev/null @@ -1,167 +0,0 @@ -function Module(rune) -{ - this.name = this.constructor.name.toLowerCase(); - this.rune = rune; - this.element = null; - this.settings = {}; - this.methods = {}; - this.modes = {}; - this.layer = null; - this.is_locked = false; - - this.docs = "Missing documentation."; - - this.add_method = function(method) - { - method.host = this; - this.methods[method.name] = method; - } - - this.add_setting = function(setting) - { - setting.host = this; - this.settings[setting.name] = setting; - } - - this.add_mode = function(mode) - { - mode.host = this; - this.modes[mode.name] = mode; - } - - this.install = function() - { - } - - this.context = function() - { - return this.get_layer().context(); - } - - this.create_layer = function(blink = false) - { - this.layer = new Layer(this.constructor.name+".Preview",this); - this.layer.element.setAttribute("style","z-index:7000"); - if(blink){ this.layer.blink(); } - ronin.frame.add_layer(this.layer); - } - - this.get_layer = function(is_blinking = false) - { - if(!this.layer){ this.create_layer(); this.layer.is_blinking = is_blinking } - return this.layer; - } - - this.hint = function(method) - { - var html = ""; - - if(method){ - html += method; - } - else{ - for(id in this.methods){ - html += this.methods[id]+" "; - } - for(id in this.settings){ - html += this.settings[id]+" "; - } - for(mode in this.modes){ - html += this.modes[mode]+" "; - } - } - - return html; - } - - this.pad = function(input) - { - var s = ""; - for (i = 0; i < input.length+1; i++){ - s += "_"; - } - return ""+s+""; - } - - this.widget = function() - { - return ""; - } - - this.lock = function() - { - ronin.terminal.is_locked = true; - } - - this.unlock = function() - { - ronin.terminal.is_locked = false; - } - - // Mouse - - this.mouse_mode = function() - { - for(mode_id in this.modes){ - if(!keyboard.shift_held && !keyboard.alt_held && !this.modes[mode_id].key){ - return this.modes[mode_id].name; - } - } - return null; - } - - this.mouse_pointer = function(position) - { - return ronin.cursor.draw_pointer_arrow(position); - } - - this.mouse_from = null; - this.mouse_held = null; - this.mouse_prev = null; - - this.mouse_down = function(position) - { - } - - this.mouse_move = function(position,rect) - { - } - - this.mouse_up = function(position,rect) - { - } - - // Keyboard - - this.key_escape = function() - { - - } - - this.key_delete = function() - { - } - - this.key_arrow_up = function() - { - ronin.frame.layer_up(); - } - - this.key_arrow_down = function() - { - ronin.frame.layer_down(); - } - - this.key_arrow_left = function() - { - } - - this.key_arrow_right = function() - { - } - - this.toString = function() - { - return ""+this.name+""; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/overlay.js b/archives/scripts/modules/overlay.js deleted file mode 100644 index f17758c..0000000 --- a/archives/scripts/modules/overlay.js +++ /dev/null @@ -1,221 +0,0 @@ -function Overlay(rune) -{ - Module.call(this,rune); - - this.color = new Color("#ffffff"); - - // draw - - this.draw = function(position,rect) - { - if(!this.layer){ this.create_layer(true); this.layer.is_blinking = true; } - - if(!position){ position = new Position("0,0"); } - - this.layer.clear(); - - if(rect){ - this.draw_rect(position,rect); - } - else if(position.x !== 0 && position.y !== 0){ - this.draw_pointer(position); - } - else if(position.x !== 0 ){ - this.draw_vertical_line(position); - } - else if(position.y !== 0 ){ - this.draw_horizontal_line(position); - } - } - - this.draw_rect = function(position = new Position(0,0),rect) - { - if(!position || !rect){ return; } - - this.context().beginPath(); - - position.normalize(rect); - - this.context().moveTo(position.x,position.y); - this.context().lineTo(position.x + rect.width,position.y); - this.context().lineTo(position.x + rect.width,position.y + rect.height); - this.context().lineTo(position.x,position.y + rect.height); - this.context().lineTo(position.x,position.y); - - // Limits - this.context().moveTo(position.x + (rect.width/2),position.y-2); - this.context().lineTo(position.x + (rect.width/2),position.y+2); - this.context().moveTo(position.x + (rect.width/2),position.y + rect.height-2); - this.context().lineTo(position.x + (rect.width/2),position.y + rect.height+2); - this.context().moveTo(position.x + rect.width-2,position.y + (rect.height/2)); - this.context().lineTo(position.x + rect.width+2,position.y + (rect.height/2)); - this.context().moveTo(position.x+2,position.y + (rect.height/2)); - this.context().lineTo(position.x-2,position.y + (rect.height/2)); - - // Center - var radius = 3; - var radius_2 = 4; - this.context().moveTo(position.x + (rect.width/2) + radius,position.y + (rect.height/2)); - this.context().lineTo(position.x + (rect.width/2) + radius_2,position.y + (rect.height/2)); - this.context().moveTo(position.x + (rect.width/2) - radius,position.y + (rect.height/2)); - this.context().lineTo(position.x + (rect.width/2) - radius_2,position.y + (rect.height/2)); - - this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius); - this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) + radius_2); - this.context().moveTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius); - this.context().lineTo(position.x + (rect.width/2),position.y + (rect.height/2) - radius_2); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000"; - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff"; - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_pointer = function(position) - { - this.context().beginPath(); - - this.context().moveTo(position.x + 2,position.y); - this.context().lineTo(position.x + 5,position.y); - this.context().moveTo(position.x,position.y + 2); - this.context().lineTo(position.x,position.y + 5); - this.context().moveTo(position.x - 2,position.y); - this.context().lineTo(position.x - 5,position.y); - this.context().moveTo(position.x,position.y - 2); - this.context().lineTo(position.x,position.y - 5); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000"; - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff"; - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_line = function(position,to) - { - this.context().beginPath(); - - this.context().moveTo(position.x,position.y); - this.context().lineTo(to.x,to.y); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000"; - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff"; - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_circle = function(position,radius = 5) - { - this.context().beginPath(); - this.context().arc(position.x, position.y, radius, 0, 2 * Math.PI, false); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000" - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff" - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_cross = function(position,radius = 5) - { - this.context().beginPath(); - - this.context().moveTo(position.x+(radius-2),position.y); - this.context().lineTo(position.x+radius,position.y); - this.context().moveTo(position.x-(radius-2),position.y); - this.context().lineTo(position.x-radius,position.y); - this.context().moveTo(position.x,position.y+(radius-2)); - this.context().lineTo(position.x,position.y+radius); - this.context().moveTo(position.x,position.y-(radius-2)); - this.context().lineTo(position.x,position.y-radius); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000" - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff" - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_vertical_line = function(position) - { - this.context().beginPath(); - - this.context().moveTo(position.x,0); - this.context().lineTo(position.x,ronin.frame.size.height); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000" - this.context().stroke(); - - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff" - this.context().stroke(); - - this.context().closePath(); - } - - this.draw_horizontal_line = function(position) - { - this.context().beginPath(); - - this.context().moveTo(0,position.y); - this.context().lineTo(ronin.frame.size.width,position.y); - - this.context().lineCap="square"; - this.context().lineWidth = 2; - this.context().strokeStyle = "#000000" - this.context().stroke(); - - this.context().lineCap="round"; - this.context().lineWidth = 1; - this.context().strokeStyle = "#ffffff" - this.context().stroke(); - - this.context().closePath(); - } - - this.clear = function() - { - this.layer.remove(this); - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - } -} \ No newline at end of file diff --git a/archives/scripts/modules/path.js b/archives/scripts/modules/path.js deleted file mode 100644 index 4bc1272..0000000 --- a/archives/scripts/modules/path.js +++ /dev/null @@ -1,149 +0,0 @@ -function Path(rune) -{ - Module.call(this,rune); - - this.add_mode(new Mode("stroke")); - this.add_mode(new Mode("arc","shift")); - this.add_mode(new Mode("arc_cc","alt")); - this.add_mode(new Mode("stem","shift_alt")); - - this.add_setting(new Setting("fill_color","#ff0000")); - this.add_setting(new Setting("line_width","3")); - this.add_setting(new Setting("line_color","#ffffff")); - this.add_setting(new Setting("line_cap","square")); - - this.add_method(new Method("stroke",["Positions"])); - this.add_method(new Method("fill",["Positions"])); - - this.coordinates = []; - this.last_pos = null; - this.paths = []; - - this.stroke = function(cmd,preview = false) - { - if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; } - - this.layer.clear(); - - var context = preview ? this.context() : ronin.frame.context(); - - context.beginPath(); - context.lineCap = this.settings["line_cap"].value; - context.lineWidth = this.settings["line_width"].value; - context.strokeStyle = this.settings["line_color"].value; - context.stroke(new Path2D(cmd.values())); - context.closePath(); - - if(!preview){ this.coordinates = []; this.last_pos = null; if(!preview){ this.layer.remove(this); } } - - return 1, preview ? "preview" : "ok"; - } - - this.fill = function(cmd,preview = false) - { - if(!ronin.path.layer){ ronin.path.create_layer(); ronin.path.layer.is_blinking = true; } - - this.layer.clear(); - - var context = preview ? this.context() : ronin.frame.context(); - - context.beginPath(); - context.fillStyle = this.settings["fill_color"].value; - context.fill(new Path2D(cmd.values())); - context.closePath(); - - if(!preview){ this.coordinates = []; this.last_pos = null; } - - return 1, preview ? "preview" : "ok"; - } - - // Tools - - this.create_path = function() - { - var command = ""; - - for (var i = 0; i < this.coordinates.length; i++) { - command += this.coordinates[i]+" "; - } - return command; - } - - this.create_svg = function() - { - var s = ""; - for (var i = 0; i < this.paths.length; i++) { - s += ""; - } - return ""+s+""; - } - - // Mouse - - this.mouse_mode = function() - { - if(keyboard.shift_held == true && keyboard.alt_held == true){ - return "Path(Origin)"; - } - else if(keyboard.shift_held == true){ - return "Path(Counterclock Arc)"; - } - else if(keyboard.alt_held == true){ - return "Path(Clockwise Arc)"; - } - else{ - return "Path(Line)"; - } - } - - this.mouse_down = function(position) - { - var method = ronin.terminal.cmd().method() ? ronin.terminal.cmd().method().name : "stroke"; - var line = "path."+method+" "+this.create_path(); - line += "M"+position.toString(); - ronin.terminal.update(line); - } - - this.mouse_move = function(position) - { - var method = ronin.terminal.cmd().method().name; - var line = "path."+method+" "+this.create_path(); - line += "L"+position.toString(); - ronin.terminal.update(line); - } - - this.mouse_up = function(position) - { - var method = ronin.terminal.cmd().method().name; - - if(this.coordinates.length == 0){ - this.coordinates.push("M"+position.toString()); - } - else{ - var offset = this.last_pos ? position.offset(this.last_pos) : position; - - if(keyboard.shift_held == true && keyboard.alt_held == true){ - this.coordinates.push("M"+position.toString()); - } - else if(keyboard.shift_held == true){ - this.coordinates.push("a"+offset.toString()+" 0 0,1 "+offset.toString()); - } - else if(keyboard.alt_held == true){ - this.coordinates.push("a"+offset.toString()+" 0 0,0 "+offset.toString()); - } - else{ - this.coordinates.push("l"+offset.toString()); - } - } - - ronin.terminal.update("path."+method+" "+this.create_path()); - this.last_pos = position; - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - this.coordinates = []; - this.last_pos = null; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/render.js b/archives/scripts/modules/render.js deleted file mode 100644 index 4c021f5..0000000 --- a/archives/scripts/modules/render.js +++ /dev/null @@ -1,37 +0,0 @@ -function Render(rune) -{ - Module.call(this,rune); - - this.filters = {}; - - this.add_method(new Method("balance",["color"])); - this.add_method(new Method("stencil",["angle","color"])); - this.add_method(new Method("chromatic",["position","float"])); - - this.filters["balance"] = new Filter_Balance(); - this.filters["grey"] = new Filter_Grey(); - this.filters["stencil"] = new Filter_Stencil(); - this.filters["invert"] = new Filter_Invert(); - this.filters["chromatic"] = new Filter_Chromatic(); - this.filters["sharpen"] = new Filter_Sharpen(); - this.filters["saturate"] = new Filter_Saturate(); - this.filters["contrast"] = new Filter_Contrast(); - - this.stencil = function(cmd,preview = false) - { - var f = new Filter_Stencil(); - - if(preview){ f.preview(cmd); } - else{ f.render(cmd); } - } - - this.chromatic = function(cmd,preview = false) - { - var f = new Filter_Chromatic(); - - if(preview){ f.preview(cmd); } - else{ f.render(cmd); } - - return "Done."; - } -} diff --git a/archives/scripts/modules/source.js b/archives/scripts/modules/source.js deleted file mode 100644 index 221ebc3..0000000 --- a/archives/scripts/modules/source.js +++ /dev/null @@ -1,147 +0,0 @@ -function Source(rune) -{ - Module.call(this,rune); - - this.modal_element = null; - - this.add_setting(new Setting("format","png")); - this.add_setting(new Setting("quality","1")); - - this.add_method(new Method("save",["name","rect","format"])); - this.add_method(new Method("load",["path","position","rect"])); - this.add_method(new Method("help")); - - this.install = function() - { - this.modal_element = document.createElement("modal"); - this.modal_element.id = "modal"; - this.modal_element.setAttribute("class","hidden"); - ronin.element.appendChild(this.modal_element); - } - - this.load = function(params,preview = false) // source.load /01.jpg 0,0 100x100 - { - if(!params.filepath()){ return 0, "Path?"; } - if(!params.rect()){ return 0,"Rect?"; } - - var position = params.position() ? params.position() : new Position("0,0"); - var rect = params.rect() ? params.rect() : new Rect("50,50"); - - ronin.overlay.draw(position,rect); - - if(preview){ return; } - if(this.is_locked){ console.log("Locked!"); return 0,"The source module is locked."; } - - this.lock(); - - base_image = new Image(); - base_image.src = "../assets/"+params.filepath().path; - base_image.src += '?'+new Date().getTime(); - base_image.crossOrigin = "Anonymous"; - - base_image.onload = function(){ - var width = base_image.naturalWidth; - var height = base_image.naturalHeight; - if(params.rect()){ - width = params.rect().width; - height = params.rect().height; - position.normalize(params.rect()); - } - // Scale with only 1 unit - width = isNaN(width) && height > 0 ? (height*base_image.naturalWidth)/base_image.naturalHeight : width; - height = isNaN(height) && width > 0 ? (width*base_image.naturalHeight)/base_image.naturalWidth : height; - - ronin.frame.active_layer.context().drawImage(base_image, position.x, position.y, width, height); - ronin.overlay.clear(); - ronin.source.unlock(); - } - - return 1,"Loaded "+params.filepath().path+" at "+position.toString(); - } - - this.save = function(params,preview = false) - { - if(preview){ return; } - if(!this.layer){ this.create_layer(); } - - var d = null; - - this.modal(); - - if(this.settings["format"].value == "jpg"){ - this.modal("image",""); - } - else{ - this.modal("image",""); - } - /* - if(params.setting("format") && params.setting("format").value == "svg"){ - ronin.terminal.log(new Log(this,ronin.path.create_svg(),"image")); - } - else if(params.setting("format") && params.setting("format").value == "rin"){ - var w = window.open('about:blank','source'); - var html = ""; - for (i = 0; i < ronin.terminal.history.length; i++) { html += ronin.terminal.history[i]+";
"; } - w.document.write("Source
"+html+"
"); - } - else - */ - - this.layer.remove(this); - - return 1,"Rendered the "+this.settings.format+" image, "+this.settings.quality+"." - } - - this.help = function(params,preview = false) - { - if(preview){ return; } - - html = ""; - - for(module_id in ronin.modules){ - html += ronin.modules[module_id]+"\n"; - - for(mode_id in ronin.modules[module_id].modes){ - html += " "+ronin.modules[module_id].modes[mode_id]+"\n"; - } - for(setting_id in ronin.modules[module_id].settings){ - html += " "+ronin.modules[module_id].settings[setting_id]+"\n"; - } - for(method_id in ronin.modules[module_id].methods){ - html += " "+ronin.modules[module_id].methods[method_id]+"\n"; - } - } - - this.modal("text",html); - } - - this.modal = function(type,content) - { - this.modal_element.setAttribute("class",type); - this.modal_element.innerHTML = content; - } - - this.merge = function() - { - var a = []; - for(layer_name in ronin.frame.layers){ - if(ronin.frame.layers[layer_name].manager){ continue; } - a.push(ronin.frame.layers[layer_name]); - } - for (i = 0; i < a.length; i++) { - this.layer.context().drawImage(a[i].context().canvas,0,0,ronin.frame.size.width,ronin.frame.size.height); - } - return this.layer; - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - this.coordinates = []; - this.last_pos = null; - ronin.terminal.input.value = ""; - - this.modal_element.innerHTML = ""; - this.modal_element.setAttribute("class","hidden"); - } -} \ No newline at end of file diff --git a/archives/scripts/modules/terminal.js b/archives/scripts/modules/terminal.js deleted file mode 100644 index de37171..0000000 --- a/archives/scripts/modules/terminal.js +++ /dev/null @@ -1,135 +0,0 @@ -function Terminal(rune) -{ - Module.call(this); - - this.element = document.createElement("div"); - this.input = document.createElement("input"); - this.hint_element = document.createElement("div"); - this.logs_element = document.createElement("div"); - this.hint_element.id = "hint"; - this.logs_element.id = "logs"; - this.logs_element.innerHTML = "Hello there"; - - this.history = []; - this.locks = []; - - this.add_method(new Method("load",["file_name.rin"])); - - // Module - this.install = function(cmd) - { - this.element.appendChild(this.input); - this.element.appendChild(this.hint_element); - this.element.appendChild(this.logs_element); - - this.input.value = "" - this.hint_element.innerHTML = ""; - } - - this.run = function(target_cmd) - { - var command = target_cmd ? target_cmd : this.cmd(); - var module = command.module(); - var method = command.method(); - var setting = command.setting(); - - console.info(command.content); // Don't remove - - if(method){ - method.run(command); - } - if(setting){ - module.settings[setting].update(command.values()); - this.log(new Log(module,module.settings[setting])); - } - this.hint_element.innerHTML = ""; - this.input.value = ""; - this.update(); - } - - this.update = function(value = null, preview = true) - { - if(value){ this.input.value = value; this.input.focus(); } - - var command = this.cmd(); - var module = command.module(); - var method = command.method(); - var autocomplete = this.find_autocomplete(command,module,method); - - if(method && preview){ - method.preview(command); - } - - this.hint_element.innerHTML = ""+this.input.value+""+(autocomplete ? ''+autocomplete+'' : '')+(this.input.value ? " > " : "")+(module ? module.hint(method) : ronin.hint(method)); - ronin.cursor.update(); - } - - this.run_multi = function(lines) - { - lines = lines.split(";"); - if(!ronin.terminal.is_locked){ - target_line = lines.shift(); - this.run(new Command(target_line)); - } - - if(lines.length > 0){ setTimeout(function(){ ronin.terminal.run_multi(lines.join(";")) }, 50); } - } - - this.log = function(log) - { - this.logs_element.innerHTML = ""; - this.logs_element.appendChild(log.element); - } - - this.cmd = function() - { - return new Command(this.input.value); - } - - this.load = function(cmd,preview = false) - { - if(preview){ return; } - - ronin.load(cmd.values()); - - return "Loading "+cmd.values(); - } - - this.find_autocomplete = function() - { - html = "" - - var entry = this.input.value; - var module = this.cmd().module(); - var method = entry.indexOf(".") > -1 ? entry.split(".")[1] : null; - - if(entry.length == 0){ return null; } - - if(module && method){ - for(id in module.methods){ - if(method == module.methods[id].name){ break; } - if(method == module.methods[id].name.substr(0,method.length)){ return module.methods[id].name.replace(method,""); } - } - } - else{ - for(id in ronin.modules){ - if(entry == ronin.modules[id].name){ break; } - if(entry == ronin.modules[id].name.substr(0,entry.length)){ return ronin.modules[id].name.replace(entry,""); } - } - } - return null; - } -} - -// Log - -function Log(host = null,message,error = false) -{ - this.host = host; - this.message = message; - this.error = error; - this.element = document.createElement("log"); - this.element.setAttribute("class",error ? "error" : "okay"); - this.element.innerHTML = ""+(this.host ? this.host.name : "Ronin")+" "+message; - console.log(this.host ? this.host.name : "Ronin",this.message); -} \ No newline at end of file diff --git a/archives/scripts/modules/terminal.widget.js b/archives/scripts/modules/terminal.widget.js deleted file mode 100644 index 84f668f..0000000 --- a/archives/scripts/modules/terminal.widget.js +++ /dev/null @@ -1,21 +0,0 @@ -function Widget(rune) -{ - Module.call(this,rune); - - this.element = document.createElement("div"); - this.element.setAttribute("id","widget"); - - this.install = function() - { - ronin.terminal.element.appendChild(this.element); - } - - this.update = function() - { - var html = ""; - for (var key in ronin.modules){ - html += ronin.modules[key].widget() ? ronin.modules[key].widget()+" " : ""; - } - this.element.innerHTML = html; - } -} \ No newline at end of file diff --git a/archives/scripts/modules/type.js b/archives/scripts/modules/type.js deleted file mode 100644 index 3d4ef79..0000000 --- a/archives/scripts/modules/type.js +++ /dev/null @@ -1,62 +0,0 @@ -function Type(rune) -{ - Module.call(this,rune); - - this.add_method(new Method("write",["Position","Text"])); - this.add_mode(new Mode("write")); - this.add_setting(new Setting("color","#000000")); - this.add_setting(new Setting("size","40")); - this.add_setting(new Setting("font","DIN Medium")); - - this.write = function(cmd,preview = false) - { - if(!this.layer){ this.create_layer(true); this.layer.is_blinking = true; } - - this.layer.clear(); - - var text = cmd.text() ? cmd.text() : "Text"; - var position = cmd.position() ? cmd.position() : new Position(40,80); - var color = this.settings["color"].value; - var size = parseFloat(this.settings["size"].value); - var font = this.settings["font"].value; - - var target_layer = preview ? this.layer : ronin.frame.active_layer; - target_layer.context().font = size+"px "+font; - target_layer.context().fillStyle = color; - target_layer.context().fillText(text,position.x,position.y); - - if(!preview){ this.layer.remove(this); } - - return 1, "Wrote "+text+" at "+position.toString(); - } - - // Mouse - - this.mouse_mode = function() - { - return "Write"; - } - - this.mouse_down = function(position) - { - var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Text"; - var line = "type.write "+position.toString()+" \""+str+"\""; - ronin.terminal.update(line); - } - - this.mouse_move = function(position,rect) - { - } - - this.mouse_up = function(position) - { - var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Text"; - var line = "type.write "+position.toString()+" \""+str+"\""; - ronin.terminal.update(line); - } - - this.key_escape = function() - { - if(this.layer){ this.layer.remove(this); } - } -} \ No newline at end of file diff --git a/archives/scripts/units/angle.js b/archives/scripts/units/angle.js deleted file mode 100644 index f395c79..0000000 --- a/archives/scripts/units/angle.js +++ /dev/null @@ -1,13 +0,0 @@ -function Angle(angle_str = "0'") -{ - Unit.call(this); - - this.example = "45'"; - - this.degrees = parseFloat(angle_str.replace('\'','')); - - this.toString = function() - { - return this.degrees+"'"; - } -} \ No newline at end of file diff --git a/archives/scripts/units/any.js b/archives/scripts/units/any.js deleted file mode 100644 index 3311a2d..0000000 --- a/archives/scripts/units/any.js +++ /dev/null @@ -1,12 +0,0 @@ -function Any(str) -{ - Unit.call(this); - - this.example = ""; - this.string = str; - - this.toString = function() - { - return this.string; - } -} \ No newline at end of file diff --git a/archives/scripts/units/bang.js b/archives/scripts/units/bang.js deleted file mode 100644 index 38587da..0000000 --- a/archives/scripts/units/bang.js +++ /dev/null @@ -1,11 +0,0 @@ -function Bang() -{ - Unit.call(this); - - this.example = ""; - - this.toString = function() - { - return "BANG"; - } -} \ No newline at end of file diff --git a/archives/scripts/units/color.js b/archives/scripts/units/color.js deleted file mode 100644 index 67cd505..0000000 --- a/archives/scripts/units/color.js +++ /dev/null @@ -1,48 +0,0 @@ -function Color(hex = '#000000') -{ - Unit.call(this); - - this.example = "#ff0000"; - this.hex = hex; - - this.rgb = function() - { - var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this.hex); - return result ? { - r: parseInt(result[1], 16), - g: parseInt(result[2], 16), - b: parseInt(result[3], 16) - } : null; - } - - this.rgba = function() - { - return "rgba("+this.rgb().r+","+this.rgb().g+","+this.rgb().b+",1)"; - } - - this.floats = function() - { - var rgb = this.rgb(); - return { r:rgb.r/255, g:rgb.g/255, b:rgb.b/255 } - } - - this.toString = function() - { - return this.hex; - } - - this.rgb_to_hex = function(rgb) - { - return "#"+parseInt(rgb.r,10).toString(16)+parseInt(rgb.g,10).toString(16)+parseInt(rgb.b,10).toString(16); - } - - this.brightness = function() - { - return this.rgb() ? (this.rgb().r + this.rgb().g + this.rgb().b)/3 : 0; - } - - this.style = function() - { - return this.brightness() > 150 ? "bright" : "dark"; - } -} \ No newline at end of file diff --git a/archives/scripts/units/filepath.js b/archives/scripts/units/filepath.js deleted file mode 100644 index 636fb68..0000000 --- a/archives/scripts/units/filepath.js +++ /dev/null @@ -1,12 +0,0 @@ -function Filepath(path_str) -{ - Unit.call(this); - - this.example = "assets/demo.png"; - this.path = path_str; - - this.toString = function() - { - return this.path; - } -} \ No newline at end of file diff --git a/archives/scripts/units/method.js b/archives/scripts/units/method.js deleted file mode 100644 index 2e6f601..0000000 --- a/archives/scripts/units/method.js +++ /dev/null @@ -1,37 +0,0 @@ -function Method(name,params,options = null) -{ - Unit.call(this); - - this.host = null; - this.name = name; - this.params = params; - this.options = options; - this.example = ""; - - this.toString = function() - { - var params_str = ""; - for(param in this.params){ - params_str += this.params[param]+"," - } - params_str = params_str.substr(0,params_str.length-1); - - var options_str = ""; - for(option in this.options){ - options_str += this.options[option]+"," - } - options_str = options_str.substr(0,options_str.length-1); - - return "."+this.name+" "+params_str+(this.options ? ' ['+options_str+']' : '')+""; - } - - this.preview = function(cmd) - { - return this.host[this.name] ? this.host[this.name](cmd,true) : ""; - } - - this.run = function(cmd) - { - return this.host[this.name] ? ronin.terminal.log(new Log(this.host,this.host[this.name](cmd,false))) : null; - } -} \ No newline at end of file diff --git a/archives/scripts/units/mode.js b/archives/scripts/units/mode.js deleted file mode 100644 index 81348c1..0000000 --- a/archives/scripts/units/mode.js +++ /dev/null @@ -1,13 +0,0 @@ -function Mode(name,key = null) -{ - Unit.call(this); - - this.host = null; - this.name = name; - this.key = key; - - this.toString = function() - { - return "~"+this.name+""+(this.key ? ' '+this.key+'' : '')+"" - } -} \ No newline at end of file diff --git a/archives/scripts/units/option.js b/archives/scripts/units/option.js deleted file mode 100644 index eaa662b..0000000 --- a/archives/scripts/units/option.js +++ /dev/null @@ -1,7 +0,0 @@ -function Option(name) -{ - Unit.call(this); - - this.name = name.split("=")[0]; - this.value = name.split("=")[1]; -} \ No newline at end of file diff --git a/archives/scripts/units/position.js b/archives/scripts/units/position.js deleted file mode 100644 index d250b15..0000000 --- a/archives/scripts/units/position.js +++ /dev/null @@ -1,56 +0,0 @@ -function Position(position_str = "0,0",y = null) -{ - Unit.call(this); - - this.example = "100,150"; - this.position_str = position_str; - - this.x = y != null ? position_str : parseFloat(position_str.split(",")[0]); - this.y = y != null ? y : parseFloat(position_str.split(",")[1]); - - this.add = function(position) - { - return new Position(this.x + position.x, this.y + position.y); - } - - this.is_equal = function(target) - { - if(target.x == this.x && target.y == this.y){ return true; } - return null; - } - - this.distance_to = function(target) - { - if(!target){ return 0; } - return Math.sqrt( (this.x-target.x)*(this.x-target.x) + (this.y-target.y)*(this.y-target.y) ); - } - - this.offset = function(position = new Position(0,0)) - { - return new Position(this.x - position.x,this.y - position.y); - } - - this.normalize = function(rect) - { - if(this.x == null){ - this.x = ronin.canvas.element.width - rect.width - Math.abs(this.x); - } - if(this.y == null){ - this.y = ronin.canvas.element.height - rect.height - Math.abs(this.y); - } - } - - this.toString = function() - { - return (isNaN(this.x) ? 0 : this.x)+","+(isNaN(this.y) ? 0 : this.y); - } - - this.is_outside = function() - { - if(this.x < 0){ return true; } - if(this.y < 0){ return true; } - if(this.x > ronin.frame.element.width/2){ return true; } - if(this.y > ronin.frame.element.height/2){ return true; } - return false; - } -} \ No newline at end of file diff --git a/archives/scripts/units/range.js b/archives/scripts/units/range.js deleted file mode 100644 index ad94ac3..0000000 --- a/archives/scripts/units/range.js +++ /dev/null @@ -1,15 +0,0 @@ -function Range(range_str) -{ - Unit.call(this); - - this.example = "10..50"; - this.range_str = range_str; - - this.from = parseFloat(this.range_str.split("..")[0]); - this.to = parseFloat(this.range_str.split("..")[1]); - - this.toString = function() - { - return this.from+".."+this.to; - } -} \ No newline at end of file diff --git a/archives/scripts/units/rect.js b/archives/scripts/units/rect.js deleted file mode 100644 index de5d7cb..0000000 --- a/archives/scripts/units/rect.js +++ /dev/null @@ -1,16 +0,0 @@ -function Rect(rect_str) -{ - Unit.call(this); - - this.rect_str = rect_str; - - this.width = rect_str ? parseFloat(this.rect_str.split("x")[0]) : 0; - this.height = rect_str ? parseFloat(this.rect_str.split("x")[1]) : 0; - - this.example = "200x300"; - - this.toString = function() - { - return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height); - } -} \ No newline at end of file diff --git a/archives/scripts/units/setting.js b/archives/scripts/units/setting.js deleted file mode 100644 index 8ddd2d7..0000000 --- a/archives/scripts/units/setting.js +++ /dev/null @@ -1,39 +0,0 @@ -function Setting(name,value) -{ - Unit.call(this); - - this.host = null; - this.name = name; - this.value = value; - - this.toString = function() - { - return "?"; - } - - this.toString = function() - { - return ":"+this.name+(this.value ? ' '+this.value+'' : '')+"" - } - - this.update = function(value) - { - this.value = value; - } - - this.to_f = function() - { - return parseFloat(this.value); - } - - this.to_rect = function() - { - return new Rect(this.value); - } - - this.to_pos = function() - { - return new Position(this.value); - } - -} \ No newline at end of file diff --git a/archives/scripts/units/unit.js b/archives/scripts/units/unit.js deleted file mode 100644 index 2468958..0000000 --- a/archives/scripts/units/unit.js +++ /dev/null @@ -1,5 +0,0 @@ -function Unit() -{ - this.example = "unknown"; - this.name = this.constructor.name; -} \ No newline at end of file diff --git a/archives/scripts/units/value.js b/archives/scripts/units/value.js deleted file mode 100644 index 79c9724..0000000 --- a/archives/scripts/units/value.js +++ /dev/null @@ -1,14 +0,0 @@ -function Value(value_str) -{ - Unit.call(this); - - this.example = "20"; - this.value = value_str; - this.float = parseFloat(this.value); - this.int = parseInt(this.value); - - this.toString = function() - { - return this.value; - } -} \ No newline at end of file diff --git a/sources/index.html b/sources/index.html index 3c4a7f4..af65380 100644 --- a/sources/index.html +++ b/sources/index.html @@ -12,6 +12,7 @@ + @@ -27,7 +28,7 @@