On 4 mar, 06:10, Kevin Tarn kevn.t...@gmail.com 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; iar.length; i++)
//
According to the WhatWG spec for canvas, 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:
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 kevn.t...@gmail.com wrote:
Forgot to tell: getImageData method convert raw data to a
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
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; iar.length; i++)
//ar[i] = (byte)((int)str.charAt(i) 0xff);
//
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,
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 kevn.t...@gmail.com wrote:
I got idea from canvas2image.js(http://www.nihilogic.dk/labs/canvas2image/).
So I wrote a JSNI methods as below:
public native String
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 to
I have solved problem.
Kevin
On Thu, Feb 26, 2009 at 12:45 AM, Kevin Tarn kevn.t...@gmail.com 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