24 #include <QtCore/QDebug>
25 #include <QtGui/QPixmap>
26 #include <QtGui/QBitmap>
27 #include <QtGui/QWidget>
32 using namespace KJSEmbed;
52 QRect
arg0 = KJSEmbed::extractVariant<QRect>(exec,args, 0);
53 QPixmap cppValue =
value.copy(arg0);
56 else if( args.size() == 4)
69 QBitmap cppValue =
value.createHeuristicMask(arg0);
75 QBitmap cppValue =
value.createMaskFromColor(arg0);
80 int cppValue =
value.defaultDepth();
81 result = KJS::jsNumber(cppValue);
85 int cppValue =
value.depth();
86 result = KJS::jsNumber(cppValue);
92 QWidget* arg0 = KJSEmbed::extractObject<QWidget>(exec,args, 0);
95 value.fill(arg0, arg1, arg2);
97 else if( args.size() == 1)
99 QColor arg0 = KJSEmbed::extractVariant<QColor>(exec,args, 0);
102 else if( args.size() == 2)
104 QWidget* arg0 = KJSEmbed::extractObject<QWidget>(exec,args, 0);
105 QPoint arg1 = KJSEmbed::extractVariant<QPoint>(exec,args, 1);
106 value.fill(arg0, arg1);
112 Qt::ImageConversionFlags arg1 = (Qt::ImageConversionFlags)KJSEmbed::
extractInt(exec, args, 1);
113 QPixmap cppValue = QPixmap::fromImage(arg0, arg1);
118 if( args.size() == 2)
120 QWidget* arg0 = KJSEmbed::extractObject<QWidget>(exec,args, 0);
121 QRect arg1 = KJSEmbed::extractVariant<QRect>(exec,args, 1);
122 QPixmap cppValue =
value.grabWidget(arg0, arg1);
125 else if( args.size() == 5)
127 QWidget* arg0 = KJSEmbed::extractObject<QWidget>(exec,args, 0);
132 QPixmap cppValue =
value.grabWidget(arg0, arg1, arg2, arg3, arg4);
138 bool cppValue =
value.hasAlpha();
139 result = KJS::jsBoolean(cppValue);
143 bool cppValue =
value.hasAlphaChannel();
144 result = KJS::jsBoolean(cppValue);
148 int cppValue =
value.height();
149 result = KJS::jsNumber(cppValue);
153 bool cppValue =
value.isNull();
154 result = KJS::jsBoolean(cppValue);
158 bool cppValue =
value.isQBitmap();
159 result = KJS::jsBoolean(cppValue);
164 QByteArray arg1 = KJSEmbed::
extractQString( exec, args, 1 ).toLatin1();
165 Qt::ImageConversionFlags arg2 = (Qt::ImageConversionFlags) KJSEmbed::
extractInt(exec, args, 2);
166 bool cppValue =
value.load(arg0, arg1, arg2);
167 result = KJS::jsBoolean(cppValue);
171 QBitmap cppValue =
value.mask();
176 QRect cppValue =
value.rect();
182 QByteArray arg1 = KJSEmbed::
extractQString( exec, args, 1 ).toLatin1();
183 int arg2 = KJSEmbed::
extractInt(exec, args, 2, -1);
184 bool cppValue =
value.save(arg0, arg1, arg2);
185 result = KJS::jsBoolean(cppValue);
189 if( args.size() == 3 )
191 QSize arg0 = KJSEmbed::extractVariant<QSize>(exec,args, 0);
194 QPixmap cppValue =
value.scaled(arg0, arg1, arg2);
197 else if ( args.size() == 4)
203 QPixmap cppValue =
value.scaled(arg0, arg1, arg2, arg3);
209 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
210 Qt::TransformationMode arg1 = (Qt::TransformationMode) KJSEmbed::
extractInt(exec, args, 1);
211 QPixmap cppValue =
value.scaledToHeight(arg0, arg1);
216 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
217 Qt::TransformationMode arg1 = (Qt::TransformationMode) KJSEmbed::
extractInt(exec, args, 1);
218 QPixmap cppValue =
value.scaledToWidth(arg0, arg1);
223 int cppValue =
value.serialNumber();
224 result = KJS::jsNumber(cppValue);
238 QSize cppValue =
value.size();
243 QImage cppValue =
value.toImage();
249 result = KJS::jsNumber(cppValue);
255 {
"alphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callalphaChannel},
256 {
"copy", 3, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callcopy},
257 {
"createHeuristicMask", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callcreateHeuristicMask},
258 {
"createMaskFromColor", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callcreateMaskFromColor},
259 {
"defaultDepth", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::calldefaultDepth},
260 {
"depth", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::calldepth},
261 {
"fill", 2, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callfill},
262 {
"fromImage", 1, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callfromImage},
263 {
"grabWidget", 4, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callgrabWidget},
264 {
"hasAlpha", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callhasAlpha},
265 {
"hasAlphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callhasAlphaChannel},
266 {
"height", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callheight},
267 {
"isNull", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callisNull},
268 {
"isQBitmap", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callisQBitmap},
269 {
"load", 2, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callload},
270 {
"mask", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callmask},
271 {
"rect", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callrect},
272 {
"save", 2, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callsave},
273 {
"scaled", 3, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callscaled},
274 {
"scaledToHeight", 1, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callscaledToHeight},
275 {
"scaledToWidth", 1, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callscaledToWidth},
276 {
"serialNumber", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callserialNumber},
277 {
"setAlphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callsetAlphaChannel},
278 {
"setMask", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callsetMask},
279 {
"size", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callsize},
280 {
"toImage", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::calltoImage},
281 {
"width", 0, KJS::DontDelete|KJS::ReadOnly, &PixmapNS::callwidth}
287 if( args.size() == 0 )
291 else if( args.size() == 1 )
296 else if( args.size() == 2 )
303 else if( args.size() == 3 )
310 KJSEmbed::extractVariant<QByteArray>( exec, args, 1 ).constData(),
static const KJS::ClassInfo info
static void publish(KJS::ExecState *exec, KJS::JSObject *object, const Method *methods)
Publishes an array of Methods to an object.
KJS::JSValue * createVariant(KJS::ExecState *exec, const KJS::UString &className, const T &value)
Can create any known KJSEmbed::VariantBinding object and set the value.
bool KJSEMBED_EXPORT extractBool(KJS::ExecState *exec, const KJS::List &args, int idx, bool defaultValue=false)
Extracts a bool from an argument list.
int KJSEMBED_EXPORT extractInt(KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue=0)
Extracts an integer from an argument list.
END_QOBJECT_METHOD QByteArray className
END_VARIANT_METHOD if(args.size()==1)
#define START_CTOR(TYPE, JSNAME, ARGS)
PixmapBinding(KJS::ExecState *exec, const QPixmap &value)
value setAlphaChannel(arg0)
Qt::ImageConversionFlags arg2
static const Method * methods()
static const KJS::ClassInfo info
END_OBJECT_METHOD QBrush cppValue
#define END_VARIANT_METHOD
End a variant method started by START_VARIANT_METHOD.
END_OBJECT_METHOD QPolygon arg0
#define START_VARIANT_METHOD(METHODNAME, TYPE)
A simple variant syle method.
QString KJSEMBED_EXPORT extractQString(KJS::ExecState *exec, const KJS::List &args, int idx, const QString defaultValue=QString())
Extracts a QString from an argument list.
QVariant KJSEMBED_EXPORT extractVariant(KJS::ExecState *exec, KJS::JSValue *value)
Extracts a QVariant from a KJS::JSValue if the conversion fails a QVariant::Null is returned...
QString toQString(const KJS::UString &u)