From 9de7613ee8ce7facc0dff9c6dde65a6d2dcbed5c Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 5 Nov 2011 15:46:34 +0000 Subject: [PATCH] fix for rounded rect max radii (issue #813) --- android/core/src/processing/core/PGraphics.java | 6 ++++++ core/src/processing/core/PGraphics.java | 6 ++++++ core/todo.txt | 3 +++ 3 files changed, 15 insertions(+) diff --git a/android/core/src/processing/core/PGraphics.java b/android/core/src/processing/core/PGraphics.java index 2a7faffc0..e034b4643 100644 --- a/android/core/src/processing/core/PGraphics.java +++ b/android/core/src/processing/core/PGraphics.java @@ -1574,6 +1574,12 @@ public class PGraphics extends PImage implements PConstants { float temp = b; b = d; d = temp; } + float maxRounding = PApplet.min((c - a) / 2, (d - b) / 2); + if (tl > maxRounding) tl = maxRounding; + if (tr > maxRounding) tr = maxRounding; + if (br > maxRounding) br = maxRounding; + if (bl > maxRounding) bl = maxRounding; + rectImpl(a, b, c, d, tl, tr, br, bl); } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index d6be0a01c..ae267cd34 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -1993,6 +1993,12 @@ public class PGraphics extends PImage implements PConstants { float temp = b; b = d; d = temp; } + float maxRounding = PApplet.min((c - a) / 2, (d - b) / 2); + if (tl > maxRounding) tl = maxRounding; + if (tr > maxRounding) tr = maxRounding; + if (br > maxRounding) br = maxRounding; + if (bl > maxRounding) bl = maxRounding; + rectImpl(a, b, c, d, tl, tr, br, bl); } diff --git a/core/todo.txt b/core/todo.txt index 9c0237fc4..6f3e8a4ec 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,7 @@ 0202 core +X Rounded rect() does not have a maximum length for corner radius +X http://code.google.com/p/processing/issues/detail?id=813 + _ video problem with P3D