/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2004-11 Ben Fry and Casey Reas
Copyright (c) 2001-04 Massachusetts Institute of Technology
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package processing.core;
import java.awt.Cursor;
import java.awt.event.KeyEvent;
/**
* Numbers shared throughout processing.core.
*
* An attempt is made to keep the constants as short/non-verbose
* as possible. For instance, the constant is TIFF instead of
* FILE_TYPE_TIFF. We'll do this as long as we can get away with it.
*
* @usage Web & Application
*/
public interface PConstants {
static public final int X = 0;
static public final int Y = 1;
static public final int Z = 2;
// renderers known to processing.core
/*
// List of renderers used inside PdePreprocessor
static final StringList rendererList = new StringList(new String[] {
"JAVA2D", "JAVA2D_2X",
"P2D", "P2D_2X", "P3D", "P3D_2X", "OPENGL",
"E2D", "FX2D", "FX2D_2X", // experimental
"LWJGL.P2D", "LWJGL.P3D", // hmm
"PDF" // no DXF because that's only for beginRaw()
});
*/
static final String JAVA2D = "processing.awt.PGraphicsJava2D";
static final String P2D = "processing.opengl.PGraphics2D";
static final String P3D = "processing.opengl.PGraphics3D";
// When will it be time to remove this?
@Deprecated
static final String OPENGL = P3D;
// Experimental, higher-performance Java 2D renderer (but no pixel ops)
// static final String E2D = PGraphicsDanger2D.class.getName();
// Experimental JavaFX renderer; even better 2D performance
static final String FX2D = "processing.javafx.PGraphicsFX2D";
static final String PDF = "processing.pdf.PGraphicsPDF";
static final String SVG = "processing.svg.PGraphicsSVG";
static final String DXF = "processing.dxf.RawDXF";
// platform IDs for PApplet.platform
static final int OTHER = 0;
static final int WINDOWS = 1;
static final int MACOSX = 2;
static final int LINUX = 3;
static final String[] platformNames = {
"other", "windows", "macosx", "linux"
};
static final float EPSILON = 0.0001f;
// max/min values for numbers
/**
* Same as Float.MAX_VALUE, but included for parity with MIN_VALUE,
* and to avoid teaching static methods on the first day.
*/
static final float MAX_FLOAT = Float.MAX_VALUE;
/**
* Note that Float.MIN_VALUE is the smallest positive value
* for a floating point number, not actually the minimum (negative) value
* for a float. This constant equals 0xFF7FFFFF, the smallest (farthest
* negative) value a float can have before it hits NaN.
*/
static final float MIN_FLOAT = -Float.MAX_VALUE;
/** Largest possible (positive) integer value */
static final int MAX_INT = Integer.MAX_VALUE;
/** Smallest possible (negative) integer value */
static final int MIN_INT = Integer.MIN_VALUE;
// shapes
static public final int VERTEX = 0;
static public final int BEZIER_VERTEX = 1;
static public final int QUADRATIC_VERTEX = 2;
static public final int CURVE_VERTEX = 3;
static public final int BREAK = 4;
@Deprecated
static public final int QUAD_BEZIER_VERTEX = 2; // should not have been exposed
// useful goodness
/**
* ( begin auto-generated from PI.xml )
*
* PI is a mathematical constant with the value 3.14159265358979323846. It
* is the ratio of the circumference of a circle to its diameter. It is
* useful in combination with the trigonometric functions sin() and
* cos().
*
* ( end auto-generated )
* @webref constants
* @see PConstants#TWO_PI
* @see PConstants#TAU
* @see PConstants#HALF_PI
* @see PConstants#QUARTER_PI
*
*/
static final float PI = (float) Math.PI;
/**
* ( begin auto-generated from HALF_PI.xml )
*
* HALF_PI is a mathematical constant with the value
* 1.57079632679489661923. It is half the ratio of the circumference of a
* circle to its diameter. It is useful in combination with the
* trigonometric functions sin() and cos().
*
* ( end auto-generated )
* @webref constants
* @see PConstants#PI
* @see PConstants#TWO_PI
* @see PConstants#TAU
* @see PConstants#QUARTER_PI
*/
static final float HALF_PI = (float) (Math.PI / 2.0);
static final float THIRD_PI = (float) (Math.PI / 3.0);
/**
* ( begin auto-generated from QUARTER_PI.xml )
*
* QUARTER_PI is a mathematical constant with the value 0.7853982. It is
* one quarter the ratio of the circumference of a circle to its diameter.
* It is useful in combination with the trigonometric functions
* sin() and cos().
*
* ( end auto-generated )
* @webref constants
* @see PConstants#PI
* @see PConstants#TWO_PI
* @see PConstants#TAU
* @see PConstants#HALF_PI
*/
static final float QUARTER_PI = (float) (Math.PI / 4.0);
/**
* ( begin auto-generated from TWO_PI.xml )
*
* TWO_PI is a mathematical constant with the value 6.28318530717958647693.
* It is twice the ratio of the circumference of a circle to its diameter.
* It is useful in combination with the trigonometric functions
* sin() and cos().
*
* ( end auto-generated )
* @webref constants
* @see PConstants#PI
* @see PConstants#TAU
* @see PConstants#HALF_PI
* @see PConstants#QUARTER_PI
*/
static final float TWO_PI = (float) (2.0 * Math.PI);
/**
* ( begin auto-generated from TAU.xml )
*
* TAU is an alias for TWO_PI, a mathematical constant with the value
* 6.28318530717958647693. It is twice the ratio of the circumference
* of a circle to its diameter. It is useful in combination with the
* trigonometric functions sin() and cos().
*
* ( end auto-generated )
* @webref constants
* @see PConstants#PI
* @see PConstants#TWO_PI
* @see PConstants#HALF_PI
* @see PConstants#QUARTER_PI
*/
static final float TAU = (float) (2.0 * Math.PI);
static final float DEG_TO_RAD = PI/180.0f;
static final float RAD_TO_DEG = 180.0f/PI;
// angle modes
//static final int RADIANS = 0;
//static final int DEGREES = 1;
// used by split, all the standard whitespace chars
// (also includes unicode nbsp, that little bostage)
static final String WHITESPACE = " \t\n\r\f\u00A0";
// for colors and/or images
static final int RGB = 1; // image & color
static final int ARGB = 2; // image
static final int HSB = 3; // color
static final int ALPHA = 4; // image
// static final int CMYK = 5; // image & color (someday)
// image file types
static final int TIFF = 0;
static final int TARGA = 1;
static final int JPEG = 2;
static final int GIF = 3;
// filter/convert types
static final int BLUR = 11;
static final int GRAY = 12;
static final int INVERT = 13;
static final int OPAQUE = 14;
static final int POSTERIZE = 15;
static final int THRESHOLD = 16;
static final int ERODE = 17;
static final int DILATE = 18;
// blend mode keyword definitions
// @see processing.core.PImage#blendColor(int,int,int)
public final static int REPLACE = 0;
public final static int BLEND = 1