summaryrefslogtreecommitdiffstats
path: root/chalk/plugins/viewplugins/scripting/chalkcore/chalkcoremodule.h
blob: e0dbda7d585fc8b0a4ae2d73191720f77f2a3f10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
 *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library 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 Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library 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.
 */

#ifndef KRITA_KROSS_KRITACOREMODULE_H
#define KRITA_KROSS_KRITACOREMODULE_H

#include <tqstring.h>
#include <tqvariant.h>

#define KROSS_MAIN_EXPORT TDE_EXPORT

#include <api/module.h>
#include <api/event.h>

namespace Kross { namespace Api {
    class Manager;
}}

namespace Kross { namespace ChalkCore {
    /**
     * This class contains functions use to create new Kross object in a script
     */
    class ChalkCoreFactory : public Kross::Api::Event<ChalkCoreFactory>
    {
        public:
            ChalkCoreFactory(TQString packagePath);
        private:
            /**
             * This function return a new Image.
             * It takes four arguments :
             *  - width
             *  - height
             *  - colorspace id
             *  - name of the image
             *
             * And in return you get an Image object.
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::newImage(10,20, "RGBA", "kikoo")
             * @endcode
             */
            Kross::Api::Object::Ptr newImage(Kross::Api::List::Ptr);
            /**
             * This function return a new Color with the given RGB triplet
             * It takes three arguments :
             *  - red color (0 to 255)
             *  - blue color (0 to 255)
             *  - green color (0 to 255)
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::newRGBColor(255,0,0) # create a red color
             * Krosschalkcore::newRGBColor(255,255,255) # create a white color
             * @endcode
             */
            Kross::Api::Object::Ptr newRGBColor(Kross::Api::List::Ptr);
            /**
             * This function return a new Color with the given HSV triplet
             * It takes three arguments :
             *  - hue color (0 to 255)
             *  - saturation color (0 to 255)
             *  - value color (0 to 255)
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::newRGBColor(255,125,0)
             * @endcode
             */
            Kross::Api::Object::Ptr newHSVColor(Kross::Api::List::Ptr);
            /**
             * This function return a Pattern taken from the list of ressources
             * of chalk
             * It takes one argument :
             *  - the name of the pattern
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::getPattern("Bricks")
             * @endcode
             */
            Kross::Api::Object::Ptr getPattern(Kross::Api::List::Ptr);
            /**
             * This function return a Brush taken from the list of ressources
             * of chalk
             * It takes one argument :
             *  - the name of the pattern
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::getBrush("Circle (05)")
             * @endcode
             */
            Kross::Api::Object::Ptr getBrush(Kross::Api::List::Ptr);
            /**
             * This function return a Brush with a circular shape
             * It takes at least two arguments :
             *  - width
             *  - height
             * 
             * It can takes two other arguments :
             *  - width of the shading
             *  - height of the shading
             * 
             * If the shading isn't specified, no shading will be used.
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::newCircleBrush(10,20) # create a plain circle
             * Krosschalkcore::newCircleBrush(10,20,5,10) # create a gradient
             * @endcode
             */
            Kross::Api::Object::Ptr newCircleBrush(Kross::Api::List::Ptr);
            /**
             * This function return a Brush with a rectangular shape
             * It takes at least two arguments :
             *  - width
             *  - height
             * 
             * It can takes two other arguments :
             *  - width of the shading
             *  - height of the shading
             * 
             * If the shading isn't specified, no shading will be used.
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::newRectBrush(10,20) # create a plain rectangle
             * Krosschalkcore::newRectBrush(10,20,5,10) # create a gradient
             * @endcode
             */
            Kross::Api::Object::Ptr newRectBrush(Kross::Api::List::Ptr);
            /**
             * This function return a Filter taken from the list of ressources
             * of chalk
             * It takes one argument :
             *  - the name of the filter
             * 
             * For example (in ruby) :
             * @code
             * Krosschalkcore::getFilter("invert")
             * @endcode
             */
            Kross::Api::Object::Ptr getFilter(Kross::Api::List::Ptr);
            /**
             * This function loads a Brush and then returns it.
             * It takes one argument: the filename of the brush.
             */
            Kross::Api::Object::Ptr loadBrush(Kross::Api::List::Ptr);
            /**
             * This function loads a Pattern and then returns it.
             * It takes one argument: the filename of the pattern.
             */
            Kross::Api::Object::Ptr loadPattern(Kross::Api::List::Ptr);
            /**
             * This function return the directory where the script is located.
             */
            Kross::Api::Object::Ptr getPackagePath(Kross::Api::List::Ptr);
        private:
            TQString m_packagePath;
    };
    /**
     *
     */
    class ChalkCoreModule : public Kross::Api::Module
    {
        public:
            /**
             * Constructor.
             */
            ChalkCoreModule(Kross::Api::Manager* manager);

            /**
             * Destructor.
             */
            virtual ~ChalkCoreModule();

            /// \see Kross::Api::Object::getClassName
            virtual const TQString getClassName() const;
            virtual Kross::Api::Object::Ptr call(const TQString& name, Kross::Api::List::Ptr arguments);
        private:
            Kross::Api::Manager* m_manager;
            ChalkCoreFactory* m_factory;
    };
    

}}

#endif