Skip to content

Commit e3b4dc8

Browse files
authored
Merge branch 'processing:master' into master
2 parents 5ac0339 + 3906449 commit e3b4dc8

File tree

3 files changed

+29
-50
lines changed

3 files changed

+29
-50
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ If you need to go back to Java 8 (i.e. to build Processing 3), you can use:
9090

9191
On Windows and Linux, you can set `JAVA_HOME` to point at the installation the way you would any other environment variable.
9292

93+
On Linux (Ubuntu 20.04 in particular), the headless version of OpenJDK may be installed by default. If so, you may get errors when trying to run tests in core:
94+
95+
java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
96+
97+
If so, use `sudo apt install openjdk-11-jdk` to install a full version. (You could also make use of the version downloaded by Processing itself to avoid duplication, but that's a little trickier to get everything bootstrapped and (sym)linked properly.)
98+
9399
And again, we'll have more complete instructions later once the dust settles.
94100

95101
### Eclipse

core/src/processing/core/PShape.java

Lines changed: 22 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,13 +1854,13 @@ protected void drawPath(PGraphics g) {
18541854
break;
18551855

18561856
case QUADRATIC_VERTEX:
1857-
g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y],
1857+
g.quadraticVertex(vertices[index][X], vertices[index][Y],
18581858
vertices[index+1][X], vertices[index+1][Y]);
18591859
index += 2;
18601860
break;
18611861

18621862
case BEZIER_VERTEX:
1863-
g.bezierVertex(vertices[index+0][X], vertices[index+0][Y],
1863+
g.bezierVertex(vertices[index][X], vertices[index][Y],
18641864
vertices[index+1][X], vertices[index+1][Y],
18651865
vertices[index+2][X], vertices[index+2][Y]);
18661866
index += 3;
@@ -1889,14 +1889,14 @@ protected void drawPath(PGraphics g) {
18891889
break;
18901890

18911891
case QUADRATIC_VERTEX:
1892-
g.quadraticVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
1893-
vertices[index+1][X], vertices[index+1][Y], vertices[index+0][Z]);
1892+
g.quadraticVertex(vertices[index][X], vertices[index][Y], vertices[index][Z],
1893+
vertices[index+1][X], vertices[index+1][Y], vertices[index+1][Z]);
18941894
index += 2;
18951895
break;
18961896

18971897

18981898
case BEZIER_VERTEX:
1899-
g.bezierVertex(vertices[index+0][X], vertices[index+0][Y], vertices[index+0][Z],
1899+
g.bezierVertex(vertices[index][X], vertices[index][Y], vertices[index][Z],
19001900
vertices[index+1][X], vertices[index+1][Y], vertices[index+1][Z],
19011901
vertices[index+2][X], vertices[index+2][Y], vertices[index+2][Z]);
19021902
index += 3;
@@ -1958,14 +1958,14 @@ private void loadBase64Image() {
19581958
* @param imagePath The image path containing the base 64 image data.
19591959
* @return Newly loaded PImage.
19601960
*/
1961-
protected static PImage parseBase64Image(String imagePath) {
1961+
static protected PImage parseBase64Image(String imagePath) {
19621962
String[] parts = imagePath.split(";base64,");
19631963
String extension = parts[0].substring(11);
19641964
String encodedData = parts[1];
19651965

19661966
byte[] decodedBytes = Base64.getDecoder().decode(encodedData);
19671967

1968-
if(decodedBytes == null){
1968+
if (decodedBytes == null) {
19691969
System.err.println("Decode Error on image: " + imagePath.substring(0, 20));
19701970
return null;
19711971
}
@@ -1977,23 +1977,21 @@ protected static PImage parseBase64Image(String imagePath) {
19771977
int space = buffImage.getColorModel().getColorSpace().getType();
19781978
if (space == ColorSpace.TYPE_CMYK) {
19791979
System.err.println("Could not load CMYK color space on image: " + imagePath.substring(0, 20));
1980-
return null;
1980+
return null;
19811981
}
19821982
}
19831983

1984-
// if it's a .gif image, test to see if it has transparency
1985-
boolean requiresCheckAlpha = extension.equals("gif") || extension.equals("png") ||
1986-
extension.equals("unknown");
1987-
19881984
PImage loadedImage = new PImageAWT(awtImage);
19891985

1990-
if (requiresCheckAlpha) {
1991-
loadedImage.checkAlpha();
1986+
// test whether the image has alpha (or we can draw it more quickly in RGB)
1987+
if (extension.equals("gif") || extension.equals("png") ||
1988+
extension.equals("unknown")) {
1989+
loadedImage.checkAlpha();
19921990
}
19931991

1994-
if (loadedImage.width == -1) {
1995-
// error...
1996-
}
1992+
// if (loadedImage.width == -1) {
1993+
// // error...
1994+
// }
19971995

19981996
return loadedImage;
19991997
}
@@ -2535,7 +2533,6 @@ public void setFill(boolean fill) {
25352533
*
25362534
*
25372535
* @webref
2538-
* @param fill
25392536
* @webBrief Set the fill value
25402537
*/
25412538
public void setFill(int fill) {
@@ -2577,7 +2574,7 @@ public void setFill(int index, int fill) {
25772574
vertices[index][PGraphics.A] = ((fill >> 24) & 0xFF) / 255.0f;
25782575
vertices[index][PGraphics.R] = ((fill >> 16) & 0xFF) / 255.0f;
25792576
vertices[index][PGraphics.G] = ((fill >> 8) & 0xFF) / 255.0f;
2580-
vertices[index][PGraphics.B] = ((fill >> 0) & 0xFF) / 255.0f;
2577+
vertices[index][PGraphics.B] = (fill & 0xFF) / 255.0f;
25812578
}
25822579
}
25832580

@@ -2644,7 +2641,7 @@ public void setTint(int index, int tint) {
26442641
vertices[index][PGraphics.A] = ((tint >> 24) & 0xFF) / 255.0f;
26452642
vertices[index][PGraphics.R] = ((tint >> 16) & 0xFF) / 255.0f;
26462643
vertices[index][PGraphics.G] = ((tint >> 8) & 0xFF) / 255.0f;
2647-
vertices[index][PGraphics.B] = ((tint >> 0) & 0xFF) / 255.0f;
2644+
vertices[index][PGraphics.B] = (tint & 0xFF) / 255.0f;
26482645
}
26492646
}
26502647

@@ -2689,7 +2686,6 @@ public void setStroke(boolean stroke) {
26892686
*
26902687
*
26912688
* @webref
2692-
* @param stroke
26932689
* @webBrief Set the stroke value
26942690
*/
26952691
public void setStroke(int stroke) {
@@ -2730,7 +2726,7 @@ public void setStroke(int index, int stroke) {
27302726
vertices[index][PGraphics.SA] = ((stroke >> 24) & 0xFF) / 255.0f;
27312727
vertices[index][PGraphics.SR] = ((stroke >> 16) & 0xFF) / 255.0f;
27322728
vertices[index][PGraphics.SG] = ((stroke >> 8) & 0xFF) / 255.0f;
2733-
vertices[index][PGraphics.SB] = ((stroke >> 0) & 0xFF) / 255.0f;
2729+
vertices[index][PGraphics.SB] = (stroke & 0xFF) / 255.0f;
27342730
}
27352731

27362732

@@ -2846,7 +2842,7 @@ public void setAmbient(int index, int ambient) {
28462842

28472843
vertices[index][PGraphics.AR] = ((ambient >> 16) & 0xFF) / 255.0f;
28482844
vertices[index][PGraphics.AG] = ((ambient >> 8) & 0xFF) / 255.0f;
2849-
vertices[index][PGraphics.AB] = ((ambient >> 0) & 0xFF) / 255.0f;
2845+
vertices[index][PGraphics.AB] = (ambient & 0xFF) / 255.0f;
28502846
}
28512847

28522848

@@ -2894,7 +2890,7 @@ public void setSpecular(int index, int specular) {
28942890

28952891
vertices[index][PGraphics.SPR] = ((specular >> 16) & 0xFF) / 255.0f;
28962892
vertices[index][PGraphics.SPG] = ((specular >> 8) & 0xFF) / 255.0f;
2897-
vertices[index][PGraphics.SPB] = ((specular >> 0) & 0xFF) / 255.0f;
2893+
vertices[index][PGraphics.SPB] = (specular & 0xFF) / 255.0f;
28982894
}
28992895

29002896

@@ -2943,7 +2939,7 @@ public void setEmissive(int index, int emissive) {
29432939

29442940
vertices[index][PGraphics.ER] = ((emissive >> 16) & 0xFF) / 255.0f;
29452941
vertices[index][PGraphics.EG] = ((emissive >> 8) & 0xFF) / 255.0f;
2946-
vertices[index][PGraphics.EB] = ((emissive >> 0) & 0xFF) / 255.0f;
2942+
vertices[index][PGraphics.EB] = (emissive & 0xFF) / 255.0f;
29472943
}
29482944

29492945

@@ -3278,7 +3274,7 @@ public void rotate(float angle, float v0, float v1, float v2) {
32783274
* @webref pshape:method
32793275
* @usage web_application
32803276
* @webBrief Increases and decreases the size of a shape
3281-
* @param s percentate to scale the object
3277+
* @param s percentage to scale the object
32823278
* @see PShape#rotate(float)
32833279
* @see PShape#translate(float, float)
32843280
* @see PShape#resetMatrix()
@@ -3394,30 +3390,6 @@ protected void checkMatrix(int dimensions) {
33943390
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33953391

33963392

3397-
/**
3398-
* Center the shape based on its bounding box. Can't assume
3399-
* that the bounding box is 0, 0, width, height. Common case will be
3400-
* opening a letter size document in Illustrator, and drawing something
3401-
* in the middle, then reading it in as an svg file.
3402-
* This will also need to flip the y axis (scale(1, -1)) in cases
3403-
* like Adobe Illustrator where the coordinates start at the bottom.
3404-
*/
3405-
// public void center() {
3406-
// }
3407-
3408-
3409-
/**
3410-
* Set the pivot point for all transformations.
3411-
*/
3412-
// public void pivot(float x, float y) {
3413-
// px = x;
3414-
// py = y;
3415-
// }
3416-
3417-
3418-
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3419-
3420-
34213393
public void colorMode(int mode) {
34223394
colorMode(mode, colorModeX, colorModeY, colorModeZ, colorModeA);
34233395
}

core/todo.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
1277 (4.0b2)
2+
X fix apparent problem in PShape with QUADRATIC_VERTEX (wrong vertex index)
23

34

45
contribs

0 commit comments

Comments
 (0)