@@ -1853,13 +1853,13 @@ protected void drawPath(PGraphics g) {
1853
1853
break ;
1854
1854
1855
1855
case QUADRATIC_VERTEX :
1856
- g .quadraticVertex (vertices [index + 0 ][X ], vertices [index + 0 ][Y ],
1856
+ g .quadraticVertex (vertices [index ][X ], vertices [index ][Y ],
1857
1857
vertices [index +1 ][X ], vertices [index +1 ][Y ]);
1858
1858
index += 2 ;
1859
1859
break ;
1860
1860
1861
1861
case BEZIER_VERTEX :
1862
- g .bezierVertex (vertices [index + 0 ][X ], vertices [index + 0 ][Y ],
1862
+ g .bezierVertex (vertices [index ][X ], vertices [index ][Y ],
1863
1863
vertices [index +1 ][X ], vertices [index +1 ][Y ],
1864
1864
vertices [index +2 ][X ], vertices [index +2 ][Y ]);
1865
1865
index += 3 ;
@@ -1888,14 +1888,14 @@ protected void drawPath(PGraphics g) {
1888
1888
break ;
1889
1889
1890
1890
case QUADRATIC_VERTEX :
1891
- g .quadraticVertex (vertices [index + 0 ][X ], vertices [index + 0 ][Y ], vertices [index + 0 ][Z ],
1892
- vertices [index +1 ][X ], vertices [index +1 ][Y ], vertices [index +0 ][Z ]);
1891
+ g .quadraticVertex (vertices [index ][X ], vertices [index ][Y ], vertices [index ][Z ],
1892
+ vertices [index +1 ][X ], vertices [index +1 ][Y ], vertices [index +1 ][Z ]);
1893
1893
index += 2 ;
1894
1894
break ;
1895
1895
1896
1896
1897
1897
case BEZIER_VERTEX :
1898
- g .bezierVertex (vertices [index + 0 ][X ], vertices [index + 0 ][Y ], vertices [index + 0 ][Z ],
1898
+ g .bezierVertex (vertices [index ][X ], vertices [index ][Y ], vertices [index ][Z ],
1899
1899
vertices [index +1 ][X ], vertices [index +1 ][Y ], vertices [index +1 ][Z ],
1900
1900
vertices [index +2 ][X ], vertices [index +2 ][Y ], vertices [index +2 ][Z ]);
1901
1901
index += 3 ;
@@ -1957,14 +1957,14 @@ private void loadBase64Image() {
1957
1957
* @param imagePath The image path containing the base 64 image data.
1958
1958
* @return Newly loaded PImage.
1959
1959
*/
1960
- protected static PImage parseBase64Image (String imagePath ) {
1960
+ static protected PImage parseBase64Image (String imagePath ) {
1961
1961
String [] parts = imagePath .split (";base64," );
1962
1962
String extension = parts [0 ].substring (11 );
1963
1963
String encodedData = parts [1 ];
1964
1964
1965
1965
byte [] decodedBytes = Base64 .getDecoder ().decode (encodedData );
1966
1966
1967
- if (decodedBytes == null ){
1967
+ if (decodedBytes == null ) {
1968
1968
System .err .println ("Decode Error on image: " + imagePath .substring (0 , 20 ));
1969
1969
return null ;
1970
1970
}
@@ -1976,23 +1976,21 @@ protected static PImage parseBase64Image(String imagePath) {
1976
1976
int space = buffImage .getColorModel ().getColorSpace ().getType ();
1977
1977
if (space == ColorSpace .TYPE_CMYK ) {
1978
1978
System .err .println ("Could not load CMYK color space on image: " + imagePath .substring (0 , 20 ));
1979
- return null ;
1979
+ return null ;
1980
1980
}
1981
1981
}
1982
1982
1983
- // if it's a .gif image, test to see if it has transparency
1984
- boolean requiresCheckAlpha = extension .equals ("gif" ) || extension .equals ("png" ) ||
1985
- extension .equals ("unknown" );
1986
-
1987
1983
PImage loadedImage = new PImageAWT (awtImage );
1988
1984
1989
- if (requiresCheckAlpha ) {
1990
- loadedImage .checkAlpha ();
1985
+ // test whether the image has alpha (or we can draw it more quickly in RGB)
1986
+ if (extension .equals ("gif" ) || extension .equals ("png" ) ||
1987
+ extension .equals ("unknown" )) {
1988
+ loadedImage .checkAlpha ();
1991
1989
}
1992
1990
1993
- if (loadedImage .width == -1 ) {
1994
- // error...
1995
- }
1991
+ // if (loadedImage.width == -1) {
1992
+ // // error...
1993
+ // }
1996
1994
1997
1995
return loadedImage ;
1998
1996
}
@@ -2534,7 +2532,6 @@ public void setFill(boolean fill) {
2534
2532
*
2535
2533
*
2536
2534
* @webref
2537
- * @param fill
2538
2535
* @webBrief Set the fill value
2539
2536
*/
2540
2537
public void setFill (int fill ) {
@@ -2576,7 +2573,7 @@ public void setFill(int index, int fill) {
2576
2573
vertices [index ][PGraphics .A ] = ((fill >> 24 ) & 0xFF ) / 255.0f ;
2577
2574
vertices [index ][PGraphics .R ] = ((fill >> 16 ) & 0xFF ) / 255.0f ;
2578
2575
vertices [index ][PGraphics .G ] = ((fill >> 8 ) & 0xFF ) / 255.0f ;
2579
- vertices [index ][PGraphics .B ] = (( fill >> 0 ) & 0xFF ) / 255.0f ;
2576
+ vertices [index ][PGraphics .B ] = (fill & 0xFF ) / 255.0f ;
2580
2577
}
2581
2578
}
2582
2579
@@ -2643,7 +2640,7 @@ public void setTint(int index, int tint) {
2643
2640
vertices [index ][PGraphics .A ] = ((tint >> 24 ) & 0xFF ) / 255.0f ;
2644
2641
vertices [index ][PGraphics .R ] = ((tint >> 16 ) & 0xFF ) / 255.0f ;
2645
2642
vertices [index ][PGraphics .G ] = ((tint >> 8 ) & 0xFF ) / 255.0f ;
2646
- vertices [index ][PGraphics .B ] = (( tint >> 0 ) & 0xFF ) / 255.0f ;
2643
+ vertices [index ][PGraphics .B ] = (tint & 0xFF ) / 255.0f ;
2647
2644
}
2648
2645
}
2649
2646
@@ -2688,7 +2685,6 @@ public void setStroke(boolean stroke) {
2688
2685
*
2689
2686
*
2690
2687
* @webref
2691
- * @param stroke
2692
2688
* @webBrief Set the stroke value
2693
2689
*/
2694
2690
public void setStroke (int stroke ) {
@@ -2729,7 +2725,7 @@ public void setStroke(int index, int stroke) {
2729
2725
vertices [index ][PGraphics .SA ] = ((stroke >> 24 ) & 0xFF ) / 255.0f ;
2730
2726
vertices [index ][PGraphics .SR ] = ((stroke >> 16 ) & 0xFF ) / 255.0f ;
2731
2727
vertices [index ][PGraphics .SG ] = ((stroke >> 8 ) & 0xFF ) / 255.0f ;
2732
- vertices [index ][PGraphics .SB ] = (( stroke >> 0 ) & 0xFF ) / 255.0f ;
2728
+ vertices [index ][PGraphics .SB ] = (stroke & 0xFF ) / 255.0f ;
2733
2729
}
2734
2730
2735
2731
@@ -2845,7 +2841,7 @@ public void setAmbient(int index, int ambient) {
2845
2841
2846
2842
vertices [index ][PGraphics .AR ] = ((ambient >> 16 ) & 0xFF ) / 255.0f ;
2847
2843
vertices [index ][PGraphics .AG ] = ((ambient >> 8 ) & 0xFF ) / 255.0f ;
2848
- vertices [index ][PGraphics .AB ] = (( ambient >> 0 ) & 0xFF ) / 255.0f ;
2844
+ vertices [index ][PGraphics .AB ] = (ambient & 0xFF ) / 255.0f ;
2849
2845
}
2850
2846
2851
2847
@@ -2893,7 +2889,7 @@ public void setSpecular(int index, int specular) {
2893
2889
2894
2890
vertices [index ][PGraphics .SPR ] = ((specular >> 16 ) & 0xFF ) / 255.0f ;
2895
2891
vertices [index ][PGraphics .SPG ] = ((specular >> 8 ) & 0xFF ) / 255.0f ;
2896
- vertices [index ][PGraphics .SPB ] = (( specular >> 0 ) & 0xFF ) / 255.0f ;
2892
+ vertices [index ][PGraphics .SPB ] = (specular & 0xFF ) / 255.0f ;
2897
2893
}
2898
2894
2899
2895
@@ -2942,7 +2938,7 @@ public void setEmissive(int index, int emissive) {
2942
2938
2943
2939
vertices [index ][PGraphics .ER ] = ((emissive >> 16 ) & 0xFF ) / 255.0f ;
2944
2940
vertices [index ][PGraphics .EG ] = ((emissive >> 8 ) & 0xFF ) / 255.0f ;
2945
- vertices [index ][PGraphics .EB ] = (( emissive >> 0 ) & 0xFF ) / 255.0f ;
2941
+ vertices [index ][PGraphics .EB ] = (emissive & 0xFF ) / 255.0f ;
2946
2942
}
2947
2943
2948
2944
@@ -3277,7 +3273,7 @@ public void rotate(float angle, float v0, float v1, float v2) {
3277
3273
* @webref pshape:method
3278
3274
* @usage web_application
3279
3275
* @webBrief Increases and decreases the size of a shape
3280
- * @param s percentate to scale the object
3276
+ * @param s percentage to scale the object
3281
3277
* @see PShape#rotate(float)
3282
3278
* @see PShape#translate(float, float)
3283
3279
* @see PShape#resetMatrix()
@@ -3393,30 +3389,6 @@ protected void checkMatrix(int dimensions) {
3393
3389
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3394
3390
3395
3391
3396
- /**
3397
- * Center the shape based on its bounding box. Can't assume
3398
- * that the bounding box is 0, 0, width, height. Common case will be
3399
- * opening a letter size document in Illustrator, and drawing something
3400
- * in the middle, then reading it in as an svg file.
3401
- * This will also need to flip the y axis (scale(1, -1)) in cases
3402
- * like Adobe Illustrator where the coordinates start at the bottom.
3403
- */
3404
- // public void center() {
3405
- // }
3406
-
3407
-
3408
- /**
3409
- * Set the pivot point for all transformations.
3410
- */
3411
- // public void pivot(float x, float y) {
3412
- // px = x;
3413
- // py = y;
3414
- // }
3415
-
3416
-
3417
- // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3418
-
3419
-
3420
3392
public void colorMode (int mode ) {
3421
3393
colorMode (mode , colorModeX , colorModeY , colorModeZ , colorModeA );
3422
3394
}
0 commit comments