mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 09:39:19 +01:00
recordFrame() added, methods fully working
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -340,7 +340,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* Initializes engine before drawing a new frame.
|
||||
* Called by PApplet, no need to call this.
|
||||
*/
|
||||
public void beginFrame() {
|
||||
public void beginFrame() { // ignore
|
||||
resetMatrix(); // reset model matrix
|
||||
|
||||
// reset vertices
|
||||
@@ -356,7 +356,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* all be quicksorted here (to make alpha work more properly)
|
||||
* and then blit to the screen.
|
||||
*/
|
||||
public void endFrame() {
|
||||
public void endFrame() { // ignore
|
||||
// moving this back here (post-68) because of macosx thread problem
|
||||
mis.newPixels(pixels, cm, 0, width);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
/**
|
||||
* set engine's default values
|
||||
*/
|
||||
public void defaults() {
|
||||
public void defaults() { // ignore
|
||||
colorMode(RGB, TFF);
|
||||
fill(TFF);
|
||||
stroke(0);
|
||||
@@ -2601,12 +2601,12 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* and this implementation represents only a minimal speedup versus
|
||||
* the amount of confusion it creates.
|
||||
*/
|
||||
public void mask(int alpha[]) {
|
||||
public void mask(int alpha[]) { // ignore
|
||||
throw new RuntimeException("mask() cannot be used on PGraphics");
|
||||
}
|
||||
|
||||
|
||||
public void mask(PImage alpha) {
|
||||
public void mask(PImage alpha) { // ignore
|
||||
throw new RuntimeException("mask() cannot be used on PGraphics");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,18 +439,19 @@ public class PImage implements PConstants, Cloneable {
|
||||
/**
|
||||
* Set alpha channel for an image.
|
||||
*/
|
||||
public void alpha(int alpha[]) {
|
||||
alpha(this, alpha);
|
||||
public void mask(int alpha[]) {
|
||||
mask(this, alpha);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set alpha channel for an image.
|
||||
*/
|
||||
static public void alpha(PImage image, int alpha[]) {
|
||||
static public void mask(PImage image, int alpha[]) {
|
||||
// don't execute if mask image is different size
|
||||
if (alpha.length != image.pixels.length) {
|
||||
System.err.println("alpha(): the mask image must be the same size");
|
||||
return;
|
||||
throw new RuntimeException("The PImage used with mask() must be " +
|
||||
"the same size as the applet.");
|
||||
}
|
||||
for (int i = 0; i < image.pixels.length; i++) {
|
||||
image.pixels[i] =
|
||||
@@ -475,12 +476,13 @@ public class PImage implements PConstants, Cloneable {
|
||||
/**
|
||||
* Set alpha channel for an image using another image as the source.
|
||||
*/
|
||||
public void alpha(PImage alpha) {
|
||||
alpha(alpha.pixels);
|
||||
public void mask(PImage alpha) {
|
||||
mask(alpha.pixels);
|
||||
}
|
||||
|
||||
static public void alpha(PImage image, PImage alpha) {
|
||||
alpha(image, alpha.pixels);
|
||||
|
||||
static public void mask(PImage image, PImage alpha) {
|
||||
mask(image, alpha.pixels);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ package processing.core;
|
||||
|
||||
|
||||
|
||||
// this file is auto-generated. no touchy-touchy.
|
||||
// this file is semiautomatically generated. no touchy-touchy.
|
||||
|
||||
public interface PMethods {
|
||||
|
||||
//
|
||||
|
||||
public void beginFrame();
|
||||
|
||||
public void endFrame();
|
||||
|
||||
@@ -67,7 +67,7 @@ while ($line = shift(@contents)) {
|
||||
#if ($line =~ /^\s*public (\w+) [a-zA-z_]+\(.*$/) {
|
||||
if ($got_something == 1) {
|
||||
if ($1 ne 'void') {
|
||||
$returns = 'return';
|
||||
$returns = 'return ';
|
||||
} else {
|
||||
$returns = '';
|
||||
}
|
||||
@@ -91,13 +91,22 @@ while ($line = shift(@contents)) {
|
||||
# print INTF $iline;
|
||||
}
|
||||
}
|
||||
|
||||
#$g_line = '';
|
||||
#$r_line = '';
|
||||
|
||||
$decl =~ /\s(\S+)\(/;
|
||||
$decl_name = $1;
|
||||
if ($got_static == 1) {
|
||||
print OUT " $returns PGraphics.${decl_name}(";
|
||||
#print OUT " ${returns}PGraphics.${decl_name}(";
|
||||
$g_line = " ${returns}PGraphics.${decl_name}(";
|
||||
} else {
|
||||
print OUT " $returns g.${decl_name}(";
|
||||
#if ($returns eq '') {
|
||||
#print OUT " if (recorder != null) recorder.${decl_name}(";
|
||||
$r_line = " if (recorder != null) recorder.${decl_name}(";
|
||||
#}
|
||||
#print OUT " ${returns}g.${decl_name}(";
|
||||
$g_line = " ${returns}g.${decl_name}(";
|
||||
}
|
||||
|
||||
$decl =~ s/\s+/ /g; # smush onto a single line
|
||||
@@ -110,14 +119,24 @@ while ($line = shift(@contents)) {
|
||||
($the_type, $the_arg) = split(' ', $part);
|
||||
$the_arg =~ s/[\[\]]//g;
|
||||
if ($prev != 0) {
|
||||
print OUT ", ";
|
||||
#print OUT ", ";
|
||||
$g_line .= ", ";
|
||||
$r_line .= ", ";
|
||||
}
|
||||
print OUT "${the_arg}";
|
||||
#print OUT "${the_arg}";
|
||||
$g_line .= "${the_arg}";
|
||||
$r_line .= "${the_arg}";
|
||||
$prev = 1;
|
||||
}
|
||||
print OUT ");\n";
|
||||
#print OUT ");\n";
|
||||
$g_line .= ");\n";
|
||||
$r_line .= ");\n";
|
||||
|
||||
print OUT " }\n"; #\n";
|
||||
if (($got_static != 1) && ($returns eq '')) {
|
||||
print OUT $r_line;
|
||||
}
|
||||
print OUT $g_line;
|
||||
print OUT " }\n";
|
||||
}
|
||||
}
|
||||
print OUT "}\n";
|
||||
|
||||
@@ -48,6 +48,8 @@ X alpha(PImage) is now called mask() instead
|
||||
X already have an alpha() function that gets alpha bits
|
||||
X on start, mouseX is 0.. how to avoid?
|
||||
X use firstMouse variable.. figure out naming
|
||||
X get frame recording working
|
||||
X not tested, but at least it's there
|
||||
|
||||
image stuff
|
||||
o could also do PImage2, which would need a getPixels() before messing w/ it
|
||||
@@ -115,7 +117,6 @@ _ lighting totally sucks
|
||||
|
||||
_ make sure applet is stopping in draw mode
|
||||
|
||||
_ get frame recording working
|
||||
_ also have a simple way to hook in triangle leeches to PGraphics3
|
||||
|
||||
_ implement PGraphics2.curveVertex()
|
||||
|
||||
Reference in New Issue
Block a user