Added support for directly blurring and image from lua (for wallpapers)
[tagua/yd.git] / src / luaapi / imaging.h
blob4853d07a54973995368699386d7968552cef7473
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef LUAAPI__IMAGING_H
12 #define LUAAPI__IMAGING_H
14 #include <QBrush>
15 #include "loader/image.h"
16 #include "luaapi/genericwrapper.h"
18 namespace LuaApi {
20 //BEGIN Wrapper<QRectF> -------------------------------------------------------
22 template <>
23 class Wrapper<QRectF> : public GenericWrapper<QRectF> {
24 public:
25 PROPERTY_RW(x, x, setX, number)
26 PROPERTY_RW(y, y, setY, number)
27 PROPERTY_RW(width, width, setWidth, number)
28 PROPERTY_RW(height, height, setHeight, number)
29 PROPERTY_RO(left, left, number)
30 PROPERTY_RO(right, right, number)
31 PROPERTY_RO(top, top, number)
32 PROPERTY_RO(bottom, bottom, number)
34 static const char* class_name();
35 static int to_string(lua_State* l);
36 static void create_index_table(lua_State* l);
37 static int constructor(lua_State* l);
39 static int translate(lua_State* l);
42 //END Wrapper<QRectF> ---------------------------------------------------------
45 //BEGIN Wrapper<QPointF> ------------------------------------------------------
47 template <>
48 class Wrapper<QPointF> : public GenericWrapper<QPointF> {
49 public:
50 PROPERTY_RW(x, x, setX, number)
51 PROPERTY_RW(y, y, setY, number)
53 static const char* class_name();
54 static int to_string(lua_State* l);
55 static void create_index_table(lua_State* l);
56 static int constructor(lua_State* l);
57 static int get_length(lua_State* l);
60 //END Wrapper<QPointF> --------------------------------------------------------
63 //BEGIN Wrapper<QColor>--------------------------------------------------------
65 template <>
66 class Wrapper<QColor> : public GenericWrapper<QColor> {
67 public:
68 PROPERTY_RW_TYPE(r, red, setRed, number, int)
69 PROPERTY_RW_TYPE(g, green, setGreen, number, int)
70 PROPERTY_RW_TYPE(b, blue, setBlue, number, int)
71 PROPERTY_RW_TYPE(a, alpha, setAlpha, number, int)
73 static const char* class_name();
74 static int to_string(lua_State* l);
75 static void create_index_table(lua_State* l);
76 static QColor get(lua_State* l, int index);
77 static int constructor(lua_State* l);
80 //END Wrapper<QColor>----------------------------------------------------------
83 //BEGIN GradientWrapper--------------------------------------------------------
85 template<typename T>
86 class GradientWrapper : public GenericWrapper<T> {
87 public:
88 static int index_event(lua_State* l);
89 static int newindex_event(lua_State* l);
92 //END GradientWrapper----------------------------------------------------------
95 //BEGIN Wrapper<QLinearGradient>-----------------------------------------------
97 template <>
98 class Wrapper<QLinearGradient> : public GradientWrapper<QLinearGradient> {
99 public:
100 PROPERTY_RW_CLASS(start, start, setStart, QPointF)
101 PROPERTY_RW_CLASS(finish, finalStop, setFinalStop, QPointF)
103 static const char* class_name();
104 static void create_index_table(lua_State* l);
105 static int constructor(lua_State* l);
108 //END Wrapper<QLinearGradient>-------------------------------------------------
111 //BEGIN Wrapper<QRadialGradient>-----------------------------------------------
113 template <>
114 class Wrapper<QRadialGradient> : public GradientWrapper<QRadialGradient> {
115 public:
116 PROPERTY_RW_CLASS(center, center, setCenter, QPointF)
117 PROPERTY_RW(radius, radius, setRadius, number)
118 PROPERTY_RW_CLASS(focus, focalPoint, setFocalPoint, QPointF)
120 static const char* class_name();
121 static void create_index_table(lua_State* l);
122 static int constructor(lua_State* l);
125 //END Wrapper<QRadialGradient>-------------------------------------------------
128 //BEGIN Wrapper<QConicalGradient>----------------------------------------------
130 template <>
131 class Wrapper<QConicalGradient> : public GradientWrapper<QConicalGradient> {
132 public:
133 PROPERTY_RW_CLASS(center, center, setCenter, QPointF)
134 PROPERTY_RW(angle, angle, setAngle, number)
136 static const char* class_name();
137 static void create_index_table(lua_State* l);
138 static int constructor(lua_State* l);
141 //END Wrapper<QConicalGradient>------------------------------------------------
144 //BEGIN Wrapper<QBrush>--------------------------------------------------------
146 template <>
147 class Wrapper<QBrush> : public GenericWrapper<QBrush> {
148 public:
149 static const char* class_name();
150 static void create_index_table(lua_State* l);
151 static QBrush get(lua_State* l, int index);
152 static int constructor(lua_State* l);
154 static int rotate(lua_State* l);
155 static int scale(lua_State* l);
156 static int translate(lua_State* l);
159 //END Wrapper<QBrush>----------------------------------------------------------
162 //BEGIN Wrapper<Image> --------------------------------------------------------
164 template<>
165 class Wrapper<Loader::Image> : public GenericWrapper<Loader::Image> {
166 public:
167 PROPERTY_RO(width, width, number)
168 PROPERTY_RO(height, height, number)
169 PROPERTY_RW(opacity, opacity, setOpacity, number)
171 static const char* class_name();
172 static void create_index_table(lua_State* l);
173 static int constructor(lua_State* l);
175 static int resetMatrix(lua_State* l);
176 static int rotate(lua_State* l);
177 static int scale(lua_State* l);
178 static int translate(lua_State* l);
179 static int clear(lua_State* l);
180 static int setPaintOver(lua_State* l);
181 static int fillRect(lua_State* l);
182 static int drawLine(lua_State* l);
183 static int drawImage(lua_State* l);
184 static int drawSVG(lua_State* l);
185 static int drawGlyph(lua_State* l);
186 static int expBlur(lua_State* l);
187 static int createShadow(lua_State* l);
190 //END Wrapper<Image> ----------------------------------------------------------
192 //BEGIN Wrapper<Glyph> --------------------------------------------------------
194 template<>
195 class Wrapper<Loader::Glyph> : public GenericWrapper<Loader::Glyph> {
196 public:
197 static const char* class_name();
198 static void create_index_table(lua_State* l);
199 static int constructor(lua_State* l);
202 //END Wrapper<Glyph> ----------------------------------------------------------
204 } //end namespace LuaApi
207 #endif //LUAAPI__IMAGING_H