| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,13 +167,6 @@ public interface PConstants { | |||
| 167 | 167 | public final static int DODGE = 1 << 12; | |
| 168 | 168 | public final static int BURN = 1 << 13; | |
| 169 | 169 | ||
| 170 | - // colour component bitmasks | ||
| 171 | - | ||
| 172 | - public static final int ALPHA_MASK = 0xff000000; | ||
| 173 | - public static final int RED_MASK = 0x00ff0000; | ||
| 174 | - public static final int GREEN_MASK = 0x0000ff00; | ||
| 175 | - public static final int BLUE_MASK = 0x000000ff; | ||
| 176 | - | ||
| 177 | 170 | ||
| 178 | 171 | // for messages | |
| 179 | 172 | ||
@@ -262,6 +255,13 @@ public interface PConstants { | |||
| 262 | 255 | static final int CENTER_DIAMETER = 3; | |
| 263 | 256 | ||
| 264 | 257 | ||
| 258 | + // arc drawing modes | ||
| 259 | + | ||
| 260 | + //static final int OPEN = 1; // shared | ||
| 261 | + static final int CHORD = 2; | ||
| 262 | + static final int PIE = 3; | ||
| 263 | + | ||
| 264 | + | ||
| 265 | 265 | // vertically alignment modes for text | |
| 266 | 266 | ||
| 267 | 267 | /** Default vertical alignment for text placement */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1995,6 +1995,12 @@ protected void ellipseImpl(float x, float y, float w, float h) { | |||
| 1995 | 1995 | */ | |
| 1996 | 1996 | public void arc(float a, float b, float c, float d, | |
| 1997 | 1997 | float start, float stop) { | |
| 1998 | + arc(a, b, c, d, start, stop, 0); | ||
| 1999 | + } | ||
| 2000 | + | ||
| 2001 | + | ||
| 2002 | + public void arc(float a, float b, float c, float d, | ||
| 2003 | + float start, float stop, int mode) { | ||
| 1998 | 2004 | float x = a; | |
| 1999 | 2005 | float y = b; | |
| 2000 | 2006 | float w = c; | |
@@ -2015,11 +2021,23 @@ public void arc(float a, float b, float c, float d, | |||
| 2015 | 2021 | y = b - d/2f; | |
| 2016 | 2022 | } | |
| 2017 | 2023 | ||
| 2018 | - // make sure this loop will exit before starting while | ||
| 2019 | - if (Float.isInfinite(start) || Float.isInfinite(stop)) return; | ||
| 2020 | - while (stop < start) stop += TWO_PI; | ||
| 2024 | + // make sure the loop will exit before starting while | ||
| 2025 | + if (!Float.isInfinite(start) && !Float.isInfinite(stop)) { | ||
| 2026 | + // ignore equal and degenerate cases | ||
| 2027 | + if (stop > start) { | ||
| 2028 | + // make sure that we're starting at a useful point | ||
| 2029 | + while (start < 0) { | ||
| 2030 | + start += TWO_PI; | ||
| 2031 | + stop += TWO_PI; | ||
| 2032 | + } | ||
| 2021 | 2033 | ||
| 2022 | - arcImpl(x, y, w, h, start, stop); | ||
| 2034 | + if (stop - start > TWO_PI) { | ||
| 2035 | + start = 0; | ||
| 2036 | + stop = TWO_PI; | ||
| 2037 | + } | ||
| 2038 | + arcImpl(x, y, w, h, start, stop, mode); | ||
| 2039 | + } | ||
| 2040 | + } | ||
| 2023 | 2041 | } | |
| 2024 | 2042 | ||
| 2025 | 2043 | ||
@@ -2030,7 +2048,8 @@ public void arc(float a, float b, float c, float d, | |||
| 2030 | 2048 | * and the user will still collect $200. | |
| 2031 | 2049 | */ | |
| 2032 | 2050 | protected void arcImpl(float x, float y, float w, float h, | |
| 2033 | - float start, float stop) { | ||
| 2051 | + float start, float stop, int mode) { | ||
| 2052 | + showMissingWarning("arc"); | ||
| 2034 | 2053 | } | |
| 2035 | 2054 | ||
| 2036 | 2055 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -99,6 +99,12 @@ public class PImage implements PConstants, Cloneable { | |||
| 99 | 99 | private int[] blurKernel; | |
| 100 | 100 | private int[][] blurMult; | |
| 101 | 101 | ||
| 102 | + // colour component bitmasks (moved from PConstants in 2.0b7) | ||
| 103 | + public static final int ALPHA_MASK = 0xff000000; | ||
| 104 | + public static final int RED_MASK = 0x00ff0000; | ||
| 105 | + public static final int GREEN_MASK = 0x0000ff00; | ||
| 106 | + public static final int BLUE_MASK = 0x000000ff; | ||
| 107 | + | ||
| 102 | 108 | ||
| 103 | 109 | ////////////////////////////////////////////////////////////// | |
| 104 | 110 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,12 +29,20 @@ public class Event { | |||
| 29 | 29 | protected long millis; | |
| 30 | 30 | protected int action; | |
| 31 | 31 | ||
| 32 | - static public final int SHIFT_MASK = 1 << 6; | ||
| 33 | - static public final int CTRL_MASK = 1 << 7; | ||
| 34 | - static public final int META_MASK = 1 << 8; | ||
| 35 | - static public final int ALT_MASK = 1 << 9; | ||
| 32 | + // These correspond to the java.awt.Event modifiers (not to be confused with | ||
| 33 | + // the newer getModifiersEx), though they're not guaranteed to in the future. | ||
| 34 | + static public final int SHIFT = 1 << 0; | ||
| 35 | + static public final int CTRL = 1 << 1; | ||
| 36 | + static public final int META = 1 << 2; | ||
| 37 | + static public final int ALT = 1 << 3; | ||
| 36 | 38 | protected int modifiers; | |
| 37 | 39 | ||
| 40 | + // Types of events. As with all constants in Processing, brevity's preferred. | ||
| 41 | + static public final int KEY = 1; | ||
| 42 | + static public final int MOUSE = 2; | ||
| 43 | + static public final int TOUCH = 3; | ||
| 44 | + protected int flavor; | ||
| 45 | + | ||
| 38 | 46 | ||
| 39 | 47 | public Event(Object nativeObject, long millis, int action, int modifiers) { | |
| 40 | 48 | this.nativeObject = nativeObject; | |
@@ -44,6 +52,18 @@ public Event(Object nativeObject, long millis, int action, int modifiers) { | |||
| 44 | 52 | } | |
| 45 | 53 | ||
| 46 | 54 | ||
| 55 | + public int getFlavor() { | ||
| 56 | + return flavor; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * Get the platform-native event object. This might be the java.awt event | ||
| 62 | + * on the desktop, though if you're using OpenGL on the desktop it'll be a | ||
| 63 | + * NEWT event that JOGL uses. Android events are something else altogether. | ||
| 64 | + * Bottom line, use this only if you know what you're doing, and don't make | ||
| 65 | + * assumptions about the class type. | ||
| 66 | + */ | ||
| 47 | 67 | public Object getNative() { | |
| 48 | 68 | return nativeObject; | |
| 49 | 69 | } | |
@@ -85,21 +105,21 @@ public int getModifiers() { | |||
| 85 | 105 | ||
| 86 | 106 | ||
| 87 | 107 | public boolean isShiftDown() { | |
| 88 | - return (modifiers & SHIFT_MASK) != 0; | ||
| 108 | + return (modifiers & SHIFT) != 0; | ||
| 89 | 109 | } | |
| 90 | 110 | ||
| 91 | 111 | ||
| 92 | 112 | public boolean isControlDown() { | |
| 93 | - return (modifiers & CTRL_MASK) != 0; | ||
| 113 | + return (modifiers & CTRL) != 0; | ||
| 94 | 114 | } | |
| 95 | 115 | ||
| 96 | 116 | ||
| 97 | 117 | public boolean isMetaDown() { | |
| 98 | - return (modifiers & META_MASK) != 0; | ||
| 118 | + return (modifiers & META) != 0; | ||
| 99 | 119 | } | |
| 100 | 120 | ||
| 101 | 121 | ||
| 102 | 122 | public boolean isAltDown() { | |
| 103 | - return (modifiers & ALT_MASK) != 0; | ||
| 123 | + return (modifiers & ALT) != 0; | ||
| 104 | 124 | } | |
| 105 | 125 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,9 +24,9 @@ | |||
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 | public class KeyEvent extends Event { | |
| 27 | - static public final int PRESSED = 1; | ||
| 28 | - static public final int RELEASED = 2; | ||
| 29 | - static public final int TYPED = 3; | ||
| 27 | + static public final int PRESS = 1; | ||
| 28 | + static public final int RELEASE = 2; | ||
| 29 | + static public final int TYPE = 3; | ||
| 30 | 30 | ||
| 31 | 31 | char key; | |
| 32 | 32 | int keyCode; | |
@@ -36,6 +36,7 @@ public KeyEvent(Object nativeObject, | |||
| 36 | 36 | long millis, int action, int modifiers, | |
| 37 | 37 | char key, int keyCode) { | |
| 38 | 38 | super(nativeObject, millis, action, modifiers); | |
| 39 | + this.flavor = KEY; | ||
| 39 | 40 | this.key = key; | |
| 40 | 41 | this.keyCode = keyCode; | |
| 41 | 42 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,13 +26,13 @@ | |||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | 28 | public class MouseEvent extends Event { | |
| 29 | - static public final int PRESSED = 1; | ||
| 30 | - static public final int RELEASED = 2; | ||
| 31 | - static public final int CLICKED = 3; | ||
| 32 | - static public final int DRAGGED = 4; | ||
| 33 | - static public final int MOVED = 5; | ||
| 34 | - static public final int ENTERED = 6; | ||
| 35 | - static public final int EXITED = 7; | ||
| 29 | + static public final int PRESS = 1; | ||
| 30 | + static public final int RELEASE = 2; | ||
| 31 | + static public final int CLICK = 3; | ||
| 32 | + static public final int DRAG = 4; | ||
| 33 | + static public final int MOVE = 5; | ||
| 34 | + static public final int ENTER = 6; | ||
| 35 | + static public final int EXIT = 7; | ||
| 36 | 36 | ||
| 37 | 37 | protected int x, y; | |
| 38 | 38 | protected int button; | |
@@ -50,6 +50,7 @@ public MouseEvent(Object nativeObject, | |||
| 50 | 50 | long millis, int action, int modifiers, | |
| 51 | 51 | int x, int y, int button, int clickCount) { | |
| 52 | 52 | super(nativeObject, millis, action, modifiers); | |
| 53 | + this.flavor = MOUSE; | ||
| 53 | 54 | this.x = x; | |
| 54 | 55 | this.y = y; | |
| 55 | 56 | this.button = button; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,9 +23,24 @@ | |||
| 23 | 23 | package processing.event; | |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | + /* | ||
| 27 | + http://developer.android.com/guide/topics/ui/ui-events.html | ||
| 28 | + http://developer.android.com/reference/android/view/MotionEvent.html | ||
| 29 | + http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/TouchEventClassReference/TouchEvent/TouchEvent.html | ||
| 30 | + http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.html#//apple_ref/occ/cl/UIGestureRecognizer | ||
| 31 | + | ||
| 32 | + Apple's high-level gesture names: | ||
| 33 | + tap | ||
| 34 | + pinch | ||
| 35 | + rotate | ||
| 36 | + swipe | ||
| 37 | + pan | ||
| 38 | + longpress | ||
| 39 | + */ | ||
| 26 | 40 | public class TouchEvent extends Event { | |
| 27 | 41 | ||
| 28 | 42 | public TouchEvent(Object nativeObject, long millis, int action, int modifiers) { | |
| 29 | 43 | super(nativeObject, millis, action, modifiers); | |
| 44 | + this.flavor = TOUCH; | ||
| 30 | 45 | } | |
| 31 | - } | ||
| 46 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,25 @@ X removing default imports for | |||
| 3 | 3 | X android.view.MotionEvent, android.view.KeyEvent,android.graphics.Bitmap | |
| 4 | 4 | X due to conflicts w/ the new p5 event system | |
| 5 | 5 | ||
| 6 | + cleaning/earlier | ||
| 7 | + A Defects in the tessellation of SVG shapes in A3D | ||
| 8 | + A http://code.google.com/p/processing/issues/detail?id=291 | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + _ Finish implementation of OPEN and CHORD drawing modes for arc() | ||
| 12 | + _ http://code.google.com/p/processing/issues/detail?id=1405 | ||
| 13 | + | ||
| 14 | + _ implement blendMode() for Android | ||
| 15 | + _ should be fairly straightforward given Java2D implementation | ||
| 16 | + _ http://code.google.com/p/processing/issues/detail?id=1386 | ||
| 17 | + | ||
| 18 | + _ Update documentation and tools for Android SDK Tools revision 21 | ||
| 19 | + _ http://code.google.com/p/processing/issues/detail?id=1398 | ||
| 20 | + | ||
| 21 | + _ re-implement to use Fragment API | ||
| 22 | + _ and what about daydream or widgets or whatever? | ||
| 23 | + _ http://code.google.com/p/processing/issues/detail?id=1335 | ||
| 24 | + | ||
| 6 | 25 | _ implement Android version of command line tools | |
| 7 | 26 | _ http://code.google.com/p/processing/issues/detail?id=1323 | |
| 8 | 27 | ||
@@ -30,6 +49,7 @@ _ PApplet.match(scrubbed, processing.mode.java.JavaBuild.SIZE_REGEX); | |||
| 30 | 49 | _ test libraries on android | |
| 31 | 50 | ||
| 32 | 51 | _ no ES2 in the emulator, and no error reported in the PDE | |
| 52 | + _ http://code.google.com/p/processing/issues/detail?id=1059 | ||
| 33 | 53 | _ problem is probably that the error comes via E/AndroidRuntime | |
| 34 | 54 | _ java.lang.RuntimeException: Unable to start activity ComponentInfo{processing.test.fisheye/processing.test.fisheye.FishEye}: java.lang.RuntimeException: P3D: OpenGL ES 2.0 is not supported by this device. | |
| 35 | 55 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments