Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-04 Thread Matt Bishop
According to the WhatWG spec for , getImageData() returns a CavasPixelArray, which is an array of bytes. What if you created a JavaScriptObject to represent it? Does GWT thunk to bytes across the JSNI boundary OK? I know it won't pass arrays of anything back, but individual elements maybe: import

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-04 Thread Thomas Broyer
On 4 mar, 06:10, Kevin Tarn wrote: > 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[i] = (byte)((int)str.

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-03 Thread Kevin Tarn
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 wrote: > > > On 3 mar, 23:47, Kevin Tarn wrote: > > Yes. That's what I like to do. Co

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-03 Thread Thomas Broyer
On 3 mar, 23:47, Kevin Tarn 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,

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-03 Thread Kevin Tarn
Yes. That's what I like to do. Could you give an example of retreiving canvas raw data by GWT instead of JSNI? Kevin On Wed, Mar 4, 2009 at 4:18 AM, Matt Bishop wrote: > > This is pretty cool. You should try converting the data in GWT instead > of JSNI. It could go straight to bytes, or at leas

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-03 Thread Matt Bishop
This is pretty cool. You should try converting the data in GWT instead of JSNI. It could go straight to bytes, or at least it could take advantage of GWT's StringBuilder speed. On Mar 1, 4:57 pm, Kevin Tarn wrote: > Forgot to tell: getImageData method convert raw data to a Windows DIB > format.

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-01 Thread Kevin Tarn
Forgot to tell: getImageData method convert raw data to a Windows DIB format. Kevin On Mon, Mar 2, 2009 at 8:52 AM, Kevin Tarn wrote: > I got idea from canvas2image.js(http://www.nihilogic.dk/labs/canvas2image/). > So I wrote a JSNI methods as below: > > public native String getImageData(in

Re: How to retrieve data as byte[] in GWT from getImageData

2009-03-01 Thread Kevin Tarn
I got idea from canvas2image.js(http://www.nihilogic.dk/labs/canvas2image/). So I wrote a JSNI methods as below: public native String getImageData(int left, int top, int width, int height) /*-{ var oData = th...@com.messenger.client.framework.canvas::context.getImageData(left, top, wi

Re: How to retrieve data as byte[] in GWT from getImageData

2009-02-28 Thread Fabrício Cabral
Could you say how you solved this problem? For historic purpose... Thanks in advance! > I have solved problem. > > Kevin -- --fx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post

Re: How to retrieve data as byte[] in GWT from getImageData

2009-02-25 Thread Kevin Tarn
I have solved problem. Kevin On Thu, Feb 26, 2009 at 12:45 AM, Kevin Tarn wrote: > > I have a canvas widget. I want to use JSNI to get canvas bitmap by > getImageData method. Is there a way to return getImageData output to > Java byte[]? > > Kevin > > > --~--~-~--~~~---

How to retrieve data as byte[] in GWT from getImageData

2009-02-25 Thread Kevin Tarn
I have a canvas widget. I want to use JSNI to get canvas bitmap by getImageData method. Is there a way to return getImageData output to Java byte[]? Kevin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Web T