<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -61,6 +61,7 @@ Poeple/companies who were/are contributing code to cocos2d for iPhone (alphabeti
 	* kasatani: AtlasSprite index 0 is not overwritten
 	* kermidt.zed: patches for absolutePosition in CocosNode
 		patches for Labels in Texture2D
+	* Keith Peters: author of Bezier drawing primitives
 	* Leonardo Kasperavi&#269;ius: original author of QuadParticleSystem class
 		Author of the original Bezier action
 	* lukeman: patches for MenuItem</diff>
      <filename>AUTHORS</filename>
    </modified>
    <modified>
      <diff>@@ -19,6 +19,7 @@ version 0.8 - xxx
  . Particles: added support for endSize and endSizeVar (issue #241)
  . Particles: added support for start/end/var spinning (issue #335)
  . Particles: support for World/Local coordinates (issue #241)
+ . Primitives: added bezier path support (issue #380)
  . Texture2D: new alias/antialias API (issue #226)
  . Texture2D: supports 16-bit textures RGB4 and RGB5A1 (default is RGBA4444) (issue #356)
  . Texture2D: blending mode varies according to texture (issue #125)</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -390,6 +390,12 @@ enum {
 
 
 /** CocosNodes that uses a Texture2D to render the images.
+ The texture can have a blending function.
+ If the texture has alpha premultiplied the default blending function is:
+    src=GL_ONE dst= GL_ONE_MINUS_SRC_ALPHA
+ else
+	src=GL_SRC_ALPHA dst= GL_ONE_MINUS_SRC_ALPHA
+ But you can change the blending funtion at any time.
  @since v0.8
  */
 @protocol CocosNodeTexture &lt;NSObject&gt;</diff>
      <filename>cocos2d/CocosNode.h</filename>
    </modified>
    <modified>
      <diff>@@ -46,3 +46,13 @@ void drawPoly( CGPoint *vertices, int numOfVertices, BOOL closePolygon );
 
 /** draws a circle given the center, radius and number of segments. */
 void drawCircle( CGPoint center, float radius, float angle, int segments, BOOL drawLineToCenter);
+
+/** draws a quad bezier path
+ @since v0.8
+ */
+void drawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, int segments);
+
+/** draws a cubic bezier path
+ @since v0.8
+ */
+void drawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, int segments);</diff>
      <filename>cocos2d/Primitives.h</filename>
    </modified>
    <modified>
      <diff>@@ -104,3 +104,47 @@ void drawCircle( CGPoint center, float r, float a, int segs, BOOL drawLineToCent
 	
 	free( vertices );
 }
+
+void drawQuadBezier(CGPoint origin, CGPoint control, CGPoint destination, int segments)
+{
+	CGPoint vertices[segments + 1];
+	
+	float t = 0.0f;
+	for(int i = 0; i &lt; segments; i++)
+	{
+		float x = powf(1 - t, 2) * origin.x + 2.0f * (1 - t) * t * control.x + t * t * destination.x;
+		float y = powf(1 - t, 2) * origin.y + 2.0f * (1 - t) * t * control.y + t * t * destination.y;
+		vertices[i] = CGPointMake(x, y);
+		t += 1.0f / segments;
+	}
+	vertices[segments] = destination;
+	
+	glVertexPointer(2, GL_FLOAT, 0, vertices);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	
+	glDrawArrays(GL_LINE_STRIP, 0, segments);
+	
+	glDisableClientState(GL_VERTEX_ARRAY);
+}
+
+void drawCubicBezier(CGPoint origin, CGPoint control1, CGPoint control2, CGPoint destination, int segments)
+{
+	CGPoint vertices[segments + 1];
+	
+	float t = 0;
+	for(int i = 0; i &lt; segments; i++)
+	{
+		float x = powf(1 - t, 3) * origin.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * destination.x;
+		float y = powf(1 - t, 3) * origin.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * destination.y;
+		vertices[i] = CGPointMake(x, y);
+		t += 1.0f / segments;
+	}
+	vertices[segments] = destination;
+	
+	glVertexPointer(2, GL_FLOAT, 0, vertices);
+	glEnableClientState(GL_VERTEX_ARRAY);
+	
+	glDrawArrays(GL_LINE_STRIP, 0, segments);
+	
+	glDisableClientState(GL_VERTEX_ARRAY);  
+}</diff>
      <filename>cocos2d/Primitives.m</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,7 @@
 */
 
 #import &lt;CoreGraphics/CGGeometry.h&gt;	// CGPoint
+#import &lt;OpenGLES/ES1/gl.h&gt;			// GLenum
 
 /** RGB color composed of bytes 3 bytes
 @since v0.8
@@ -170,9 +171,9 @@ typedef struct _ccV2F_C4F_T2F_Quad
 typedef struct _ccBlendFunc
 {
 	//! source blend function
-	int src;
+	GLenum src;
 	//! destination blend function
-	int dst;
+	GLenum dst;
 } ccBlendFunc;
 
 //! delta time type</diff>
      <filename>cocos2d/ccTypes.h</filename>
    </modified>
    <modified>
      <diff>@@ -214,6 +214,12 @@ Class restartAction()
 	CGPoint vertices2[] = { ccp(30,130), ccp(30,230), ccp(50,200) };
 	drawPoly( vertices2, 3, YES);
 	
+	// draw quad bezier path
+	drawQuadBezier(ccp(0,s.height), ccp(s.width/2,s.height/2), ccp(s.width,s.height), 50);
+
+	// draw cubic bezier path
+	drawCubicBezier(ccp(s.width/2, s.height/2), ccp(s.width/2+30,s.height/2+50), ccp(s.width/2+60,s.height/2-50),ccp(s.width, s.height/2),100);
+
 	
 	// restore original values
 	glLineWidth(1);</diff>
      <filename>tests/drawPrimitivesTest.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2ea2cbb1c592144e9c4ddb1192f1423f2c3fdbe5</id>
    </parent>
  </parents>
  <author>
    <name>ricardoquesada</name>
    <email>ricardoquesada@79afc9a6-2f50-0410-804d-6f1bdedaafc9</email>
  </author>
  <url>http://github.com/funkaster/cocos2d-iphone/commit/15fdca5dfb17407d1448cb0910d4008a4af72f8b</url>
  <id>15fdca5dfb17407d1448cb0910d4008a4af72f8b</id>
  <committed-date>2009-05-28T02:55:40-07:00</committed-date>
  <authored-date>2009-05-28T02:55:40-07:00</authored-date>
  <message>added bezier drawing primitives
fixed issue #380</message>
  <tree>d5bd279cba961486be8107bc41bcf65f05915ade</tree>
  <committer>
    <name>ricardoquesada</name>
    <email>ricardoquesada@79afc9a6-2f50-0410-804d-6f1bdedaafc9</email>
  </committer>
</commit>
