How to render Processing.org images on a Java servlet?
My scala code:
class Image extends PApplet { override def setup { size(200,200) background(0) } override def draw { stroke(255) line(10,10,50,50) } def renderImage = g.getImage } class ImageServlet extends HttpServlet { override def doGet(request: HttpServletRequest, response: HttpServletResponse) { response.setContentType("image/gif") val os: OutputStream = response.getOutputStream val image = new Image javax.imageio.ImageIO.write(image.renderImage.asInstanceOf[RenderedImage],"GIF86", os); } }
I just posted an example code here that sounds like it solves your problem too, take a look. This is Java, not Scala, but the conversion should be trivial.
Applets are usually executed on the client side (i.e. inside the browser). If you just call new Image, then plumbing will work around it, for example, a call setup()will not be completed.
new Image
setup()
, API API. API, PGraphics .
, , , "" . ServletUtils Fluid Forms Libs.
, PGraphics. PApplet, , API , , rect(), PGraphics.
Source: https://habr.com/ru/post/1717727/More articles:XNA Peer-to-Peer - networkingWhat does the CreateMask function do for BitVector32? - c #Problem using System.Collections.Specialized.BitVector32: error? - c #PHP JSON Question Return String - jsonGit / SVN for developing asp.net instead of VSS? - git.NET: how PInvoke UpdateProcThreadAttribute - c #Crawler does not create custom scan properties. - web-crawlersee if an object exists in index [i] in NSMUtableArray - arrayscocos2d MFMailComposeViewController - iphonemultithreading when locking the main thread - multithreadingAll Articles