focus code, and color(gray) / color(gray/alpha)

This commit is contained in:
benfry
2004-07-15 13:40:28 +00:00
parent c6c43c6456
commit 4da92a70d3
4 changed files with 137 additions and 7 deletions

View File

@@ -5887,6 +5887,34 @@ public class PGraphics extends PImage implements PConstants {
// they can write it themselves (not difficult)
public final int color(int gray) {
if ((color_mode == RGB) && (!color_scale)) {
return 0xff000000 | (gray << 16) | (gray << 8) | gray;
}
calc_color(gray);
return calci;
}
public final int color(float gray) {
calc_color(gray);
return calci;
}
public final int color(int gray, int alpha) {
if ((color_mode == RGB) && (!color_scale)) {
return (gray << 24) | (gray << 16) | (gray << 8) | gray;
}
calc_color(gray, alpha);
return calci;
}
public final int color(float gray, float alpha) {
calc_color(gray, alpha);
return calci;
}
public final int color(int x, int y, int z) {
if ((color_mode == RGB) && (!color_scale)) {
return 0xff000000 | (x << 16) | (y << 8) | z;