Skip to content

Commit 85890ad

Browse files
committed
getMatrix(PMatrix2D) in PGraphics2D
1 parent 90b3e52 commit 85890ad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

core/src/processing/opengl/PGraphics2D.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
package processing.opengl;
2626

2727
import processing.core.PGraphics;
28+
import processing.core.PMatrix2D;
2829
import processing.core.PMatrix3D;
2930
import processing.core.PShape;
3031
import processing.core.PShapeSVG;
@@ -547,6 +548,19 @@ public float screenZ(float x, float y, float z) {
547548
return 0;
548549
}
549550

551+
@Override
552+
public PMatrix2D getMatrix(PMatrix2D target) {
553+
if (target == null) {
554+
target = new PMatrix2D();
555+
}
556+
// This set operation is well defined, since modelview is a 2D-only
557+
// transformation matrix in the P2D renderer.
558+
target.set(modelview.m00, modelview.m01, modelview.m03,
559+
modelview.m10, modelview.m11, modelview.m13);
560+
return target;
561+
562+
}
563+
550564
@Override
551565
public PMatrix3D getMatrix(PMatrix3D target) {
552566
showVariationWarning("getMatrix");

0 commit comments

Comments
 (0)