mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fixup PImage defaults for subclasses (set to RGB).
This commit is contained in:
+10
-11
@@ -1018,17 +1018,6 @@ public class PApplet extends Applet
|
||||
// ------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Explicitly exit the applet. Inserted as a call for static
|
||||
* mode apps, but is generally necessary because apps no longer
|
||||
* have draw/loop separation.
|
||||
*/
|
||||
public void exit() {
|
||||
stop();
|
||||
// TODO if not running as an applet, do a System.exit() here
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function for an applet/application to kill itself and
|
||||
* display an error. Mostly this is here to be improved later.
|
||||
@@ -1055,6 +1044,16 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Explicitly exit the applet. Inserted as a call for static
|
||||
* mode apps, but is generally necessary because apps no longer
|
||||
* have draw/loop separation.
|
||||
*/
|
||||
public void exit() {
|
||||
stop();
|
||||
// TODO if not running as an applet, do a System.exit() here
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------
|
||||
|
||||
|
||||
+4
-1
@@ -321,7 +321,10 @@ public class PGraphics extends PImage
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for the PGraphics object
|
||||
* Constructor for the PGraphics object. Use this to ensure that
|
||||
* the defaults get set properly. In a subclass, use this(w, h)
|
||||
* as the first line of a subclass' constructor to properly set
|
||||
* the internal fields and defaults.
|
||||
*
|
||||
* @param iwidth viewport width
|
||||
* @param iheight viewport height
|
||||
|
||||
+16
-9
@@ -69,8 +69,11 @@ import java.io.*;
|
||||
*/
|
||||
public class PImage implements PConstants, Cloneable {
|
||||
|
||||
// note that RGB images still require 0xff in the high byte
|
||||
// because of how they'll be manipulated by other functions
|
||||
/**
|
||||
* Format for this image, one of RGB, RGBA or ALPHA.
|
||||
* note that RGB images still require 0xff in the high byte
|
||||
* because of how they'll be manipulated by other functions
|
||||
*/
|
||||
public int format;
|
||||
|
||||
public int pixels[];
|
||||
@@ -81,7 +84,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
int image_mode = CORNER;
|
||||
boolean smooth = false;
|
||||
|
||||
// for gl subclass / hardware accel
|
||||
/** for gl subclass / hardware accel */
|
||||
public int cacheIndex;
|
||||
|
||||
// private fields
|
||||
@@ -97,21 +100,25 @@ public class PImage implements PConstants, Cloneable {
|
||||
static final int PREC_MAXVAL = PRECISIONF-1;
|
||||
static final int PREC_ALPHA_SHIFT = 24-PRECISIONB;
|
||||
static final int PREC_RED_SHIFT = 16-PRECISIONB;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor required by java compiler for subclasses.
|
||||
* Create an empty image object, set its format to RGB.
|
||||
* The pixel array is not allocated.
|
||||
*/
|
||||
public PImage() { }
|
||||
public PImage() {
|
||||
format = RGB; // makes sure that this guy is useful
|
||||
cacheIndex = -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new (transparent) image of a specific size.
|
||||
* Create a new RGB (alpha ignored) image of a specific size.
|
||||
* All pixels are set to zero, meaning black, but since the
|
||||
* alpha is zero, it will be transparent.
|
||||
*/
|
||||
public PImage(int width, int height) {
|
||||
setup(width, height, RGBA);
|
||||
setup(width, height, RGB);
|
||||
//this(new int[width * height], width, height, RGBA);
|
||||
// toxi: is it maybe better to init the image with max alpha enabled?
|
||||
//for(int i=0; i<pixels.length; i++) pixels[i]=0xffffffff;
|
||||
|
||||
+15
-6
@@ -180,13 +180,22 @@ X add redraw() function
|
||||
X call redraw() on the first time through (to force initial draw)
|
||||
X otherwise noLoop() in setup means no drawing happens at all
|
||||
|
||||
_ defaults for PApplet and PGraphics are different
|
||||
_ PGraphics has none.. PApplet has fill/stroke
|
||||
_ set PImage.format as RGB by default?
|
||||
_ this was problem with rendering an image from PGraphics on board
|
||||
_ without setting the font, the values come out weird rotated text
|
||||
_ get rotated text into the screen space stuff
|
||||
040920 evening
|
||||
X defaults for PApplet and PGraphics are different
|
||||
o PGraphics has none.. PApplet has fill/stroke
|
||||
X actually not the case, only that wasn't calling decent superclass
|
||||
X set PImage.format as RGB by default?
|
||||
X this was problem with rendering an image from PGraphics on board
|
||||
|
||||
|
||||
_ need to resolve rotated text in SCREEN_SPACE
|
||||
_ SCREEN_SPACE is weird for text
|
||||
_ does the font or PApplet control the size? (the font, ala java)
|
||||
_ without setting the font, the values come out weird rotated text
|
||||
_ get rotated text into the screen space stuff
|
||||
_ make PApplet2 that handles full screen 1.4 mode drawing
|
||||
|
||||
_ before graphics engine change, attach jogl stuff?
|
||||
_ massive graphics engine changes
|
||||
_ explicitly state depth()/nodepth()
|
||||
_ move to new graphics engine
|
||||
|
||||
Reference in New Issue
Block a user