Skip to content

Commit 8cc0b5f

Browse files
authored
Merge branch 'processing:main' into main-gradle
2 parents b2f2a29 + 1d79b12 commit 8cc0b5f

11 files changed

Lines changed: 419 additions & 38 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,8 @@ jobs:
6767
architecture: ${{ matrix.arch }}
6868
- name: Setup Ant
6969
uses: cedx/setup-ant@v3
70-
- name: Install Certificates for Code Signing
71-
if: ${{ matrix.os_prefix == 'macos' }}
72-
uses: apple-actions/import-codesign-certs@v3
73-
with:
74-
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
75-
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
7670
- name: Build Release
7771
run: ant -noinput -buildfile build/build.xml ${{ matrix.os_prefix }}-dist -Dversion="${{ github.sha }}"
78-
env:
79-
PROCESSING_APP_SIGNING: true
8072
- name: Add artifact
8173
uses: actions/upload-artifact@v4
8274
with:

app/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
<!-- Current version of Ant that works with Processing -->
55
<!-- (Cannot use ant.version as the name of the property
66
because that conflicts with the built-in variable) -->
7-
<property name="ant.version.num" value="1.10.12" />
7+
<property name="ant.version.num" value="1.10.15" />
88
<!-- the .zip file to be downloaded -->
99
<property name="ant.zip" value="apache-ant-${ant.version.num}-bin.zip" />
1010

1111
<!-- TODO implement a fallback URL that points to a location
1212
on download.processing.org so it's available forever. -->
1313
<property name="ant.url"
14-
value="https://archive.apache.org/dist/ant/binaries/${ant.zip}" />
14+
value="https://dlcdn.apache.org//ant/binaries/${ant.zip}" />
1515

1616
<fileset id="ant.files" dir="lib">
1717
<include name="ant.jar" />

build/shared/lib/languages/PDE.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ menu.file.close = Close
2525
menu.file.save = Save
2626
menu.file.save_as = Save As...
2727
menu.file.export_application = Export Application...
28+
menu.file.export_pdez = Export as PDEZ...
2829
menu.file.page_setup = Page Setup
2930
menu.file.print = Print...
3031
menu.file.preferences = Preferences...

core/src/processing/awt/PShapeJava2D.java

Lines changed: 113 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
import java.awt.image.Raster;
3434
import java.awt.image.WritableRaster;
3535

