开发者

How to run processing scripts through java

We have a requirement to create 开发者_如何学Pythonimages via processing code and store it in a database. How do we call processing.js snippets from java code and pass arguments dynamically (e.g. in the following code, we would like to pass the angle in a dynamic fashion)

int x1 = 30, y1 = 20, x2 = 30, y2 = 180, x3 = 180, y3 = 180; 
int x = width/2, y = height/2; 
translate(x, y); 
rotate(radians(angle)); 
triangle(x1, y1, x2, y2, x3, y3); 
save("triangle.png");


Why wouldn't you just call the code from Processing itself? I imagine it can be integrated into any Java app, since it's Java.


If you really want to go this way, here is an example. However I don't see much of a point going to Javascript from Java. You may consider to use Java I/O API instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