Git Product home page Git Product logo

prender's Introduction

PRender is a way to use Processing from inside Python. Like this:

Draw an X and save it as a "x.png":

  from prender import processing
  pr = processing.BaseRenderer()
  pr.start(200,200)
  pr.line(0,0,100,100)
  pr.line(0,100,100,0)
  pr.saveLocal( "x.png" )
  pr.stop()
  
If python throws an unhandled exception while the renderer is running, it will stall forever. Some sugar to handle that:

  from prender import processing
  pr = processing.BaseRenderer()
  
  def draw(xx):
    xx.line(0,0,100,100)
    xx.line(0,100,100,0)
    xx.saveLocal( "x.png" )
    raise Exception( "random problem" )
  
  pr.execute( 200, 200, draw )
  
The execute() method runs the function draw() until it finishes or catches an exception, at which point it stops the renderer.

The class "MapRenderer" is helpful for rendering maps

  from prender import processing
  mr = processing.MapRenderer()
  mr.start(-500,-500,500,500,500) #left,bottom,right,top,width
  mr.background(255,255,255)
  mr.line(-500,-500,500,500) #from lower-lefthand to upper-righthand
  mr.saveLocal("map.png")
  mr.stop()

==== INSTALLATION INSTRUCTIONS ====

--== Compile rendering server ==--

1) Open renderer/renderer.pde in Processing
2) Run it. It may throw an error along the lines of.
  "java.lang.ClassCastException: renderer cannot be cast to processing.core.PApplet
    at processing.core.PApplet.main(PApplet.java:6486)"
3) Go to "File"->"Export Application" and export a linux or mac application, depending on your platform.

--== Install rendering server ==--

$ sudo make install

--== Install python client library ==--

$ sudo python setup install

--== Test ==--

$ cd prender
$ python processing.py

If everything is working properly, several images should show up in the local directory. You can delete them; they don't do anything.

prender's People

Contributors

bmander avatar wlach avatar

Stargazers

Angus H. avatar JT5D avatar weakdancer avatar Michael Mulley avatar  avatar Khash  avatar Ryan Greenberg avatar Prof Syd Xu avatar  avatar  avatar Urban Mapping Dev avatar  avatar Johan Berg avatar Philipp Wassibauer avatar  avatar Dane Springmeyer avatar Miguel Vaz avatar Michael Malone avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.