| 219 | // Broken out so that subclasses can copy any additional variables |
| 220 | // (i.e. fillGradientPaint and strokeGradientPaint) |
| 221 | protected void setParent(PShapeSVG parent) { |
| 222 | // Need to set this so that findChild() works. |
| 223 | // Otherwise 'parent' is null until addChild() is called later. |
| 224 | this.parent = parent; |
| 225 | |
| 226 | if (parent == null) { |
| 227 | // set values to their defaults according to the SVG spec |
| 228 | stroke = false; |
| 229 | strokeColor = 0xff000000; |
| 230 | strokeWeight = 1; |
| 231 | strokeCap = PConstants.SQUARE; // equivalent to BUTT in svg spec |
| 232 | strokeJoin = PConstants.MITER; |
| 233 | strokeGradient = null; |
| 234 | // strokeGradientPaint = null; |
| 235 | strokeName = null; |
| 236 | |
| 237 | fill = true; |
| 238 | fillColor = 0xff000000; |
| 239 | fillGradient = null; |
| 240 | // fillGradientPaint = null; |
| 241 | fillName = null; |
| 242 | |
| 243 | //hasTransform = false; |
| 244 | //transformation = null; //new float[] { 1, 0, 0, 1, 0, 0 }; |
| 245 | |
| 246 | // svgWidth, svgHeight, and svgXYSize done below. |
| 247 | |
| 248 | strokeOpacity = 1; |
| 249 | fillOpacity = 1; |
| 250 | opacity = 1; |
| 251 | |
| 252 | } else { |
| 253 | stroke = parent.stroke; |
| 254 | strokeColor = parent.strokeColor; |
| 255 | strokeWeight = parent.strokeWeight; |
| 256 | strokeCap = parent.strokeCap; |
| 257 | strokeJoin = parent.strokeJoin; |
| 258 | strokeGradient = parent.strokeGradient; |
| 259 | // strokeGradientPaint = parent.strokeGradientPaint; |
| 260 | strokeName = parent.strokeName; |
| 261 | |
| 262 | fill = parent.fill; |
| 263 | fillColor = parent.fillColor; |
| 264 | fillGradient = parent.fillGradient; |
| 265 | // fillGradientPaint = parent.fillGradientPaint; |
| 266 | fillName = parent.fillName; |
| 267 | |
| 268 | svgWidth = parent.svgWidth; |
| 269 | svgHeight = parent.svgHeight; |
| 270 | svgSizeXY = parent.svgSizeXY; |
| 271 | |
| 272 | opacity = parent.opacity; |
| 273 | } |
| 274 | |
| 275 | // The rect and ellipse modes are set to CORNER since it is the expected |
| 276 | // mode for svg shapes. |
| 277 | rectMode = CORNER; |
| 278 | ellipseMode = CORNER; |