summaryrefslogtreecommitdiffstats
path: root/krita/plugins/viewplugins/scripting/samples/ruby
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:29:37 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-26 00:29:37 +0000
commit2785103a6bd4de55bd26d79e34d0fdd4b329a73a (patch)
treec2738b1095bfdb263da27bc1391403d829522a14 /krita/plugins/viewplugins/scripting/samples/ruby
parentf008adb5a77e094eaf6abf3fc0f36958e66896a5 (diff)
downloadkoffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.tar.gz
koffice-2785103a6bd4de55bd26d79e34d0fdd4b329a73a.zip
Remove krita* in preparation for name switch from Krita to Chalk
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238361 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'krita/plugins/viewplugins/scripting/samples/ruby')
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/Makefile.am18
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/changecs.rb5
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/changecs.rc9
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rb31
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rc9
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/invert.rb45
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/invertruby.rc9
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rb98
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rc9
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rb70
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rc9
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rb133
-rw-r--r--krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rc9
13 files changed, 0 insertions, 454 deletions
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/Makefile.am b/krita/plugins/viewplugins/scripting/samples/ruby/Makefile.am
deleted file mode 100644
index 2aa79416..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/Makefile.am
+++ /dev/null
@@ -1,18 +0,0 @@
-scriptsinvertdir = $(kde_datadir)/krita/scripts/invertruby
-scriptsinvert_SCRIPTS = invert.rb invertruby.rc
-
-scriptschangecsdir = $(kde_datadir)/krita/scripts/changecs
-scriptschangecs_SCRIPTS = changecs.rb changecs.rc
-
-scriptsrandompaintdir = $(kde_datadir)/krita/scripts/randompaint
-scriptsrandompaint_SCRIPTS = randompaint.rb randompaint.rc
-
-scriptsfilterstestdir = $(kde_datadir)/krita/scripts/filterstest
-scriptsfilterstest_SCRIPTS = filterstest.rb filterstest.rc
-
-scriptstorturefiltersdir = $(kde_datadir)/krita/scripts/torturefilters
-scriptstorturefilters_SCRIPTS = torture-filters.rb torture-filters.rc
-
-scriptstorturepaintingdir = $(kde_datadir)/krita/scripts/torturepainting
-scriptstorturepainting_SCRIPTS = torture-painting.rb torture-painting.rc
-
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rb b/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rb
deleted file mode 100644
index f5d99a3f..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require "krosskritacore"
-
-doc = Krosskritacore::get("KritaDocument")
-image = doc.getImage()
-image.convertToColorspace("LABA")
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rc b/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rc
deleted file mode 100644
index 4121693d..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/changecs.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="ChangeColorspaceRuby"
- text="Change Colorspace"
- description="Demonstrate how to change the colorspace in a script"
- icon=""
- interpreter="ruby"
- file="changecs.rb" />
-</KrossScripting>
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rb b/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rb
deleted file mode 100644
index 20d42dbf..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# This file is part of Krita
-#
-# Copyright (c) 2005-2006 Cyrille Berger <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require "krosskritacore"
-
-doc = Krosskritacore::get("KritaDocument")
-
-image = doc.getImage()
-layer = image.getActivePaintLayer()
-width = layer.getWidth()
-height = layer.getHeight()
-
-filter = Krosskritacore::getFilter("invert")
-
-filter.process(layer )
-filter.process(layer, 10, 10, 20, 20 )
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rc b/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rc
deleted file mode 100644
index 2f8dfb98..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/filterstest.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="FiltersTestRuby"
- text="Filters Test"
- description="Test of filters in scripting (ruby)"
- icon=""
- interpreter="ruby"
- file="filterstest.rb" />
-</KrossScripting>
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/invert.rb b/krita/plugins/viewplugins/scripting/samples/ruby/invert.rb
deleted file mode 100644
index 0a055028..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/invert.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-# This file is part of Krita
-#
-# Copyright (c) 2005-2006 Cyrille Berger <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require "krosskritacore"
-
-doc = Krosskritacore::get("KritaDocument")
-script = Krosskritacore::get("KritaScript")
-image = doc.getImage()
-layer = image.getActivePaintLayer()
-
-if(layer.colorSpaceId() != "RGBA" )
- raise("This script works only for 8bit RGBA layers")
-end
-
-width = layer.getWidth()
-height = layer.getHeight()
-script.setProgressTotalSteps(width * height)
-layer.beginPainting("invert")
-it = layer.createRectIterator( 0, 0, width, height )
-while (it.isDone() == 0)
- p = it.getRGBA()
- p[0] = 255 - p[0]
- p[1] = 255 - p[1]
- p[2] = 255 - p[2]
- it.setRGBA(p)
- script.incProgress()
- it.next()
-end
-
-layer.endPainting()
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/invertruby.rc b/krita/plugins/viewplugins/scripting/samples/ruby/invertruby.rc
deleted file mode 100644
index 9cc7bd6a..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/invertruby.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="InvertRuby"
- text="Invert (ruby)"
- description="Invert the pixel of an image (ruby)"
- icon=""
- interpreter="ruby"
- file="invert.rb" />
-</KrossScripting>
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rb b/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rb
deleted file mode 100644
index ab5f6205..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rb
+++ /dev/null
@@ -1,98 +0,0 @@
-def randomizeStyle(painter)
- painter.setFillStyle(4 *rand)
- painter.setStrokeStyle(2 *rand)
-end
-
-require "krosskritacore"
-
-doc = Krosskritacore::get("KritaDocument")
-script = Krosskritacore::get("KritaScript")
-
-image = doc.getImage()
-layer = image.getActivePaintLayer()
-width = layer.getWidth()
-height = layer.getHeight()
-
-script.setProgressTotalSteps(110)
-layer.beginPainting("random paint")
-
-painter = layer.createPainter()
-
-# create painting color
-blackcolor = Krosskritacore::newRGBColor(0,0,0)
-
-# set painting color
-painter.setPaintColor( blackcolor )
-
-# get the brush
-brush = Krosskritacore::getBrush("Circle (05)")
-
-# define the brush
-painter.setBrush(brush)
-
-# get the pattern
-pattern = Krosskritacore::getPattern("Bricks")
-
-# set the pattern
-painter.setPattern(pattern)
-
-# define the paint operation
-painter.setPaintOp("paintbrush")
-
-# randomly paint
-for i in 1..10
- # set painting color
- painter.setPaintColor( Krosskritacore::newRGBColor(rand*255,rand*255,rand*255) )
- painter.paintAt(rand * width , rand * height,1.1)
- script.incProgress()
-end
-
-# randomly rect or circle paint
-for i in 1..100
- # set painting color
- painter.setPaintColor( Krosskritacore::newRGBColor(rand*255,rand*255,rand*255) )
- painter.setBackgroundColor( Krosskritacore::newRGBColor(rand*255,rand*255,rand*255) )
- painter.setOpacity( rand*255 )
-# set the brush
- if(rand < 0.5)
- painter.setBrush( Krosskritacore::newRectBrush(rand*20,rand*20,rand*10,rand*10) )
- else
- painter.setBrush( Krosskritacore::newCircleBrush(rand*20,rand*20,rand*10,rand*10) )
- end
- # paint a point
- tqshape = rand * 7
- painter.setStrokeStyle(1)
- if( tqshape < 1 )
- painter.paintAt(rand * width , rand * height,1.1)
- elsif(tqshape < 2 )
- xs = Array.new
- ys = Array.new
- for i in 0..6
- xs[i] = rand*width
- ys[i] = rand*height
- end
- painter.paintPolyline(xs,ys)
- elsif(tqshape < 3)
- painter.paintLine(rand * width, rand * height, 1.1, rand * width, rand * height,1.1)
- elsif(tqshape < 4)
- painter.paintBezierCurve(rand * width, rand * height, 1.1, rand * width, rand * height, rand * width , rand * height, rand * width, rand * height, 1.1)
- elsif(tqshape < 5)
- randomizeStyle(painter)
- painter.paintEllipse(rand * width, rand * height, rand * width, rand * height, 1.1)
- elsif(tqshape < 6)
- xs = Array.new
- ys = Array.new
- for i in 0..6
- xs[i] = rand*width
- ys[i] = rand*height
- end
- randomizeStyle(painter)
- painter.paintPolygon(xs, ys)
- elsif(tqshape < 7)
- randomizeStyle(painter)
- painter.paintRect(rand * width, rand * height, rand * width, rand * height, 1.1)
- end
- script.incProgress()
-end
-
-layer.endPainting()
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rc b/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rc
deleted file mode 100644
index 3697f700..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/randompaint.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="RandomPaintRuby"
- text="Random Paint"
- description="Demonstrate how to use the Painter script API and paint random shape on screen"
- icon=""
- interpreter="ruby"
- file="randompaint.rb" />
-</KrossScripting>
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rb b/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rb
deleted file mode 100644
index 58cddcd6..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rb
+++ /dev/null
@@ -1,70 +0,0 @@
-# This file is part of Krita
-#
-# Copyright (c) 2006 Cyrille Berger <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require "krosskritacore"
-
-doc = Krosskritacore::get("KritaDocument")
-
-image = doc.getImage()
-layer = image.getActivePaintLayer()
-
-def testFilter(layer, filterid)
- print " applying filter ", filterid, "\n"
- begin
- filter = Krosskritacore::getFilter(filterid)
- filter.process(layer)
- rescue
- print " WARNING: this filter is incompatible with this colorspace\n"
- end
-end
-
-
-def testColorspace(layer, colorspaceid)
- print "Testing for ", colorspaceid, "\n"
- if (layer.colorSpaceId() != colorspaceid)
- layer.convertToColorspace(colorspaceid)
- end
- testFilter(layer, "invert")
- testFilter(layer, "bumpmap")
- testFilter(layer, "cimg")
- testFilter(layer, "desaturate")
- testFilter(layer, "autocontrast")
- testFilter(layer, "brightnesscontrast")
- testFilter(layer, "gaussian blur")
- testFilter(layer, "cubism")
- testFilter(layer, "emboss")
- testFilter(layer, "simplenoisereducer")
- testFilter(layer, "waveletnoisereducer")
- testFilter(layer, "oilpaint")
- testFilter(layer, "pixelize")
- testFilter(layer, "raindrops")
- testFilter(layer, "roundcorners")
- testFilter(layer, "smalltiles")
- testFilter(layer, "sobel")
-end
-
-testColorspace(layer, "RGBA")
-testColorspace(layer, "RGBA16")
-testColorspace(layer, "RGBAF16HALF")
-testColorspace(layer, "RGBAF32")
-testColorspace(layer, "CMYK")
-testColorspace(layer, "CMYKA16")
-testColorspace(layer, "CMYK")
-testColorspace(layer, "CMYKA16")
-testColorspace(layer, "LABA")
-testColorspace(layer, "LMSAF32")
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rc b/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rc
deleted file mode 100644
index c56c2818..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/torture-filters.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="TortureFiltersRuby"
- text="Torture Krita with Filters"
- description="Test all filters with all colorspaces (ruby)"
- icon=""
- interpreter="ruby"
- file="torture-filters.rb" />
-</KrossScripting>
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rb b/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rb
deleted file mode 100644
index 47216761..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rb
+++ /dev/null
@@ -1,133 +0,0 @@
-# This file is part of Krita
-#
-# Copyright (c) 2006 Cyrille Berger <[email protected]>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-require "krosskritacore"
-
-class TorturePainting
-
- def initialize()
-
- doc = Krosskritacore::get("KritaDocument")
- @script = Krosskritacore::get("KritaScript")
-
- @image = doc.getImage()
- @width = @image.getWidth()
- @height = @image.getHeight()
-
- @script.setProgressTotalSteps(30 * 10)
-
- testColorspace("RGBA")
- testColorspace("RGBA16")
- testColorspace("RGBAF16HALF")
- testColorspace("RGBAF32")
- testColorspace("CMYK")
- testColorspace("CMYKA16")
- testColorspace("CMYK")
- testColorspace("CMYKA16")
- testColorspace("LABA")
- testColorspace("LMSAF32")
-
-
- end
-
- def randomizeStyle(painter)
- painter.setFillStyle(4 *rand)
- painter.setStrokeStyle(2 *rand)
- end
-
-
- def testColorspace(cs)
- print "Torturing for ", cs, "\n"
- layer = @image.createPaintLayer("torture", 255 * rand, "RGBA" );
- torture(layer)
- end
-
-
- def torture(layer)
- layer.beginPainting("torture painting")
-
- painter = layer.createPainter()
-
- # create painting color
- blackcolor = Krosskritacore::newRGBColor(0,0,0)
-
- # set painting color
- painter.setPaintColor( blackcolor )
-
- # get the pattern
- pattern = Krosskritacore::getPattern("Bricks")
-
- # set the pattern
- painter.setPattern(pattern)
-
- # define the paint operation
- painter.setPaintOp("paintbrush")
-
- # randomly rect or circle paint
- for i in 1..30
- # set painting color
- painter.setPaintColor( Krosskritacore::newRGBColor(rand*255,rand*255,rand*255) )
- painter.setBackgroundColor( Krosskritacore::newRGBColor(rand*255,rand*255,rand*255) )
- painter.setOpacity( rand*255 )
- # set the brush
- if(rand < 0.5)
- painter.setBrush( Krosskritacore::newRectBrush(rand*20,rand*20,rand*10,rand*10) )
- else
- painter.setBrush( Krosskritacore::newCircleBrush(rand*20,rand*20,rand*10,rand*10) )
- end
- # paint a point
- tqshape = rand * 7
- painter.setStrokeStyle(1)
- if( tqshape < 1 )
- painter.paintAt(rand * @width , rand * @height,1.1)
- elsif(tqshape < 2 )
- xs = Array.new
- ys = Array.new
- for i in 0..6
- xs[i] = rand*@width
- ys[i] = rand*@height
- end
- painter.paintPolyline(xs,ys)
- elsif(tqshape < 3)
- painter.paintLine(rand * @width, rand * @height, 1.1, rand * @width, rand * @height,1.1)
- elsif(tqshape < 4)
- painter.paintBezierCurve(rand * @width, rand * @height, 1.1, rand * @width, rand * @height, rand * @width , rand * @height, rand * @width, rand * @height, 1.1)
- elsif(tqshape < 5)
- randomizeStyle(painter)
- painter.paintEllipse(rand * @width, rand * @height, rand * @width, rand * @height, 1.1)
- elsif(tqshape < 6)
- xs = Array.new
- ys = Array.new
- for i in 0..6
- xs[i] = rand*@width
- ys[i] = rand*@height
- end
- randomizeStyle(painter)
- painter.paintPolygon(xs, ys)
- elsif(tqshape < 7)
- randomizeStyle(painter)
- painter.paintRect(rand * @width, rand * @height, rand * @width, rand * @height, 1.1)
- end
- @script.incProgress()
- end
- layer.endPainting()
- end
-
-end
-
-TorturePainting.new() \ No newline at end of file
diff --git a/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rc b/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rc
deleted file mode 100644
index 6b54fa9d..00000000
--- a/krita/plugins/viewplugins/scripting/samples/ruby/torture-painting.rc
+++ /dev/null
@@ -1,9 +0,0 @@
-<KrossScripting>
- <ScriptAction
- name="TorturePainting"
- text="Torture Krita with Painting"
- description="Paint on an image and create multiple layers"
- icon=""
- interpreter="ruby"
- file="torture-painting.rb" />
-</KrossScripting>