Porting pushStyle(), popStyle(), and boolean() to Processing.js

From CDOT Wiki
Revision as of 19:39, 19 October 2009 by Mlam19 (talk | contribs)
Jump to: navigation, search

Project Name

Porting pushStyle(), popStyle(), and boolean() to Processing.js

Project Description

Processing.js remains incomplete as a port of Processing. Among the features still to be implemented are the functions pushStyle(), popStyle(), and boolean(). The first two functions automatically save style information for later retrieval and reuse. The last "converts" arguments into a boolean value.

This project seeks to implement those three functions. The repository may be found here.

Project Leader(s)

Project Contributor(s)

Project Details

pushStyle() and popStyle()

The number of states saved is tracked by pushedStates.

pushStyle() calls curContext.save() and increments pushedStates by one.

popStyle() checks if there are any saved states via pushedStates. If there are none an error notice to the console or as a JavaScript alert, in an attempt to provide similar behaviour to Processing's implementation. If there are saved states, the function calls curContext.restore() and decrements pushedStates by one.

Related Mozilla bugs

  • #451165 - CanvasRenderingContext2D.fillStyle and strokeStyle accept invalid colours
    • pushStyle() and popStyle() use CanvasRenderingContext2D.save() and restore(). These functions save fillStyle and strokeStyle.

boolean()

Releases

Version Notes Resources
0.1 Basic functionality for pushStyle() and popStyle(). Totally untested code for boolean(). Patch

Project News

Oct. 12, 2009 - Added boolean()

Project expanded to include boolean().

Sept. 28, 2009 - Basic example working

Basic improvements allow the rudimentary Processing example to function in Processing.js.

Sept. 27, 2009 - Humble beginnings

The initial project proposal has been posted. Repository at github created.