//javascript per-pixel processing function
var pixelfunction=function( rgb , index )
{
var outval = (rgb[0]-rgb[1]/(rgb[0]+rgb[1]) ;
return outval;
}
//c++ codes loop call pixelfunction
...
v8::Function* pixelFunc = ...; // this Function pointer is pixelfunction in javascript.
v8::Local<v8::Uint8Array> vals = ...; //
v8::Local<Value> targs[2] ;
for(int it = 0 ;it<1024*1024;++it)
{
vals = ...; // get r,g,b values from image ;
targs[0] = vals;
targs[1] = v8::Integer::New( global , it );
pixelFunc->Call( context , context->Global() , 2 , targs);//For convenience, I'm giving up the return value.
}
...
//javascript loop call:
var vals=new Uint8Array(3);
for(var it = 0 ; it < 1024*1024 ; ++it )
{
vals=...; //get r,g,b values from image
pixelfunction( vals , it );//For convenience, I'm giving up the return value.
}
--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/dd3c7a28-1144-4e5f-a982-15e8558d7e5c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAFSTc_g3hQ9P3bevpXqjux%2BZa%3DMcZmQRyjQ-uD62Mi3w_tkezg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/1589661290983.hsmxtszv0tk5ohvnejt3hcts%40android.mail.163.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/CAKSzg3QOYeOcxrxLWvSXdrhhvcFD1%3DYn%2BxubmM%2BivcaUdzQ3-A%40mail.gmail.com.