2222
2323package processing .opengl ;
2424
25- import java .io .InputStream ;
26- import java .util .zip .GZIPInputStream ;
27-
28- import processing .core .PApplet ;
2925import processing .core .PGraphics ;
3026import processing .core .PMatrix3D ;
3127import processing .core .PShape ;
3228import processing .core .PShapeSVG ;
33- import processing . data . XML ;
29+
3430
3531public class PGraphics2D extends PGraphicsOpenGL {
3632
@@ -232,6 +228,7 @@ public void shape(PShape shape, float x, float y, float z,
232228 }
233229
234230
231+
235232 //////////////////////////////////////////////////////////////
236233
237234 // SHAPE I/O
@@ -242,33 +239,17 @@ static protected boolean isSupportedExtension(String extension) {
242239 }
243240
244241
245- static protected PShape loadShapeImpl (PGraphics pg , String filename ,
246- String extension ) {
247- PShapeSVG svg = null ;
248-
249- if (extension .equals ("svg" )) {
250- svg = new PShapeSVG (pg .parent .loadXML (filename ));
251-
252- } else if (extension .equals ("svgz" )) {
253- try {
254- InputStream input =
255- new GZIPInputStream (pg .parent .createInput (filename ));
256- XML xml = new XML (PApplet .createReader (input ));
257- svg = new PShapeSVG (xml );
258- } catch (Exception e ) {
259- e .printStackTrace ();
260- }
261- }
262-
263- if (svg != null ) {
264- PShapeOpenGL p2d = PShapeOpenGL .createShape2D ((PGraphicsOpenGL )pg , svg );
265- return p2d ;
266- } else {
267- return null ;
242+ static protected PShape loadShapeImpl (PGraphics pg ,
243+ String filename , String extension ) {
244+ if (extension .equals ("svg" ) || extension .equals ("svgz" )) {
245+ PShapeSVG svg = new PShapeSVG (pg .parent .loadXML (filename ));
246+ return PShapeOpenGL .createShape2D ((PGraphicsOpenGL ) pg , svg );
268247 }
248+ return null ;
269249 }
270250
271251
252+
272253 //////////////////////////////////////////////////////////////
273254
274255 // SHAPE CREATION
0 commit comments