mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
more package mania.. preproc now inserts "public" in front of void setup
This commit is contained in:
@@ -40,12 +40,12 @@ import javax.swing.undo.*;
|
||||
/*
|
||||
need to bring all the prefs into here
|
||||
PdeEditor with its sketch.properties
|
||||
and PdeBase with pde.properties
|
||||
and PdeBase with preferences.txt
|
||||
|
||||
on first run:
|
||||
processing.properties is created in user.home
|
||||
it contains the contents of
|
||||
pde.properties + pde_platform.properties
|
||||
preferences.txt + pde_platform.properties
|
||||
and then begins writing additional sketch.properties stuff
|
||||
|
||||
this class no longer uses the Properties class, since
|
||||
@@ -111,7 +111,7 @@ public class PdePreferences extends JComponent {
|
||||
// important was deleted from the user prefs
|
||||
|
||||
try {
|
||||
load(PdeBase.getStream("pde.properties"));
|
||||
load(PdeBase.getStream("preferences.txt"));
|
||||
|
||||
} catch (Exception e) {
|
||||
PdeBase.showError(null, "Could not read default settings.\n" +
|
||||
@@ -282,7 +282,7 @@ public class PdePreferences extends JComponent {
|
||||
"More preferences can be edited directly\n" +
|
||||
"in the file " + preferencesFile.getAbsolutePath();
|
||||
//"More preferences are in the 'lib' folder inside text files\n" +
|
||||
//"named pde.properties and pde_" +
|
||||
//"named preferences.txt and pde_" +
|
||||
//PdeBase.platforms[PdeBase.platform] + ".properties";
|
||||
|
||||
JTextArea textarea = new JTextArea(blather);
|
||||
@@ -452,7 +452,7 @@ public class PdePreferences extends JComponent {
|
||||
|
||||
if ((PdeBase.platform == PdeBase.MACOSX) ||
|
||||
(PdeBase.platform == PdeBase.MACOS9)) {
|
||||
output = new FileOutputStream("lib/pde.properties");
|
||||
output = new FileOutputStream("lib/preferences.txt");
|
||||
|
||||
} else { // win95/98/ME doesn't set cwd properly
|
||||
URL url = getClass().getResource("buttons.gif");
|
||||
@@ -496,7 +496,7 @@ public class PdePreferences extends JComponent {
|
||||
// save() is deprecated, and didn't properly
|
||||
// throw exceptions when it wasn't working
|
||||
skprops.store(output, "Settings for processing. " +
|
||||
"See lib/pde.properties for defaults.");
|
||||
"See lib/preferences.txt for defaults.");
|
||||
|
||||
// need to close the stream.. didn't do this before
|
||||
skprops.close();
|
||||
@@ -512,7 +512,7 @@ public class PdePreferences extends JComponent {
|
||||
// .................................................................
|
||||
|
||||
|
||||
// all the information from pde.properties
|
||||
// all the information from preferences.txt
|
||||
|
||||
//static public String get(String attribute) {
|
||||
//return get(attribute, null);
|
||||
|
||||
@@ -231,6 +231,7 @@ public class PdePreprocessor {
|
||||
*/
|
||||
void writeHeader(PrintStream out, String imports[],
|
||||
String className) {
|
||||
//out.print("package pootime;");
|
||||
|
||||
// emit emports that are needed for classes from the code folder
|
||||
if (imports != null) {
|
||||
@@ -247,7 +248,7 @@ public class PdePreprocessor {
|
||||
if (jdkVersionStr.equals("1.3")) { jdkVersion = JDK13; };
|
||||
if (jdkVersionStr.equals("1.4")) { jdkVersion = JDK14; };
|
||||
|
||||
for (int i = 0; i < jdkVersion; i++) {
|
||||
for (int i = 0; i <= jdkVersion; i++) {
|
||||
for (int j = 0; j < defaultImports[i].length; j++) {
|
||||
out.print("import " + defaultImports[i][j] + ".*; ");
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
"-Djava.library.path=" + sketch.libraryPath, // might be ""
|
||||
"-cp",
|
||||
sketch.classPath,
|
||||
"PApplet",
|
||||
"processing.core.PApplet",
|
||||
PApplet.EXTERNAL_FLAG + location,
|
||||
sketch.mainClassName
|
||||
};
|
||||
@@ -143,7 +143,6 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
//System.out.println("draw mode");
|
||||
while ((applet.frame != 1) && (!applet.finished)) {
|
||||
try {
|
||||
//System.out.println("waiting to complete drawing");
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) { }
|
||||
}
|
||||
@@ -336,6 +335,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
|
||||
|
||||
public void message(String s) {
|
||||
//System.err.println("M" + s.length() + ":" + s);
|
||||
// this is PApplet sending a message (via System.out.println)
|
||||
// that signals that the applet has been quit.
|
||||
if (s.indexOf(PApplet.EXTERNAL_QUIT) == 0) {
|
||||
|
||||
@@ -1354,11 +1354,15 @@ public class PdeSketch {
|
||||
}
|
||||
|
||||
// add the appropriate bagel to the classpath
|
||||
/*
|
||||
String jdkVersion = PdePreferences.get("compiler.jdk_version");
|
||||
String bagelJar = "lib/export11.jar"; // default
|
||||
if (jdkVersion.equals("1.3") || jdkVersion.equals("1.4")) {
|
||||
bagelJar = "lib/export13.jar";
|
||||
}
|
||||
*/
|
||||
String bagelJar = "lib/core.jar";
|
||||
|
||||
//if (jdkVersionStr.equals("1.3")) { bagelJar = "export13.jar" };
|
||||
//if (jdkVersionStr.equals("1.4")) { bagelJar = "export14.jar" };
|
||||
packClassPathIntoZipFile(bagelJar, zos);
|
||||
|
||||
Regular → Executable
+1
-1
@@ -2,7 +2,7 @@
|
||||
# DO NOT MODIFY THIS FILE, OR DELETE SETTINGS FROM THIS FILE
|
||||
|
||||
# These are the default preferences. They will be copied
|
||||
# to your home folder into a file called .processing,
|
||||
# to your home folder into a file called "Processing Preferences.txt"
|
||||
# where you can make changes for your machine.
|
||||
|
||||
# You'll have problems running Processing if you incorrectly
|
||||
@@ -170,7 +170,8 @@ WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow)
|
||||
"%s\\lib;"
|
||||
"%s\\lib\\build;"
|
||||
"%s\\lib\\pde.jar;"
|
||||
"%s\\lib\\kjc.jar;"
|
||||
"%s\\lib\\core.jar;"
|
||||
"%s\\lib\\mrj.jar;"
|
||||
"%s\\lib\\oro.jar;"
|
||||
"%s\\lib\\antlr.jar;",
|
||||
|
||||
|
||||
Binary file not shown.
@@ -70,6 +70,9 @@ else
|
||||
# no longer needed with megabucket
|
||||
#cp dist/lib/pde_windows.properties work/lib/
|
||||
|
||||
# java application stubs
|
||||
#cp dist/lib/mrj.jar work/lib/
|
||||
|
||||
echo Compiling processing.exe
|
||||
cd launcher
|
||||
make && cp processing.exe ../work/
|
||||
@@ -121,11 +124,12 @@ rm -f processing/core/*.class
|
||||
|
||||
# new regular version
|
||||
#CLASSPATH="..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\lib\\comm.jar;${QT_JAVA_PATH}"
|
||||
CLASSPATH="..\\build\\windows\\work\\java\\lib\\rt.jar
|
||||
CLASSPATH="..\\build\\windows\\work\\java\\lib\\rt.jar"
|
||||
export CLASSPATH
|
||||
|
||||
perl preproc.pl
|
||||
../build/windows/work/jikes -d . +D -target 1.1 *.java
|
||||
zip -r0q ../../build/windows/work/lib/core.jar processing
|
||||
zip -rq ../build/windows/work/lib/core.jar processing
|
||||
|
||||
#perl make.pl JIKES=../build/windows/work/jikes JDK13
|
||||
#cp classes/*.class ../build/windows/work/classes/
|
||||
@@ -150,8 +154,8 @@ zip -r0q ../../build/windows/work/lib/core.jar processing
|
||||
cd ..
|
||||
|
||||
#################### TEMPORARY #####################
|
||||
if false
|
||||
then
|
||||
#if false
|
||||
#then
|
||||
#################### TEMPORARY #####################
|
||||
|
||||
### -- BUILD PREPROC ---------------------------------------------
|
||||
@@ -173,7 +177,7 @@ cd app/preprocessor
|
||||
cd ../..
|
||||
|
||||
#################### TEMPORARY #####################
|
||||
fi
|
||||
#fi
|
||||
#################### TEMPORARY #####################
|
||||
|
||||
|
||||
@@ -181,9 +185,11 @@ fi
|
||||
|
||||
cd app
|
||||
|
||||
CLASSPATH="..\\build\\windows\\work\\classes;..\\build\\windows\\work\\lib\antlr.jar;..\\build\\windows\\work\\lib\\oro.jar;..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\lib\\comm.jar"
|
||||
#CLASSPATH="..\\build\\windows\\work\\lib\\core.jar;..\\build\\windows\\work\\lib\\mrj.jar;..\\build\\windows\\work\\lib\antlr.jar;..\\build\\windows\\work\\lib\\oro.jar;..\\build\\windows\\work\\java\\lib\\rt.jar;..\\build\\windows\\work\\lib\\comm.jar"
|
||||
CLASSPATH="..\\build\\windows\\work\\lib\\core.jar;..\\build\\windows\\work\\lib\\mrj.jar;..\\build\\windows\\work\\lib\antlr.jar;..\\build\\windows\\work\\lib\\oro.jar;..\\build\\windows\\work\\java\\lib\\rt.jar"
|
||||
|
||||
perl ../bagel/buzz.pl "../build/windows/work/jikes +D -classpath \"$CLASSPATH\" -d \"..\\build\\windows\\work/classes\"" -dJDK13 -dJDK14 *.java jeditsyntax/*.java preprocessor/*.java
|
||||
#perl ../bagel/buzz.pl "../build/windows/work/jikes +D -classpath \"$CLASSPATH\" -d \"..\\build\\windows\\work/classes\"" -dJDK13 -dJDK14 *.java jeditsyntax/*.java preprocessor/*.java
|
||||
../build/windows/work/jikes +D -classpath $CLASSPATH -d ..\\build\\windows\\work/classes *.java jeditsyntax/*.java preprocessor/*.java
|
||||
|
||||
cd ../build/windows/work/classes
|
||||
rm -f ../lib/pde.jar
|
||||
|
||||
@@ -30,7 +30,7 @@ fi
|
||||
# includes jaws.jar
|
||||
#CLASSPATH=\"java\\lib\\rt.jar\;java\\lib\\jaws.jar\;lib\;lib\\build\;lib\\pde.jar\;lib\\kjc.jar\;lib\\antlr.jar\;lib\\oro.jar\;lib\\comm.jar\;lib\\RXTXcomm.jar\;${QT_JAVA_PATH}\"
|
||||
|
||||
CLASSPATH=\"java\\lib\\rt.jar\;lib\;lib\\build\;lib\\pde.jar\;lib\\kjc.jar\;lib\\antlr.jar\;lib\\oro.jar\;lib\\comm.jar\;${QT_JAVA_PATH}\"
|
||||
CLASSPATH=\"java\\lib\\rt.jar\;lib\;lib\\build\;lib\\pde.jar\;lib\\core.jar\;lib\\mrj.jar\;lib\\antlr.jar\;lib\\oro.jar\;lib\\comm.jar\;${QT_JAVA_PATH}\"
|
||||
export CLASSPATH
|
||||
|
||||
#cd work && ./java/bin/java -Xint PdeBase
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PApplet extends Applet
|
||||
|
||||
public PGraphics g;
|
||||
|
||||
static final boolean THREAD_DEBUG = true;
|
||||
static final boolean THREAD_DEBUG = false; //true;
|
||||
|
||||
public int pixels[];
|
||||
|
||||
@@ -231,16 +231,16 @@ public class PApplet extends Applet
|
||||
// ------------------------------------------------------------
|
||||
|
||||
|
||||
void setup() {
|
||||
public void setup() {
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
public void draw() {
|
||||
drawMethod = false;
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
public void loop() {
|
||||
loopMethod = false;
|
||||
}
|
||||
|
||||
@@ -2039,8 +2039,13 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
public void toGrayscale() {
|
||||
g.toGrayscale();
|
||||
public void filter(int kind) {
|
||||
g.filter(kind);
|
||||
}
|
||||
|
||||
|
||||
public void filter(int kind, float param) {
|
||||
g.filter(kind, param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -75,6 +75,16 @@ public interface PConstants {
|
||||
static final int GIF = 3;
|
||||
|
||||
|
||||
// filter/convert types
|
||||
|
||||
static final int BLACK_WHITE = 0;
|
||||
static final int GRAYSCALE = 1;
|
||||
static final int BLUR = 2;
|
||||
static final int GAUSSIAN_BLUR = 3;
|
||||
static final int POSTERIZE = 4;
|
||||
static final int FIND_EDGES = 5;
|
||||
|
||||
|
||||
// blend mode keyword definitions
|
||||
|
||||
public final static int REPLACE = 0;
|
||||
@@ -95,9 +105,9 @@ public interface PConstants {
|
||||
|
||||
// for messages
|
||||
|
||||
static final int CHATTER = 0;
|
||||
static final int CHATTER = 0;
|
||||
static final int COMPLAINT = 1;
|
||||
static final int PROBLEM = 2;
|
||||
static final int PROBLEM = 2;
|
||||
|
||||
|
||||
// types of projection matrices
|
||||
|
||||
+100
-136
@@ -154,7 +154,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
public void alpha(int alpha[]) {
|
||||
// don't execute if mask image is different size
|
||||
if (alpha.length != pixels.length) {
|
||||
System.err.println("alpha(): the alpha mask image must be the same size");
|
||||
System.err.println("alpha(): the mask image must be the same size");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
@@ -171,7 +171,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
}
|
||||
*/
|
||||
format=RGBA;
|
||||
format = RGBA;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,24 +195,61 @@ public class PImage implements PConstants, Cloneable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [toxi040115]
|
||||
* Converts RGB image data into grayscale using
|
||||
* weighted RGB components, and keeps alpha channel intact.
|
||||
|
||||
*/
|
||||
public void toGrayscale() {
|
||||
for (int i = 0; i<pixels.length; i++) {
|
||||
int col = pixels[i];
|
||||
// luminance = 0.3*red + 0.59*green + 0.11*blue
|
||||
// 0.3*256 = 77
|
||||
// 0.59*256 = 151
|
||||
// 0.11*256 = 28
|
||||
int lum = (77*(col>>16&0xff) + 151*(col>>8&0xff) + 28*(col&0xff))>>8;
|
||||
pixels[i] = (col & ALPHA_MASK) | lum<<16 | lum<<8 | lum;
|
||||
// FIND_EDGES (no params) .. high pass filter
|
||||
// BLUR (no params)
|
||||
// GAUSSIAN_BLUR (one param)
|
||||
// BLACK_WHITE? (param for midpoint)
|
||||
// GRAYSCALE
|
||||
// POSTERIZE (int num of levels)
|
||||
public void filter(int kind) {
|
||||
switch (kind) {
|
||||
|
||||
case BLACK_WHITE:
|
||||
filter(BLACK_WHITE, 0.5f);
|
||||
break;
|
||||
|
||||
case GRAYSCALE:
|
||||
// Converts RGB image data into grayscale using
|
||||
// weighted RGB components, and keeps alpha channel intact.
|
||||
// [toxi 040115]
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
int col = pixels[i];
|
||||
// luminance = 0.3*red + 0.59*green + 0.11*blue
|
||||
// 0.30 * 256 = 77
|
||||
// 0.59 * 256 = 151
|
||||
// 0.11 * 256 = 28
|
||||
int lum = (77*(col>>16&0xff) + 151*(col>>8&0xff) + 28*(col&0xff))>>8;
|
||||
pixels[i] = (col & ALPHA_MASK) | lum<<16 | lum<<8 | lum;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void filter(int kind, float param) {
|
||||
switch (kind) {
|
||||
|
||||
case BLACK_WHITE: // greater than or equal to the threshold
|
||||
int thresh = (int) (param * 255);
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
int max = Math.max((pixels[i] & RED_MASK) >> 16,
|
||||
Math.max((pixels[i] & GREEN_MASK) >> 8,
|
||||
(pixels[i] & BLUE_MASK)));
|
||||
pixels[i] = (pixels[i] & ALPHA_MASK) |
|
||||
((max < thresh) ? 0x000000 : 0xffffff);
|
||||
}
|
||||
break;
|
||||
|
||||
case GRAYSCALE:
|
||||
filter(GRAYSCALE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -338,34 +375,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public void copy(int sx1, int sy1, int sx2, int sy2,
|
||||
int dx1, int dy1, int dx2, int dy2) {
|
||||
switch (image_mode) {
|
||||
//case CORNERS:
|
||||
//break;
|
||||
case CORNER:
|
||||
sx2 += sx1; sy2 += sy1;
|
||||
dx2 += dx1; dy2 += dy1;
|
||||
break;
|
||||
case CENTER:
|
||||
sx2 /= 2f; sy2 /= 2f;
|
||||
dx2 /= 2f; dy2 /= 2f;
|
||||
break;
|
||||
case CENTER_RADIUS:
|
||||
int hr, vr;
|
||||
hr = sx2; sx2 = sx1 + hr; sx1 -= hr;
|
||||
vr = sy2; sy2 = sy1 + vr; sy1 -= vr;
|
||||
hr = dx2; dx2 = dx1 + hr; dx1 -= hr;
|
||||
vr = dy2; dy2 = dy1 + vr; dy1 -= vr;
|
||||
break;
|
||||
}
|
||||
|
||||
if (intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) {
|
||||
blit_resize(this.get(sx1, sy1, sx2 - sx1, sy2 - sy1),
|
||||
0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, REPLACE);
|
||||
} else {
|
||||
blit_resize(this, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, REPLACE);
|
||||
}
|
||||
copy(this, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
|
||||
}
|
||||
|
||||
|
||||
@@ -374,28 +384,25 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public void copy(PImage src, int sx1, int sy1, int sx2, int sy2,
|
||||
int dx1, int dy1, int dx2, int dy2) {
|
||||
switch (image_mode) {
|
||||
//case CORNERS:
|
||||
//break;
|
||||
case CORNER:
|
||||
if (image_mode == CORNER) { // if CORNERS, do nothing
|
||||
sx2 += sx1; sy2 += sy1;
|
||||
dx2 += dx1; dy2 += dy1;
|
||||
break;
|
||||
case CENTER:
|
||||
|
||||
} else if (image_mode == CENTER) {
|
||||
sx2 /= 2f; sy2 /= 2f;
|
||||
dx2 /= 2f; dy2 /= 2f;
|
||||
break;
|
||||
case CENTER_RADIUS:
|
||||
int hr, vr;
|
||||
hr = sx2; sx2 = sx1 + hr; sx1 -= hr;
|
||||
vr = sy2; sy2 = sy1 + vr; sy1 -= vr;
|
||||
hr = dx2; dx2 = dx1 + hr; dx1 -= hr;
|
||||
vr = dy2; dy2 = dy1 + vr; dy1 -= vr;
|
||||
break;
|
||||
}
|
||||
|
||||
blit_resize(src, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, REPLACE);
|
||||
if ((src == this) &&
|
||||
intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) {
|
||||
// if src is me, and things intersect, make a copy of the data
|
||||
blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1),
|
||||
0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, REPLACE);
|
||||
} else {
|
||||
blit_resize(src, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, REPLACE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -419,39 +426,13 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy things from one area of this image to another area
|
||||
* Blends one area of this image to another area
|
||||
*/
|
||||
public void blend(int sx1, int sy1, int sx2, int sy2,
|
||||
int dx1, int dy1, int dx2, int dy2, int mode) {
|
||||
switch (image_mode) {
|
||||
//case CORNERS:
|
||||
//break;
|
||||
case CORNER:
|
||||
sx2 += sx1; sy2 += sy1;
|
||||
dx2 += dx1; dy2 += dy1;
|
||||
break;
|
||||
case CENTER:
|
||||
sx2 /= 2f; sy2 /= 2f;
|
||||
dx2 /= 2f; dy2 /= 2f;
|
||||
break;
|
||||
case CENTER_RADIUS:
|
||||
int hr, vr;
|
||||
hr = sx2; sx2 = sx1 + hr; sx1 -= hr;
|
||||
vr = sy2; sy2 = sy1 + vr; sy1 -= vr;
|
||||
hr = dx2; dx2 = dx1 + hr; dx1 -= hr;
|
||||
vr = dy2; dy2 = dy1 + vr; dy1 -= vr;
|
||||
break;
|
||||
}
|
||||
|
||||
if (intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) {
|
||||
blit_resize(this.get(sx1, sy1, sx2 - sx1, sy2 - sy1),
|
||||
0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, mode);
|
||||
} else {
|
||||
blit_resize(this, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, mode);
|
||||
}
|
||||
blend(this, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, mode);
|
||||
}
|
||||
|
||||
|
||||
@@ -460,28 +441,24 @@ public class PImage implements PConstants, Cloneable {
|
||||
*/
|
||||
public void blend(PImage src, int sx1, int sy1, int sx2, int sy2,
|
||||
int dx1, int dy1, int dx2, int dy2, int mode) {
|
||||
switch (image_mode) {
|
||||
//case CORNERS:
|
||||
//break;
|
||||
case CORNER:
|
||||
if (image_mode == CORNER) { // if CORNERS, do nothing
|
||||
sx2 += sx1; sy2 += sy1;
|
||||
dx2 += dx1; dy2 += dy1;
|
||||
break;
|
||||
case CENTER:
|
||||
|
||||
} else if (image_mode == CENTER) {
|
||||
sx2 /= 2f; sy2 /= 2f;
|
||||
dx2 /= 2f; dy2 /= 2f;
|
||||
break;
|
||||
case CENTER_RADIUS:
|
||||
int hr, vr;
|
||||
hr = sx2; sx2 = sx1 + hr; sx1 -= hr;
|
||||
vr = sy2; sy2 = sy1 + vr; sy1 -= vr;
|
||||
hr = dx2; dx2 = dx1 + hr; dx1 -= hr;
|
||||
vr = dy2; dy2 = dy1 + vr; dy1 -= vr;
|
||||
break;
|
||||
}
|
||||
|
||||
blit_resize(src, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, mode);
|
||||
if ((src == this) &&
|
||||
intersect(sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2)) {
|
||||
blit_resize(get(sx1, sy1, sx2 - sx1, sy2 - sy1),
|
||||
0, 0, sx2 - sx1 - 1, sy2 - sy1 - 1,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, mode);
|
||||
} else {
|
||||
blit_resize(src, sx1, sy1, sx2, sy2,
|
||||
pixels, width, height, dx1, dy1, dx2, dy2, mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -573,19 +550,20 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// internal blitter/resizer/copier from toxi
|
||||
// uses bilinear filtering if smooth() has been enabled
|
||||
// 'mode' determines the blending mode used in the process
|
||||
|
||||
/**
|
||||
* Internal blitter/resizer/copier from toxi.
|
||||
* Uses bilinear filtering if smooth() has been enabled
|
||||
* 'mode' determines the blending mode used in the process.
|
||||
*/
|
||||
private void blit_resize(PImage img,
|
||||
int srcX1, int srcY1, int srcX2, int srcY2,
|
||||
int[] destPixels, int screenW, int screenH,
|
||||
int destX1, int destY1, int destX2, int destY2,
|
||||
int mode) {
|
||||
if (srcX1<0) srcX1=0;
|
||||
if (srcY1<0) srcY1=0;
|
||||
if (srcX2>=img.width) srcX2=img.width-1;
|
||||
if (srcY2>=img.width) srcY2=img.height-1;
|
||||
if (srcX1 < 0) srcX1 = 0;
|
||||
if (srcY1 < 0) srcY1 = 0;
|
||||
if (srcX2 >= img.width) srcX2 = img.width - 1;
|
||||
if (srcY2 >= img.width) srcY2 = img.height - 1;
|
||||
|
||||
int srcW = srcX2 - srcX1;
|
||||
int srcH = srcY2 - srcY1;
|
||||
@@ -834,10 +812,15 @@ public class PImage implements PConstants, Cloneable {
|
||||
r = ((ul*((cUL&RED_MASK)>>16) + ll*((cLL&RED_MASK)>>16) +
|
||||
ur*((cUR&RED_MASK)>>16) + lr*((cLR&RED_MASK)>>16))
|
||||
<< PREC_RED_SHIFT) & RED_MASK;
|
||||
g = ( (ul*(cUL&GREEN_MASK) + ll*(cLL&GREEN_MASK) +
|
||||
ur*(cUR&GREEN_MASK) + lr*(cLR&GREEN_MASK)) >>> PRECISIONB) & GREEN_MASK;
|
||||
|
||||
g = ((ul*(cUL&GREEN_MASK) + ll*(cLL&GREEN_MASK) +
|
||||
ur*(cUR&GREEN_MASK) + lr*(cLR&GREEN_MASK))
|
||||
>>> PRECISIONB) & GREEN_MASK;
|
||||
|
||||
b = (ul*(cUL&BLUE_MASK) + ll*(cLL&BLUE_MASK) +
|
||||
ur*(cUR&BLUE_MASK) + lr*(cLR&BLUE_MASK)) >>> PRECISIONB;
|
||||
ur*(cUR&BLUE_MASK) + lr*(cLR&BLUE_MASK))
|
||||
>>> PRECISIONB;
|
||||
|
||||
a = ((ul*((cUL&ALPHA_MASK)>>>24) + ll*((cLL&ALPHA_MASK)>>>24) +
|
||||
ur*((cUR&ALPHA_MASK)>>>24) + lr*((cLR&ALPHA_MASK)>>>24))
|
||||
<< PREC_ALPHA_SHIFT) & ALPHA_MASK;
|
||||
@@ -1063,27 +1046,6 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// why is this code here? me confused [fry]
|
||||
public void save(OutputStream output, int type) {
|
||||
try {
|
||||
if (type == TARGA) {
|
||||
write_targa(output, pixels, width, height);
|
||||
|
||||
} else if (type == TIFF) {
|
||||
write_tiff(output, pixels, width, height);
|
||||
|
||||
} else {
|
||||
System.err.println("can't save image as that type");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("error while trying to save image");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public void smooth() {
|
||||
smooth = true;
|
||||
}
|
||||
@@ -1093,9 +1055,11 @@ public class PImage implements PConstants, Cloneable {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mode is one of CORNERS, CORNER, CENTER
|
||||
*/
|
||||
public void imageMode(int mode) {
|
||||
image_mode = mode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -220,18 +220,26 @@ X modify image functions to use imageMode
|
||||
X lots more work on make.sh for both mac and pc
|
||||
X further tweaking of the new class structure
|
||||
X trying to get the build scripts wrapped up/working
|
||||
X remove more (all?) ifdefs from code base
|
||||
|
||||
040708 morning / early afternoon
|
||||
X more work on ifdef removal / build scripts
|
||||
X ask creas about src or dest in image functions
|
||||
X finish imaging api
|
||||
X modify make.sh to build processing.core
|
||||
|
||||
_ casting working properly.. int() maps to toInt()?
|
||||
_ what is performance hit for this thing?
|
||||
_ modify make.sh to build processing.core
|
||||
_ processing.app -> PdeBase, PdeEditor..
|
||||
_ processing.serial -> PSerial, [PUsb]
|
||||
_ processing.video -> PMovie (file), PCamera (capture)
|
||||
_ processing.net -> PClient, PServer
|
||||
_ rewrite video, net, serial libraries to be separate
|
||||
|
||||
_ remove more (all?) ifdefs from code base
|
||||
_ ask creas about src or dest in image functions
|
||||
_ expand/subset for array operations (floats, ints, Strings)
|
||||
_ see if reflection will allow expand for all class types
|
||||
_ append/unappend (no push/pop), shift/unshift,
|
||||
_ slice, splice, reverse, concat, split
|
||||
|
||||
not necessarily before release
|
||||
_ check into open-source paperwork for p5
|
||||
|
||||
Reference in New Issue
Block a user