Difference between revisions of "Porting pushStyle(), popStyle(), and boolean() to Processing.js"

From CDOT Wiki
Jump to: navigation, search
m
 
Line 14: Line 14:
 
*[http://processing.org/reference/stringEquals_.html ''String::equals()'']
 
*[http://processing.org/reference/stringEquals_.html ''String::equals()'']
 
*[http://processing.org/reference/nf_.html ''nf()''] (bug fix)
 
*[http://processing.org/reference/nf_.html ''nf()''] (bug fix)
 +
*[http://processing.org/reference/int_.html ''int()''] (bug fix)
  
 
== Resources ==
 
== Resources ==
Line 56: Line 57:
 
*float and doubles rounded to thousandths digit.
 
*float and doubles rounded to thousandths digit.
 
*.5 rounds down rather than up.
 
*.5 rounds down rather than up.
 +
 +
===int()===
 +
*JavaScript does not distinguish between bytes and ints, causing incomplete replication of Processing behaviour
 +
*Processing's ''PApplet.parseInt(String)'' and ''PApplet.parseInt(String[])'' handles doubles-as-Strings differently. In the former, doubles are 'floored' correctly, in the latter exceptions are thrown.
  
 
==Things to do==
 
==Things to do==
Line 97: Line 102:
 
!Notes
 
!Notes
 
!Resources
 
!Resources
 +
|-
 +
|0.5
 +
|''min()'', ''max()'', ''nf()'', and ''int()'' enhanced. ''String::equals()'' implemented.
 +
|
 +
*[http://github.com/mlam19/processing-js/commit/2b829739c5a70322e384b1103bf0313e1935d045 ''int()'' GitHub commit]
 +
*[http://github.com/mlam19/processing-js/commit/6b5d56d6f9aa2d7e431164201b9aa8a007178d34 ''nf()'' GitHub commit]
 +
*[http://github.com/mlam19/processing-js/commit/c29df2b8c9cd68572ca1e01196306770fab14ff8 ''String::equals()'' GitHub commit]
 +
*[http://github.com/mlam19/processing-js/commit/541d520221006cd37df153fa656b7a657ff8025d ''min()'' and ''max()'' commit]
 
|-
 
|-
 
|0.4
 
|0.4
Line 121: Line 134:
 
!Date
 
!Date
 
!Notes
 
!Notes
 +
|-
 +
|Feb. 5, 2010
 +
|[http://wobblyretroaction.blogspot.com/2010/02/processingjs-int-and-release-05.html ''int()'' upgraded, and release 0.5 announcement]
 
|-
 
|-
 
|Feb. 2, 2010
 
|Feb. 2, 2010

Latest revision as of 07:22, 5 February 2010

Project Name

Porting Processing to Processing.js

Project Description

Processing.js remains incomplete as a port of Processing. The following functions are targeted:

Resources

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.
  • Excess pops are ignored.

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()

  • Non-zero numeric values become true
    • Bytes (0's and 1's) are interpreted as numeric values.
  • null and undefine become false.
  • Boolean arguments are returned as themselves.

strokeCap()

  • Modifies context.lineCap.
  • ROUND -> context.lineCap="round";
  • SQUARE -> context.lineCap="butt";
  • PROJECT -> context.lineCap="square";
  • Processing default (ROUND) set in function init.
  • function size modified to respect previous settings.
    • Used to recreate context and reset settings, which overwrote the desired default.

strokeJoin()

text()

  • Partially implementation missing ability to take int, float, double, and byte arguments.
  • float and doubles rounded to thousandths digit.
  • .5 rounds down rather than up.

int()

  • JavaScript does not distinguish between bytes and ints, causing incomplete replication of Processing behaviour
  • Processing's PApplet.parseInt(String) and PApplet.parseInt(String[]) handles doubles-as-Strings differently. In the former, doubles are 'floored' correctly, in the latter exceptions are thrown.

Things to do

Description Status Assigned to Link
Test cases for pushStyle() and popStyle() Done Matthew Lam Test page
Test cases for boolean() Done Matthew Lam Test page
Test cases for strokeCap() Done Matthew Lam Test page
Test cases for strokeJoin() Done Matthew Lam Test page
Test cases for text() Done Matthew Lam Test page

Releases

Version Notes Resources
0.5 min(), max(), nf(), and int() enhanced. String::equals() implemented.
0.4 text() implementation enhanced.
0.3 strokeCap() and strokeJoin() ported. Final GitHub commit
0.2 Bug fixes for pushStyle(), popStyle(), and boolean(). Functions now functional. Patch
0.1 Basic functionality for pushStyle() and popStyle(). Totally untested code for boolean(). Patch

Project News

Date Notes
Feb. 5, 2010 int() upgraded, and release 0.5 announcement
Feb. 2, 2010 nf() upgraded
Jan. 31, 2010 String::equals() completed
Jan. 31, 2010 min() and max() upgraded
Jan. 20, 2010 Release 0.4 announcement
Jan. 14, 2010 Project continuation blog
Dec. 9, 2009 Release 0.3 announcement.
Dec. 2, 2009 strokeJoin() completed.
Nov. 29, 2009 strokeCap() completed.
Nov. 19, 2009 Release 0.2 announcement.
Oct. 19, 2009 Release 0.1 announcement.
Oct. 12, 2009 Project expanded to include boolean().
Sept. 28, 2009 Basic improvements allow the rudimentary Processing example to function in Processing.js.
Sept. 27, 2009 The initial project proposal has been posted. Repository at github created.