mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
get() for image dupe instead of copy().. also hex/binary unhex/unbinary
This commit is contained in:
@@ -3212,6 +3212,75 @@ public class PApplet extends Applet
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// HEX/BINARY CONVERSION
|
||||
|
||||
|
||||
static final public String hex(byte what) {
|
||||
return hex(what, 2);
|
||||
}
|
||||
|
||||
static final public String hex(char what) {
|
||||
return hex(what, 4);
|
||||
}
|
||||
|
||||
static final public String hex(int what) {
|
||||
return hex(what, 8);
|
||||
}
|
||||
|
||||
static final public String hex(int what, int digits) {
|
||||
String stuff = Integer.toHexString(what).toUpperCase();
|
||||
|
||||
int length = stuff.length();
|
||||
if (length > digits) {
|
||||
return stuff.substring(length - digits);
|
||||
|
||||
} else if (length < digits) {
|
||||
return "00000000".substring(8 - (digits-length)) + stuff;
|
||||
}
|
||||
return stuff;
|
||||
}
|
||||
|
||||
static final int unhex(String what) {
|
||||
return Integer.parseInt(what, 16);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
static final public String binary(byte what) {
|
||||
return binary(what, 8);
|
||||
}
|
||||
|
||||
static final public String binary(char what) {
|
||||
return binary(what, 16);
|
||||
}
|
||||
|
||||
static final public String binary(int what) {
|
||||
return binary(what, 32);
|
||||
}
|
||||
|
||||
static final public String binary(int what, int digits) {
|
||||
String stuff = Integer.toBinaryString(what);
|
||||
|
||||
int length = stuff.length();
|
||||
if (length > digits) {
|
||||
return stuff.substring(length - digits);
|
||||
|
||||
} else if (length < digits) {
|
||||
int offset = 8 - (digits-length);
|
||||
return "00000000000000000000000000000000".substring(offset) + stuff;
|
||||
}
|
||||
return stuff;
|
||||
}
|
||||
|
||||
|
||||
static final int unbinary(String what) {
|
||||
return Integer.parseInt(what, 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// COLOR FUNCTIONS
|
||||
@@ -3573,8 +3642,8 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
|
||||
public PImage copy() {
|
||||
return g.copy();
|
||||
public PImage get() {
|
||||
return g.get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -552,9 +552,10 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method to avoid an extra cast.
|
||||
* Convenience method to avoid an extra cast,
|
||||
* and the exception handling.
|
||||
*/
|
||||
public PImage copy() {
|
||||
public PImage get() {
|
||||
try {
|
||||
return (PImage) clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public interface PMethods {
|
||||
public void blend(PImage src, int sx1, int sy1, int sx2, int sy2,
|
||||
int dx1, int dy1, int dx2, int dy2, int mode);
|
||||
|
||||
public PImage copy();
|
||||
public PImage get();
|
||||
|
||||
public void save(String filename);
|
||||
|
||||
|
||||
+19
-11
@@ -117,18 +117,18 @@ X use it to repair saveBytes, saveStrings, etc
|
||||
X put screenshots into their sketch folder
|
||||
o http://processing.org/discourse/yabb/YaBB.cgi?board=Syntax;action=display;num=1046185738;start=0
|
||||
X full casting operations on primitives and arrays of them
|
||||
X text(String text, x, y, width, height) // based on rectMode
|
||||
X textMode() for align left, center, right (no justify.. har!)
|
||||
X hex(), binary(), unhex(), unbinary()
|
||||
|
||||
_ array utiles on Object[] are worthless.. fix it with reflection?
|
||||
_ also, should it be named resize() instead?
|
||||
_ see if reflection will allow expand for all class types
|
||||
|
||||
megabucket
|
||||
_ move to new graphics engine
|
||||
_ test with rgb cube, shut off smoothing
|
||||
_ make sure line artifacts are because of smoothing
|
||||
_ explicitly state depth()/nodepth()
|
||||
_ implement 2x oversampling for anti-aliasing
|
||||
_ processing.net -> PClient, PServer
|
||||
|
||||
_ api for file-based renderers
|
||||
_ need to work this out since it will affect other api changes
|
||||
_ size(0, 0) and then ai.size(10000, 20000)
|
||||
_ saveFrame(PRenderer) or saveFrame("name", PRenderer)
|
||||
_ saveFrame gets called at the beginning of loop()
|
||||
_ or is just a message to save the next frame (problem for anim)
|
||||
_ illustrator export / rendering mode
|
||||
_ also postscript or pdf export?
|
||||
_ version of Illustrator.java that uses core api
|
||||
@@ -142,6 +142,13 @@ _ colorMode(CMYK)
|
||||
_ just does 1-r/1-g/1-b inside
|
||||
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Tools;action=display;num=1082055374;start=0
|
||||
|
||||
_ massive graphics engine changes
|
||||
_ explicitly state depth()/nodepth()
|
||||
_ move to new graphics engine
|
||||
_ test with rgb cube, shut off smoothing
|
||||
_ make sure line artifacts are because of smoothing
|
||||
_ implement 2x oversampling for anti-aliasing
|
||||
|
||||
|
||||
............................................................
|
||||
|
||||
@@ -206,7 +213,6 @@ CORE / PImage
|
||||
1 _ loadImage must be used inside or after setup
|
||||
1 _ either document this and/or provide a better error message
|
||||
1 _ http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1060879468;start=0
|
||||
|
||||
b _ more blend() modes (the five listed on the thread below?)
|
||||
b _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1082056702
|
||||
b _ figure out what the modes should actually be:
|
||||
@@ -351,6 +357,8 @@ CORE / Details
|
||||
1 _ catch security exceptions around applet i/o calls
|
||||
1 _ not just for saving files, but provide better error msgs when
|
||||
1 _ attempting to download from another server
|
||||
1 _ array utilities on Object[] are worthless.. fix it with reflection?
|
||||
1 _ see if reflection will allow expand for all class types
|
||||
|
||||
|
||||
CORE / main()
|
||||
|
||||
Reference in New Issue
Block a user