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

From CDOT Wiki
Jump to: navigation, search
m
Line 3: Line 3:
  
 
== Project Description ==
 
== Project Description ==
[http://processingjs.org/ Processing.js] remains incomplete as a port of [http://processing.org/ Processing]. Among the features still to be implemented are the functions [http://processing.org/reference/pushStyle_.html ''pushStyle()''], [http://processing.org/reference/popStyle_.html ''popStyle()''],  [http://processing.org/reference/boolean_.html ''boolean()''], and [http://processing.org/reference/strokeCap_.html ''strokeCap()'']. The first two functions automatically save style information for later retrieval and reuse. ''boolean()'' "converts" arguments into a boolean value. ''strokeCap()'' determines how the ends of lines are rendered.
+
[http://processingjs.org/ Processing.js] remains incomplete as a port of [http://processing.org/ Processing]. Among the features still to be implemented are the functions [http://processing.org/reference/pushStyle_.html ''pushStyle()''], [http://processing.org/reference/popStyle_.html ''popStyle()''],  [http://processing.org/reference/boolean_.html ''boolean()''], [http://processing.org/reference/strokeCap_.html ''strokeCap()''], and [http://processing.org/reference/strokeJoin_.html ''strokeJoin()'']. The first two functions automatically save style information for later retrieval and reuse. ''boolean()'' "converts" arguments into a boolean value. ''strokeCap()'' determines how the ends of lines are rendered. ''strokeJoin()'' determines how the joints connecting two lines is rendered.
  
 
== Resources ==
 
== Resources ==
Line 39: Line 39:
 
*'''''function''' size'' modified to respect previous settings.
 
*'''''function''' size'' modified to respect previous settings.
 
**Used to recreate context and reset settings, which overwrote the desired default.
 
**Used to recreate context and reset settings, which overwrote the desired default.
 +
 +
===strokeJoin()===
  
 
==Things to do==
 
==Things to do==
Line 59: Line 61:
 
|-
 
|-
 
|Test cases for  ''strokeCap()''
 
|Test cases for  ''strokeCap()''
 +
|Done
 +
|[[User:mlam19|Matthew Lam]]
 +
|[http://matrix.senecac.on.ca/~mlam19/processingjs/strokeCapTest1.html Test page]
 +
|-
 +
|Test cases for  ''strokeJoin()''
 
|In progress
 
|In progress
 
|[[User:mlam19|Matthew Lam]]
 
|[[User:mlam19|Matthew Lam]]
|[http://matrix.senecac.on.ca/~mlam19/processingjs/strokeCapTest1.html Test page]
+
|[http://matrix.senecac.on.ca/~mlam19/processingjs/strokeJoinTest1.html Test page]
 
|}
 
|}
  
Line 84: Line 91:
 
!Date
 
!Date
 
!Notes
 
!Notes
 +
|-
 +
|Nov. 29, 2009
 +
|[http://wobblyretroaction.blogspot.com/2009/11/processingjs-strokecap.html ''strokeCap()'' completed].
 
|-
 
|-
 
|Nov. 19, 2009
 
|Nov. 19, 2009

Revision as of 12:21, 1 December 2009

Project Name

Porting pushStyle(), popStyle(), boolean(), and strokeCap() 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(), boolean(), strokeCap(), and strokeJoin(). The first two functions automatically save style information for later retrieval and reuse. boolean() "converts" arguments into a boolean value. strokeCap() determines how the ends of lines are rendered. strokeJoin() determines how the joints connecting two lines is rendered.

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

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() In progress Matthew Lam Test page

Releases

Version Notes Resources
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
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.