Skip to content

Version 0.5.0

Compare
Choose a tag to compare
@abhikpal abhikpal released this 14 Apr 07:39
· 618 commits to master since this release
54e7be3

p5 version 0.5.0 is the final release for the Google Summer of Code 2018 project by Abhik Pal The project was supervised by Manindra Mohrarna of the Processing Foundation. The goal of the project were:

  1. Move the internal windowing and OpenGL framework to vispy
  2. Add support for user defined polygons
  3. Add image support

We met all of these goals completely. The first was covered by a release from earlier in the summer. These release notes summarize our later two goals. In addition to the stated goals we were also able to add minimal typography support and port some tutorials from Processing to p5:

  • Color by Daniel Shiffman
  • Vectors by Daniel Shiffman
  • Electronics by Hernando Berragán and Casey Reas

API Additions

  • The p5.PShape class is equivalent to PShape in Processing. This allows creation of arbitrary user defined polygons that can have their own style (fill, stroke, etc) and transform (rotation, translation) attributes.

  • The p5.PImage class allows for manipulating images in p5. Most of the API is similar to that of Processing's. Each image object "pretends" to be a 2D array and hence operations for cropping, copying, and pasting data can have implemented as indexing operations on the image. For instance, given some image img with dimensions 800 × 600, img[400:, :300] gives a new image with the required region. Individual pixels can be set / read as p5.Color objects though indices into the image. The class also includes functionality to apply filters and blend two images together.

  • The p5.load_image and p5.image function allow, respectively, loading and displaying images on the screen.

  • The p5.image_mode function controls how parameters to p5.image are interpreted.

  • p5.tint and the related p5.no_tint function allow for setting and disabling tinting of images that are drawn on the screen.

  • The p5.load_pixels context manager loads the current display as a global pixels PImage object. This combines functionality of Processing's loadPixels() and updatePixels().

  • p5.save and p5.save_frame methods allow users to either save the current state of the sketch or the final rendered frame as an image.

  • This release also introduces some basic typography functions like p5.text for displaying text on screen. The p5.load_font and p5.create_font allow loading font files to change the display typeface using text_font. As of now, only TrueType (ttf) and bitmap fonts are sup