From 88efb88a38d32b63ac0131e3831ae5c8d916f969 Mon Sep 17 00:00:00 2001 From: benfry Date: Sat, 15 Oct 2005 18:13:01 +0000 Subject: [PATCH] starting rev 94, fixing some textMode issues, additions to the faq, toxi code for tga leniancy --- app/Base.java | 4 ++-- core/PApplet.java | 7 ++++--- core/PGraphics.java | 28 +++++++++++++++------------- core/PGraphics2.java | 9 +++++---- core/todo.txt | 11 ++++++++--- opengl/PGraphicsGL.java | 5 +++-- todo.txt | 3 +++ 7 files changed, 40 insertions(+), 27 deletions(-) diff --git a/app/Base.java b/app/Base.java index fe94a819e..9d8e63e2a 100644 --- a/app/Base.java +++ b/app/Base.java @@ -50,8 +50,8 @@ import processing.core.*; * files and images, etc) that comes from that. */ public class Base { - static final int VERSION = 93; - static final String VERSION_NAME = "0093 Beta"; + static final int VERSION = 94; + static final String VERSION_NAME = "0094 Beta"; /** * Path of filename opened on the command line, diff --git a/core/PApplet.java b/core/PApplet.java index 6c23863f3..c955e76b4 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -2749,11 +2749,12 @@ public class PApplet extends Applet byte[] buffer = loadBytes(filename); // check if it's a TGA and has 8bits/colour channel - if (buffer[2] == 2 && buffer[17] == 8) { + //if (buffer[2] == 2 && buffer[17] == 8) { + // [toxi20050929] changed format validation + // only number of bits/pixel are checked now... + if (buffer[2] == 2 && (buffer[16] == 24 || buffer[16]==32 )) { // get image dimensions - //int w=(b2i(buffer[13])<<8) + b2i(buffer[12]); int w = ((buffer[13] & 0xff) << 8) + (buffer[12] & 0xff); - //int h=(b2i(buffer[15])<<8) + b2i(buffer[14]); int h = ((buffer[15] & 0xff) << 8) + (buffer[14] & 0xff); // check if image has alpha boolean hasAlpha=(buffer[16] == 32); diff --git a/core/PGraphics.java b/core/PGraphics.java index 69bbf4562..6f0c7bf38 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -1707,7 +1707,8 @@ public class PGraphics extends PImage implements PConstants { throw new RuntimeException("use textFont() before textAscent()"); } - return textFont.ascent() * textSize; + return textFont.ascent() * + ((textMode == SCREEN) ? textFont.size : textSize); } @@ -1718,7 +1719,8 @@ public class PGraphics extends PImage implements PConstants { */ public float textDescent() { if (textFont != null) { - return textFont.descent() * textSize; + return textFont.descent() * + ((textMode == SCREEN) ? textFont.size : textSize); } else { throw new RuntimeException("use textFont() before textDescent()"); @@ -1734,8 +1736,8 @@ public class PGraphics extends PImage implements PConstants { public void textFont(PFont which) { if (which != null) { textFont = which; + textSize(which.size); textFontNative = which.font; - textSize(textFont.size); } else { throw new RuntimeException("a null PFont was passed to textFont()"); @@ -1780,18 +1782,18 @@ public class PGraphics extends PImage implements PConstants { "are available with this renderer."); } - if (textFont != null) { - textMode = mode; + //if (textFont != null) { + textMode = mode; - // reset the font to its natural size - // (helps with width calculations and all that) - if (textMode == SCREEN) { - textSize(textFont.size); - } + // reset the font to its natural size + // (helps with width calculations and all that) + //if (textMode == SCREEN) { + //textSize(textFont.size); + //} - } else { - throw new RuntimeException("use textFont() before textMode()"); - } + //} else { + //throw new RuntimeException("use textFont() before textMode()"); + //} } diff --git a/core/PGraphics2.java b/core/PGraphics2.java index efa039224..cbad810b9 100644 --- a/core/PGraphics2.java +++ b/core/PGraphics2.java @@ -679,10 +679,11 @@ public class PGraphics2 extends PGraphics { * will get recorded properly. */ public void textSize(float size) { - if (textFontNative == null) { - super.textSize(size); - return; - } + // take care of setting the textSize and textLeading vars + //if (textFontNative == null) { + super.textSize(size); + //return; + //} textFontNative = textFontNative.deriveFont(size); g2.setFont(textFontNative); diff --git a/core/todo.txt b/core/todo.txt index f1f52e730..79f5c00e6 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,6 +1,10 @@ 0094 core +X fix bug that was causing font sizes not to be set on opengl +X http://dev.processing.org/bugs/show_bug.cgi?id=174 +X apply fix from toxi to make targa files less picky +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1127999630 -_ update to latest 1.4.2 java vm +_ update to java 1.4.2_09 _ add auto-install of cab file inside applet.html http://java.sun.com/update/1.4.2/jinstall-1_4_2_09-windows-i586.cab for the 1.5 versions: @@ -568,12 +572,13 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=100 _ gl points not working again _ polygon z-order with alpha in opengl _ at least add it to the faq, or this would be a test case w/ the sorting -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Programs;action=display;num=1115222332 +_ http://dev.processing.org/bugs/show_bug.cgi?id=176 _ invocationtargetexception in gl with aioobe: _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115185737 -_ don't let users no java < 1.4 load OPENGL +_ don't let users with java < 1.4 load OPENGL _ noLoop() broken on opengl _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115330568;start=0 +_ http://dev.processing.org/bugs/show_bug.cgi?id=164 _ fix non-bound textures from mangling everything else _ fix enable/disable textures for some objects _ fix endian ordering issues so that things work properly diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index ceaf976c6..cfd6909d5 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -939,8 +939,9 @@ public class PGraphicsGL extends PGraphics3 { */ protected void textCharImpl(char ch, float x, float y) { if ((textMode == SHAPE) && (textFontNative == null)) { - System.err.println("textMode(SHAPE) is disabled because the font " + - "\"" + textFont.name + "\" is not available."); + throw new RuntimeException("textMode(SHAPE) is disabled " + + "because the font \"" + textFont.name + + "\" is not available."); } if ((textMode != SHAPE) || (textFontNative == null)) { super.textCharImpl(ch, x, y); diff --git a/todo.txt b/todo.txt index 65442f79b..4714c870f 100644 --- a/todo.txt +++ b/todo.txt @@ -1,5 +1,7 @@ 0094 pde +_ don't write stdout.txt to the processing folder (write it to build dir?) +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1129066571 _ external apps should inherit memory settings from p5 itself _ too confusing to set the memory in two places @@ -23,6 +25,7 @@ _ explanation of what the areas are _ be sure to look at the reference, especially the extended reference other faq +_ change bugs.html to issues.html _ fastest machine possible _ turn off hyperthreading in the bios _ nice gfx card only helps opengl