how to draw in browser?

598 views
Skip to first unread message

xf wang

unread,
Oct 12, 2010, 9:40:09 PM10/12/10
to golan...@googlegroups.com
 it's easy to print words in browser,
will it easy to draw in browser in the future(or something  like java applet)?

xf wang

unread,
Oct 12, 2010, 9:41:34 PM10/12/10
to golan...@googlegroups.com
drawing in browser is OS independent?

xf wang

unread,
Oct 12, 2010, 9:48:39 PM10/12/10
to MuSheng, golan...@googlegroups.com
could golang use html5 api to draw? 
just like c++ use opengl api to draw?

xf wang

unread,
Oct 12, 2010, 9:51:35 PM10/12/10
to MuSheng, golan...@googlegroups.com
i mean,

java has jvm,
 
what about golang use browser as golang virtual machine?

xf wang

unread,
Oct 12, 2010, 10:06:15 PM10/12/10
to MuSheng, golan...@googlegroups.com
 what about golang use browser as golang  "canvas" virtual machine?

jimt

unread,
Oct 12, 2010, 10:08:21 PM10/12/10
to golang-nuts
Perhaps you are referring to NaCL: http://code.google.com/p/nativeclient/
Go has a NaCL (Native Client) compiler. Just rebuild your Go toolchain
with 'nacl' as the target.

fango

unread,
Oct 12, 2010, 10:11:30 PM10/12/10
to golang-nuts
Just wonder, do you twitter email? Why cannot pondering a while?

A short answer is No.
html5 and browser only knows Javascript, nothing else, which I think
is good for unification (书同文).

A long answer is Yes.
Look at Svgo for one example. If that interest you, you can go on
building a local server with websocket, runs your HTML5 UI in Chrome
with realtime JSON talks. All could be done easily with Go and JS. You
would be amazed how powerful it could be.

Cheers,
Fango

Kyle Consalus

unread,
Oct 12, 2010, 11:56:14 PM10/12/10
to fango, golang-nuts
On Tue, Oct 12, 2010 at 7:11 PM, fango <fan.h...@gmail.com> wrote:
Just wonder, do you twitter email? Why cannot pondering a while?

A short answer is No.
html5 and browser only knows Javascript, nothing else, which I think
is good for unification (书同文).

A long answer is Yes.
Look at Svgo for one example. If that interest you, you can go on
building a local server with websocket, runs your HTML5 UI in Chrome
with realtime JSON talks. All could be done easily with Go and JS. You
would be amazed how powerful it could be.

Along the lines of your recommendation, a little bit of code I threw together a while ago:

It generates javascript canvas calls, and sends them to the browser.
I don't advise this approach for anything real, but it's fun to tinker with.

xf wang

unread,
Oct 13, 2010, 12:07:16 AM10/13/10
to Kyle Consalus, golan...@googlegroups.com
 that's very nice!

how to accept mouse click?

ajstarks

unread,
Oct 13, 2010, 12:32:27 AM10/13/10
to golang-nuts
Here's a pointer to SVGo, the library for SVG generation:
http://github.com/ajstarks/svgo
Example output (viewable in a modern browsers)
http://http://www.flickr.com/photos/ajstarks/sets/72157623441699483/

Also note that SVGo can also be used within a web server (see
websvg.go in the distribution)

xf wang

unread,
Oct 13, 2010, 12:53:43 AM10/13/10
to ajstarks, golan...@googlegroups.com
 wow! svgo is more like a java applet!

xf wang

unread,
Oct 13, 2010, 5:43:40 AM10/13/10
to ajstarks, golan...@googlegroups.com
i'm trying to test it
after 
8g -o svg.8 svg.go
gopack grc svg.a svg.8
8g -o android.8 android.go
8l -o android.exe android.8

and then how to run it under windows?

xf wang

unread,
Oct 13, 2010, 5:48:39 AM10/13/10
to ajstarks, golan...@googlegroups.com
btw,
i tried to 

android.exe > android.html

and it seems android.html got the code,

but  when run android.html, nothing showed in browser( in ie6 and chrome)

distributed

unread,
Oct 13, 2010, 7:19:38 AM10/13/10
to golang-nuts
xf wang, please stop sending so many emails with fragmented content.
For this kind of messasging you can use other media, such as IRC or
Twitter. Thousands of people are following this list and so many
messages with so little content just wastes all their time.

> android.exe > android.html
>
> and it seems android.html got the code,
>
> but  when run android.html, nothing showed in browser( in ie6 and chrome)

I haven't run the android example. But it being part of the svgo
library, I suspect that its output is an SVG file (check it!) and thus
file should be named android.svg.

Note that generating the SVG in Go on the server does not mean that Go
is running in the client's browser. SVG files can, IIRC, be made
interactive by embedding JavaScript in them. I'm sure that a Google
search will turn up fruitful.
Reply all
Reply to author
Forward
0 new messages