Skip to content

Commit 17b2eaf

Browse files
committed
Split GraphicsData to its own file.
1 parent 93ed950 commit 17b2eaf

3 files changed

Lines changed: 112 additions & 0 deletions

File tree

build/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
<script src="$path/src/pixi/renderers/canvas/CanvasGraphics.js"></script>
7272
7373
<script src="$path/src/pixi/primitives/Graphics.js"></script>
74+
<script src="$path/src/pixi/primitives/GraphicsData.js"></script>
7475
7576
<script src="$path/src/pixi/extras/Strip.js"></script>
7677
<script src="$path/src/pixi/extras/Rope.js"></script>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/**
2+
* A GraphicsData object.
3+
*
4+
* @class GraphicsData
5+
* @constructor
6+
PIXI.GraphicsData = function(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape)
7+
{
8+
this.lineWidth = lineWidth;
9+
this.lineColor = lineColor;
10+
this.lineAlpha = lineAlpha;
11+
this._lineTint = lineColor;
12+
13+
this.fillColor = fillColor;
14+
this.fillAlpha = fillAlpha;
15+
this._fillTint = fillColor;
16+
this.fill = fill;
17+
18+
this.shape = shape;
19+
this.type = shape.type;
20+
};
21+
*/
22+
23+
/**
24+
* A GraphicsData object.
25+
*
26+
* @class
27+
* @memberof PIXI
28+
* @param lineWidth {number} the width of the line to draw
29+
* @param lineColor {number} the color of the line to draw
30+
* @param lineAlpha {number} the alpha of the line to draw
31+
* @param fillColor {number} the color of the fill
32+
* @param fillAlpha {number} the alpha of the fill
33+
* @param fill {boolean} whether or not the shape is filled with a colour
34+
* @param shape {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.
35+
*/
36+
37+
PIXI.GraphicsData = function(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
38+
39+
/*
40+
* @member {number} the width of the line to draw
41+
*/
42+
this.lineWidth = lineWidth;
43+
44+
/*
45+
* @member {number} the color of the line to draw
46+
*/
47+
this.lineColor = lineColor;
48+
49+
/*
50+
* @member {number} the alpha of the line to draw
51+
*/
52+
this.lineAlpha = lineAlpha;
53+
54+
/*
55+
* @member {number} cached tint of the line to draw
56+
*/
57+
this._lineTint = lineColor;
58+
59+
/*
60+
* @member {number} the color of the fill
61+
*/
62+
this.fillColor = fillColor;
63+
64+
/*
65+
* @member {number} the alpha of the fill
66+
*/
67+
this.fillAlpha = fillAlpha;
68+
69+
/*
70+
* @member {number} cached tint of the fill
71+
*/
72+
this._fillTint = fillColor;
73+
74+
/*
75+
* @member {boolean} whether or not the shape is filled with a color
76+
*/
77+
this.fill = fill;
78+
79+
/*
80+
* @member {Circle|Rectangle|Ellipse|Line|Polygon} The shape object to draw.
81+
*/
82+
this.shape = shape;
83+
84+
/*
85+
* @member {number} The type of the shape, see the Const.Shapes file for all the existing types,
86+
*/
87+
this.type = shape.type;
88+
89+
};
90+
91+
GraphicsData.prototype.constructor = GraphicsData;
92+
93+
/**
94+
* Creates a new GraphicsData object with the same values as this one.
95+
*
96+
* @return {GraphicsData}
97+
*/
98+
GraphicsData.prototype.clone = function() {
99+
100+
return new GraphicsData(
101+
this.lineWidth,
102+
this.lineColor,
103+
this.lineAlpha,
104+
this.fillColor,
105+
this.fillAlpha,
106+
this.fill,
107+
this.shape
108+
);
109+
110+
};

tasks/manifests/pixi.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"src/pixi/renderers/canvas/CanvasGraphics.js",
3737

3838
"src/pixi/primitives/Graphics.js",
39+
"src/pixi/primitives/GraphicsData.js",
3940

4041
"src/pixi/extras/Strip.js",
4142
"src/pixi/extras/Rope.js",

0 commit comments

Comments
 (0)