Unfortunately, using JsArrayInteger is very slow:
    public byte[] getBitmap() {
//        String str = getImageData(0, 0, width, height);
//        byte[] ar = new byte[str.length()];
//        for (int i=0; i<ar.length; i++)
//            ar[i] = (byte)((int)str.charAt(i) & 0xff);
//        return ar;
         JsArrayInteger ja = getImageRawData(0, 0, width, height);
         int len = ja.length();
         byte[] ar = new byte[len];
         for (int i=0; i<len; i++)
             ar[i] = (byte)(ja.get(i) & 0xff);
         return ar;
    }

The loop above copying element to a byte array is 10 times above than the
commented codes. Anything doing wrong?

Kevin

On Wed, Mar 4, 2009 at 6:58 AM, Thomas Broyer <t.bro...@gmail.com> wrote:

>
>
> On 3 mar, 23:47, Kevin Tarn <kevn.t...@gmail.com> wrote:
> > Yes. That's what I like to do. Could you give an example of retreiving
> > canvas raw data by GWT instead of JSNI?
>
> Get our JSNI methods the shorter you can. Here, just make it get
> oData.data and return it as a JsArrayNumber; then do all the following
> in Java, with aImgData being the JsArrayNumber.
> My guess is that you could turn it directly to bytes as the array
> length could be computed early from width+height.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to