36+
import java.util.Arrays;
37+
import java.awt.Color;
38+
3639
import processing.core.PApplet;
3740
import processing.core.PGraphics;
3841
import processing.core.PShapeSVG;
@@ -96,16 +99,29 @@ public void setColor(String colorText, boolean isFill) {
9699
*/
97100

98101

99-
static class LinearGradientPaint implements Paint {
102+
public static class LinearGradientPaint implements Paint {
100103
float x1, y1, x2, y2;
101104
float[] offset;
102105
int[] color;
106+
Color[] colors;
103107
int count;
104108
float opacity;
109+
AffineTransform xform;
110+
111+
public static enum CycleMethod {
112+
NO_CYCLE,
113+
REFLECT,
114+
REPEAT
115+
}
116+
117+
public static enum ColorSpaceType {
118+
SRGB,
119+
LINEAR_RGB
120+
}
105121

106122
public LinearGradientPaint(float x1, float y1, float x2, float y2,
107123
float[] offset, int[] color, int count,
108-
float opacity) {
124+
float opacity, AffineTransform xform) {
109125
this.x1 = x1;
110126
this.y1 = y1;
111127
this.x2 = x2;
@@ -114,6 +130,13 @@ public LinearGradientPaint(float x1, float y1, float x2, float y2,
114130
this.color = color;
115131
this.count = count;
116132
this.opacity = opacity;
133+
this.xform = xform;
134+
135+
//set an array of type Color
136+
this.colors = new Color[this.color.length];
137+
for (int i = 0; i < this.color.length; i++) {
138+
this.colors[i] = new Color(this.color[i], true);
139+
}
117140
}
118141

119142
public PaintContext createContext(ColorModel cm,
@@ -125,6 +148,35 @@ public PaintContext createContext(ColorModel cm,
125148
(float) t2.getX(), (float) t2.getY());
126149
}
127150

151+
public Point2D getStartPoint() {
152+
return new Point2D.Float(this.x1, this.y1);
153+
}
154+
155+
public Point2D getEndPoint() {
156+
return new Point2D.Float(this.x2, this.y2);
157+
}
158+
159+
/* MultipleGradientPaint methods... */
160+
public AffineTransform getTransform() {
161+
return this.xform;
162+
}
163+
164+
public ColorSpaceType getColorSpace() {
165+
return ColorSpaceType.SRGB;
166+
}
167+
168+
public CycleMethod getCycleMethod() {
169+
return CycleMethod.NO_CYCLE;
170+
}
171+
172+
public Color[] getColors() {
173+
return Arrays.copyOf(this.colors, this.colors.length);
174+
}
175+
176+
public float[] getFractions() {
177+
return Arrays.copyOf(this.offset, this.offset.length);
178+
}
179+
128180
public int getTransparency() {
129181
return TRANSLUCENT; // why not.. rather than checking each color
130182
}
@@ -221,23 +273,43 @@ public Raster getRaster(int x, int y, int w, int h) {
221273
}
222274

223275

224-
static class RadialGradientPaint implements Paint {
276+
public static class RadialGradientPaint implements Paint {
225277
float cx, cy, radius;
226278
float[] offset;
227279
int[] color;
280+
Color[] colors;
228281
int count;
229282
float opacity;
283+
AffineTransform xform;
284+
285+
public static enum CycleMethod {
286+
NO_CYCLE,
287+
REFLECT,
288+
REPEAT
289+
}
290+
291+
public static enum ColorSpaceType {
292+
SRGB,
293+
LINEAR_RGB
294+
}
230295

231296
public RadialGradientPaint(float cx, float cy, float radius,
232297
float[] offset, int[] color, int count,
233-
float opacity) {
298+
float opacity, AffineTransform xform) {
234299
this.cx = cx;
235300
this.cy = cy;
236301
this.radius = radius;
237302
this.offset = offset;
238303
this.color = color;
239304
this.count = count;
240305
this.opacity = opacity;
306+
this.xform = xform;
307+
308+
//set an array of type Color
309+
this.colors = new Color[this.color.length];
310+
for (int i = 0; i < this.color.length; i++) {
311+
this.colors[i] = new Color(this.color[i], true);
312+
}
241313
}
242314

243315
public PaintContext createContext(ColorModel cm,
@@ -246,6 +318,41 @@ public PaintContext createContext(ColorModel cm,
246318
return new RadialGradientContext();
247319
}
248320

321+
public Point2D getCenterPoint() {
322+
return new Point2D.Double(this.cx, this.cy);
323+
}
324+
325+
//TODO: investigate how to change a focus point for 0% x of the gradient
326+
//for now default to center x/y
327+
public Point2D getFocusPoint() {
328+
return new Point2D.Double(this.cx, this.cy);
329+
}
330+
331+
public float getRadius() {
332+
return this.radius;
333+
}
334+
335+
/* MultipleGradientPaint methods... */
336+
public AffineTransform getTransform() {
337+
return this.xform;
338+
}
339+
340+
public ColorSpaceType getColorSpace() {
341+
return ColorSpaceType.SRGB;
342+
}
343+
344+
public CycleMethod getCycleMethod() {
345+
return CycleMethod.NO_CYCLE;
346+
}
347+
348+
public Color[] getColors() {
349+
return Arrays.copyOf(this.colors, this.colors.length);
350+
}
351+
352+
public float[] getFractions() {
353+
return Arrays.copyOf(this.offset, this.offset.length);
354+
}
355+
249356
public int getTransparency() {
250357
return TRANSLUCENT;
251358
}
@@ -305,14 +412,14 @@ protected Paint calcGradientPaint(Gradient gradient) {
305412
LinearGradient grad = (LinearGradient) gradient;
306413
return new LinearGradientPaint(grad.x1, grad.y1, grad.x2, grad.y2,
307414
grad.offset, grad.color, grad.count,
308-
opacity);
415+
opacity, grad.transform);
309416

310417
} else if (gradient instanceof RadialGradient) {
311418
// System.out.println("creating radial gradient");
312419
RadialGradient grad = (RadialGradient) gradient;
313420
return new RadialGradientPaint(grad.cx, grad.cy, grad.r,
314421
grad.offset, grad.color, grad.count,
315-
opacity);
422+
opacity, grad.transform);
316423
}
317424
return null;
318425
}

core/src/processing/awt/PSurfaceAWT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
import java.util.ArrayList;
3434
import java.util.List;
3535

36-
import javax.swing.JFrame;
37-
import javax.swing.SwingUtilities;
36+
import javax.swing.*;
3837

3938
import processing.core.PApplet;
4039
import processing.core.PConstants;
@@ -227,7 +226,7 @@ public void paint(Graphics screen) {
227226
}
228227

229228

230-
synchronized protected void render() {
229+
protected void render() {
231230
if (canvas.isDisplayable() &&
232231
graphics.image != null) {
233232
if (canvas.getBufferStrategy() == null) {
@@ -1021,6 +1020,9 @@ public void componentResized(ComponentEvent e) {
10211020
//sketch.postWindowMoved(x - currentInsets.left, y - currentInsets.top);
10221021
sketch.postWindowMoved(x, y); // presumably user wants drawing area
10231022
}
1023+
}else{
1024+
// Solves #862 - Grey/White bar on right side of sketches
1025+
setFrameSize();
10241026
}
10251027
}
10261028

core/src/processing/core/PApplet.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9663,7 +9663,7 @@ public void frameResized(int w, int h) {
96639663

96649664
// WINDOW METHODS
96659665

9666-
Map<String, Integer> windowEventQueue = new ConcurrentHashMap<>();
9666+
Map<String, WindowEventValuePairs> windowEventQueue = new ConcurrentHashMap<>();
96679667

96689668

96699669
public void windowTitle(String title) {
@@ -9683,8 +9683,7 @@ public void windowResize(int newWidth, int newHeight) {
96839683
* only the notification that the resize has happened.
96849684
*/
96859685
public void postWindowResized(int newWidth, int newHeight) {
9686-
windowEventQueue.put("w", newWidth);
9687-
windowEventQueue.put("h", newHeight);
9686+
windowEventQueue.put("wh", new WindowEventValuePairs(newWidth, newHeight));
96889687
}
96899688

96909689

@@ -9724,8 +9723,7 @@ public void postWindowMoved(int newX, int newY) {
97249723
frameMoved(newX, newY);
97259724
}
97269725

9727-
windowEventQueue.put("x", newX);
9728-
windowEventQueue.put("y", newY);
9726+
windowEventQueue.put("xy", new WindowEventValuePairs(newX, newY));
97299727
}
97309728

97319729

@@ -9734,21 +9732,28 @@ public void windowMoved() { }
97349732

97359733

97369734
private void dequeueWindowEvents() {
9737-
if (windowEventQueue.containsKey("x")) {
9738-
windowX = windowEventQueue.remove("x");
9739-
windowY = windowEventQueue.remove("y");
9735+
if (windowEventQueue.containsKey("xy")) {
9736+
WindowEventValuePairs xy = windowEventQueue.remove("xy");
9737+
windowX = xy.num1;
9738+
windowY = xy.num2;
97409739
windowMoved();
97419740
}
9742-
if (windowEventQueue.containsKey("w")) {
9743-
// these should already match width/height
9744-
//windowResized(windowEventQueue.remove("w"),
9745-
// windowEventQueue.remove("h"));
9746-
windowEventQueue.remove("w");
9747-
windowEventQueue.remove("h");
9741+
if (windowEventQueue.containsKey("wh")) {
9742+
WindowEventValuePairs wh = windowEventQueue.remove("wh");
97489743
windowResized();
97499744
}
97509745
}
97519746

9747+
protected class WindowEventValuePairs {
9748+
9749+
public int num1;
9750+
public int num2;
9751+
9752+
public WindowEventValuePairs(int num1, int num2) {
9753+
this.num1 = num1;
9754+
this.num2 = num2;
9755+
}
9756+
}
97529757

97539758
/**
97549759
* Scale the sketch as if it fits this specific width and height.

core/src/processing/core/PShapeSVG.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,8 @@ void setFillOpacity(String opacityText) {
13971397
}
13981398

13991399

1400-
void setColor(String colorText, boolean isFill) {
1400+
//making this public allows us to set gradient fills on a PShape
1401+
public void setColor(String colorText, boolean isFill) {
14011402
colorText = colorText.trim();
14021403
int opacityMask = fillColor & 0xFF000000;
14031404
boolean visible = true;
@@ -1620,7 +1621,7 @@ static protected float parseFloatOrPercent(String text) {
16201621

16211622

16221623
static public class Gradient extends PShapeSVG {
1623-
AffineTransform transform;
1624+
public AffineTransform transform;
16241625

16251626
public float[] offset;
16261627
public int[] color;

java/libraries/svg/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<property name="core.library.jar" location="../../../core/library/core.jar" />
55

6-
<property name="batik.version" value="1.14" />
6+
<property name="batik.version" value="1.18" />
77
<!-- the .zip file to be downloaded -->
88
<property name="batik.zip" value="batik-bin-${batik.version}.zip" />
99
<!-- the .jar file that we need from the download -->
@@ -13,7 +13,7 @@
1313

1414
<!-- URL for the version of Batik currently supported by this library. -->
1515
<property name="batik.url"
16-
value="https://archive.apache.org/dist/xmlgraphics/batik/binaries/${batik.zip}" />
16+
value="https://dlcdn.apache.org//xmlgraphics/batik/binaries/${batik.zip}" />
1717

1818
<!-- Storing a "local" copy in case the original link goes dead. When updating
1919
releases, please upload the new version to download.processing.org. -->

0 commit comments

Comments
 (0)