26 #include <QtCore/QDebug>
27 #include <QtGui/QImage>
28 #include <QtCore/QPoint>
29 #include <QtCore/QSize>
31 using namespace KJSEmbed;
49 QImage cppValue =
value.alphaChannel();
63 Qt::ImageConversionFlags arg0 = (Qt::ImageConversionFlags)KJSEmbed::
extractInt(exec, args, 0);
64 QImage cppValue =
value.createAlphaMask(arg0);
70 QImage cppValue =
value.createHeuristicMask(arg0);
75 int cppValue =
value.depth();
76 result = KJS::jsNumber(cppValue);
80 int cppValue =
value.devType();
81 result = KJS::jsNumber(cppValue);
85 int cppValue =
value.dotsPerMeterX();
86 result = KJS::jsNumber(cppValue);
90 int cppValue =
value.dotsPerMeterY();
91 result = KJS::jsNumber(cppValue);
100 bool cppValue =
value.hasAlphaChannel();
101 result = KJS::jsBoolean(cppValue);
105 int cppValue =
value.height();
106 result = KJS::jsNumber(cppValue);
110 QImage::InvertMode arg0 = (QImage::InvertMode)KJSEmbed::
extractInt(exec, args, 0);
115 bool cppValue =
value.isGrayscale();
116 result = KJS::jsBoolean(cppValue);
120 bool cppValue =
value.isNull();
121 result = KJS::jsBoolean(cppValue);
126 QByteArray arg1 = KJSEmbed::
extractQString( exec, args, 1 ).toLatin1();
127 bool cppValue =
value.load(arg0, arg1);
128 result = KJS::jsBoolean(cppValue);
134 QImage cppValue =
value.mirrored(arg0, arg1);
139 int cppValue =
value.numBytes();
140 result = KJS::jsNumber(cppValue);
144 int cppValue =
value.numColors();
145 result = KJS::jsNumber(cppValue);
149 QPoint cppValue =
value.offset();
154 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
155 int arg1 = KJSEmbed::
extractInt(exec, args, 1);
156 QRgb cppValue =
value.pixel(arg0, arg1);
157 result = KJS::jsNumber(cppValue);
161 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
162 int arg1 = KJSEmbed::
extractInt(exec, args, 1);
163 int cppValue =
value.pixelIndex(arg0, arg1);
164 result = KJS::jsNumber(cppValue);
168 QRect cppValue =
value.rect();
173 QImage cppValue =
value.rgbSwapped();
179 QByteArray arg1 = KJSEmbed::
extractQString( exec, args, 1 ).toLatin1();
180 int arg2 = KJSEmbed::
extractInt(exec, args, 2);
181 bool cppValue =
value.save(arg0, arg1, arg2);
182 result = KJS::jsBoolean(cppValue);
186 if( args.size() == 3)
188 QSize arg0 = KJSEmbed::extractVariant<QSize>(exec,args, 0);
191 QImage cppValue =
value.scaled(arg0, arg1, arg2);
194 else if( args.size() == 4)
206 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
207 Qt::TransformationMode arg1 = (Qt::TransformationMode)KJSEmbed::
extractInt(exec, args, 1);
208 QImage cppValue =
value.scaledToHeight(arg0, arg1);
213 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
214 Qt::TransformationMode arg1 = (Qt::TransformationMode)KJSEmbed::
extractInt(exec, args, 1);
215 QImage cppValue =
value.scaledToWidth(arg0, arg1);
220 int cppValue =
value.serialNumber();
221 result = KJS::jsNumber(cppValue);
230 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
231 QRgb arg1 = (QRgb)KJSEmbed::
extractInt(exec, args, 1);
236 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
241 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
246 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
256 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
257 int arg1 = KJSEmbed::
extractInt(exec, args, 1);
263 QSize cppValue =
value.size();
268 int arg0 = KJSEmbed::
extractInt(exec, args, 0);
269 int arg1 = KJSEmbed::
extractInt(exec, args, 1);
270 bool cppValue =
value.valid(arg0, arg1);
271 result = KJS::jsBoolean(cppValue);
276 result = KJS::jsNumber(cppValue);
282 {
"allGray", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callallGray},
283 {
"alphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callalphaChannel},
284 {
"copy", 4, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callcopy},
285 {
"createAlphaMask", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callcreateAlphaMask},
286 {
"createHeuristicMask", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callcreateHeuristicMask},
287 {
"depth", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::calldepth},
288 {
"dotsPerMeterX", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::calldotsPerMeterX},
289 {
"dotsPerMeterY", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::calldotsPerMeterY},
290 {
"fill", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callfill},
291 {
"hasAlphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callhasAlphaChannel},
292 {
"height", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callheight},
293 {
"invertPixels", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callinvertPixels},
294 {
"isGrayscale", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callisGrayscale},
295 {
"isNull", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callisNull},
296 {
"load", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callload},
297 {
"mirrored", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callmirrored},
298 {
"numBytes", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callnumBytes},
299 {
"numColors", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callnumColors},
300 {
"offset", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::calloffset},
301 {
"pixel", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callpixel},
302 {
"pixelIndex", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callpixelIndex},
303 {
"rect", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callrect},
304 {
"rgbSwapped", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callrgbSwapped},
305 {
"save", 2, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsave},
306 {
"scaled", 3, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callscaled},
307 {
"scaledToHeight", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callscaledToHeight},
308 {
"scaledToWidth", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callscaledToWidth},
309 {
"serialNumber", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callserialNumber},
310 {
"setAlphaChannel", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetAlphaChannel},
311 {
"setColor", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetColor},
312 {
"setDotsPerMeterX", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetDotsPerMeterX},
313 {
"setDotsPerMeterY", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetDotsPerMeterY},
314 {
"setNumColors", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetNumColors},
315 {
"setOffset", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetOffset},
316 {
"setPixel", 2, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsetPixel},
317 {
"size", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callsize},
318 {
"valid", 1, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callvalid},
319 {
"width", 0, KJS::DontDelete|KJS::ReadOnly, &ImageNS::callwidth}
326 if( args.size() == 0 )
330 if( args.size() == 1 )
334 else if( args.size() == 2 )
337 QImage( KJSEmbed::extractVariant<QSize>(exec,args, 0 ),
340 else if( args.size() == 3 )
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.
value setDotsPerMeterX(arg0)
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.
value setAlphaChannel(arg0)
static const KJS::ClassInfo info
ImageBinding(KJS::ExecState *exec, const QImage &value)
int KJSEMBED_EXPORT extractInt(KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue=0)
Extracts an integer from an argument list.
#define START_CTOR(TYPE, JSNAME, ARGS)
static const Method * methods()
value setPixel(arg0, arg1, arg2)
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...
END_VARIANT_METHOD if(args.size()==3)
value setColor(arg0, arg1)
value setDotsPerMeterY(arg0)