Post: New Text Engine[Like 459+]
03-05-2015, 04:19 PM #1
Stunz
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({});
Replace your TextDrawingArea.Java with:
    
/* Class68_Sub20_Sub1 - Decompiled by JODE
* Visit https://jode.sourceforge.net/
*/
import java.util.Random;
import rs.stream.NamedArchive;
import rs.stream.Stream;
import rs.graphics.Background;
import rs.graphics.DrawingArea;
import rs.graphics.RSFont;
import rs.graphics.Sprite;
import rs.graphics.rsDrawingArea;

public class TextDrawingArea extends DrawingArea {

public int baseCharacterHeight = 0;
public int anInt4142;
public int anInt4144;
public int[] characterDrawYOffsets;
public int[] characterHeights;
public int[] characterDrawXOffsets;
public int[] characterWidths;
public int[] iconWidths;
public byte[] aByteArray4151;
public byte[][] fontPixels;
public int[] characterScreenWidths;
public Sprite[] chatImages;
public static String aRSString_4135;
public static String startTransparency;
public static String startDefaultShadow;
public static String endShadow = "/shad";
public static String endEffect;
public static String aRSString_4143;
public static String endStrikethrough = "/str";
public static String aRSString_4147;
public static String startColor;
public static String lineBreak;
public static String startStrikethrough;
public static String endColor;
public static String startImage;
public static String endUnderline;
public static String defaultStrikethrough;
public static String startShadow;
public static String startEffect;
public static String aRSString_4162;
public static String aRSString_4163;
public static String endTransparency;
public static String aRSString_4165;
public static String startUnderline;
public static String startDefaultUnderline;
public static String aRSString_4169;
public static String[] splitTextStrings;
public static int defaultColor;
public static int textShadowColor;
public static int strikethroughColor;
public static int defaultTransparency;
public static int anInt4175;
public static int underlineColor;
public static int defaultShadow;
public static int anInt4178;
public static int transparency;
public static int textColor;

public TextDrawingArea(boolean TypeFont, String s, NamedArchive archive) {
fontPixels = new byte[256][];
characterWidths = new int[256];
characterHeights = new int[256];
characterDrawXOffsets = new int[256];
characterDrawYOffsets = new int[256];
characterScreenWidths = new int[256];
Stream stream = new Stream(archive.getFile(s + ".dat"));
Stream stream_1 = new Stream(archive.getFile("index.dat"));
stream_1.currentOffset = stream.readShort() + 4;
int k = stream_1.readUnsignedByte();
if (k > 0) {
stream_1.currentOffset += 3 * (k - 1);
}
for (int l = 0; l < 256; l++) {
characterDrawXOffsets[l] = stream_1.readUnsignedByte();
characterDrawYOffsets[l] = stream_1.readUnsignedByte();
int i1 = characterWidths[l] = stream_1.readShort();
int j1 = characterHeights[l] = stream_1.readShort();
int k1 = stream_1.readUnsignedByte();
int l1 = i1 * j1;
fontPixels[l] = new byte[l1];
if (k1 == 0) {
for (int i2 = 0; i2 < l1; i2++) {
fontPixels[l][i2] = stream.readByte();
}

} else if (k1 == 1) {
for (int j2 = 0; j2 < i1; j2++) {
for (int l2 = 0; l2 < j1; l2++) {
fontPixels[l][j2 + l2 * i1] = stream.readByte();
}

}

}
if (j1 > baseCharacterHeight && l < 12Cool Man (aka Tustin) {
baseCharacterHeight = j1;
}
characterDrawXOffsets[l] = 1;
characterScreenWidths[l] = i1 + 2;
int k2 = 0;
for (int i3 = j1 / 7; i3 < j1; i3++) {
k2 += fontPixels[l][i3 * i1];
}

if (k2 <= j1 / 7) {
characterScreenWidths[l]--;
characterDrawXOffsets[l] = 0;
}
k2 = 0;
for (int j3 = j1 / 7; j3 < j1; j3++) {
k2 += fontPixels[l][(i1 - 1) + j3 * i1];
}

if (k2 <= j1 / 7) {
characterScreenWidths[l]--;
}
}

if (TypeFont) {
characterScreenWidths[32] = characterScreenWidths[73];
} else {
characterScreenWidths[32] = characterScreenWidths[105];
}
}

public void drawStringMoveY(String string, int drawX, int drawY, int color,
int shadow, int randomMod, int randomMod2) {
if (string != null) {
setColorAndShadow(color, shadow);
double d = 7.0 - (double) randomMod2 / 8.0;
if (d < 0.0) {
d = 0.0;
}
int[] yOffset = new int[string.length()];
for (int index = 0; index < string.length(); index++) {
yOffset[index] = (int) (Math.sin((double) index / 1.5 + (double) randomMod) * d);
}
drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, null, yOffset);
}
}

public int getCharacterWidth(int i) {
return characterScreenWidths[i & 0xff];
}

public void setDefaultTextEffectValues(int color, int shadow, int trans) {
strikethroughColor = -1;
underlineColor = -1;
textShadowColor = defaultShadow = shadow;
textColor = defaultColor = color;
transparency = defaultTransparency = trans;
anInt4178 = 0;
anInt4175 = 0;
}

public static int method1014(byte[][] is, byte[][] is_27_, int[] is_28_,
int[] is_29_, int[] is_30_, int i,
int i_31_) {
int i_32_ = is_28_[i];
int i_33_ = i_32_ + is_30_[i];
int i_34_ = is_28_[i_31_];
int i_35_ = i_34_ + is_30_[i_31_];
int i_36_ = i_32_;
if (i_34_ > i_32_) {
i_36_ = i_34_;
}
int i_37_ = i_33_;
if (i_35_ < i_33_) {
i_37_ = i_35_;
}
int i_38_ = is_29_[i];
if (is_29_[i_31_] < i_38_) {
i_38_ = is_29_[i_31_];
}
byte[] is_39_ = is_27_[i];
byte[] is_40_ = is[i_31_];
int i_41_ = i_36_ - i_32_;
int i_42_ = i_36_ - i_34_;
for (int i_43_ = i_36_; i_43_ < i_37_; i_43_++) {
int i_44_ = is_39_[i_41_++] + is_40_[i_42_++];
if (i_44_ < i_38_) {
i_38_ = i_44_;
}
}
return -i_38_;
}

public void drawCenteredStringMoveXY(String string, int drawX, int drawY, int color,
int shadow, int randomMod) {
if (string != null) {
setColorAndShadow(color, shadow);
int[] xMods = new int[string.length()];
int[] yMods = new int[string.length()];
for (int index = 0; index < string.length(); index++) {
xMods[index] = (int) (Math.sin((double) index / 5.0 + (double) randomMod / 5.0) * 5.0);
yMods[index] = (int) (Math.sin((double) index / 3.0 + (double) randomMod / 5.0) * 5.0);
}
drawBaseStringMoveXY(string, drawX - getTextWidth(string) / 2, drawY, xMods,
yMods);
}
}

public void drawCenteredStringMoveY(String class100, int drawX, int drawY, int color,
int shadow, int i_54_) {
if (class100 != null) {
setColorAndShadow(color, shadow);
int[] yOffset = new int[class100.length()];
for (int index = 0; index < class100.length(); index++) {
yOffset[index] = (int) (Math.sin((double) index / 2.0 + (double) i_54_ / 5.0) * 5.0);
}
drawBaseStringMoveXY(class100, drawX - getTextWidth(class100) / 2, drawY, null,
yOffset);
}
}

public void unpackChatImages(Sprite[] icons) {
chatImages = icons;
}

public void drawBasicString(String string, int drawX, int drawY) {
drawY -= baseCharacterHeight;
int startIndex = -1;
int i_70_ = -1;
for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) {
int character = string.charAt(currentCharacter);
if (character > 255) {
character = 32;
}
if (character == 60) {
startIndex = currentCharacter;
} else {
if (character == 62 && startIndex != -1) {
String effectString = string.substring(startIndex + 1, currentCharacter);
startIndex = -1;
if (effectString.equals(startEffect)) {
character = 60;
} else if (effectString.equals(endEffect)) {
character = 62;
} else if (effectString.equals(aRSString_4135)) {
character = 160;
} else if (effectString.equals(aRSString_4162)) {
character = 173;
} else if (effectString.equals(aRSString_4165)) {
character = 215;
} else if (effectString.equals(aRSString_4147)) {
character = 128;
} else if (effectString.equals(aRSString_4163)) {
character = 169;
} else if (effectString.equals(aRSString_4169)) {
character = 174;
} else {
if (effectString.startsWith(startImage)) {
try {
int imageId = Integer.valueOf(effectString.substring(4));
Sprite icon = chatImages[imageId];
int iconModY = icon.maxHeight;
if (transparency == 256) {
icon.drawSprite(drawX, (drawY + baseCharacterHeight - iconModY));
} else {
icon.drawTransparentSprite(drawX,
(drawY + baseCharacterHeight - iconModY),
transparency);
}
drawX += icon.maxWidth;
i_70_ = -1;
} catch (Exception exception) {
/* empty */
}
} else {
setTextEffects(effectString);
}
continue;
}
}
if (startIndex == -1) {
int width = characterWidths[character];
int height = characterHeights[character];
if (character != 32) {
if (transparency == 256) {
if (textShadowColor != -1) {
drawCharacter(character,
drawX + characterDrawXOffsets[character] + 1,
drawY + characterDrawYOffsets[character] + 1,
width, height, textShadowColor, true);
}
drawCharacter(character, drawX + characterDrawXOffsets[character],
drawY + characterDrawYOffsets[character], width,
height, textColor, false);
} else {
if (textShadowColor != -1) {
drawTransparentCharacter(character,
drawX + characterDrawXOffsets[character] + 1,
drawY + characterDrawYOffsets[character] + 1,
width, height, textShadowColor, transparency,
true);
}
drawTransparentCharacter(character, drawX + characterDrawXOffsets[character],
drawY + characterDrawYOffsets[character], width,
height, textColor, transparency, false);
}
} else if (anInt4178 > 0) {
anInt4175 += anInt4178;
drawX += anInt4175 >> 8;
anInt4175 &= 0xff;
}
int lineWidth = characterScreenWidths[character];
if (strikethroughColor != -1) {
drawHorizontalLine(drawX,drawY + (int) ((double) baseCharacterHeight * 0.69999999999999996D), lineWidth,strikethroughColor);
}
if (underlineColor != -1) {
drawHorizontalLine(drawX,drawY + baseCharacterHeight, lineWidth,underlineColor);
}
drawX += lineWidth;
i_70_ = character;
}
}
}
}

public void drawRAString(String string, int drawX, int drawY, int color,
int shadow) {
if (string != null) {
setColorAndShadow(color, shadow);
drawBasicString(string, drawX - getTextWidth(string), drawY);
}
}

public void drawBaseStringMoveXY(String string, int drawX, int drawY, int[] xModifier,
int[] yModifier) {
drawY -= baseCharacterHeight;
int startIndex = -1;
int i_96_ = -1;
int modifierOffset = 0;
for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) {
int character = string.charAt(currentCharacter);
if (character == 60) {
startIndex = currentCharacter;
} else {
if (character == 62 && startIndex != -1) {
String effectString = string.substring(startIndex + 1, currentCharacter);
startIndex = -1;
if (effectString.equals(startEffect)) {
character = 60;
} else if (effectString.equals(endEffect)) {
character = 62;
} else if (effectString.equals(aRSString_4135)) {
character = 160;
} else if (effectString.equals(aRSString_4162)) {
character = 173;
} else if (effectString.equals(aRSString_4165)) {
character = 215;
} else if (effectString.equals(aRSString_4147)) {
character = 128;
} else if (effectString.equals(aRSString_4163)) {
character = 169;
} else if (effectString.equals(aRSString_4169)) {
character = 174;
} else {
if (effectString.startsWith(startImage)) {
try {
int xModI;
if (xModifier != null) {
xModI = xModifier[modifierOffset];
} else {
xModI = 0;
}
int yMod;
if (yModifier != null) {
yMod = yModifier[modifierOffset];
} else {
yMod = 0;
}
modifierOffset++;
int iconId = Integer.valueOf(effectString.substring(4));
Sprite class92 = chatImages[iconId];
int iconOffsetY = class92.maxHeight;
if (transparency == 256) {
class92.drawSprite(drawX + xModI,
(drawY + baseCharacterHeight - iconOffsetY + yMod));
} else {
class92.drawTransparentSprite(drawX + xModI,
(drawY + baseCharacterHeight - iconOffsetY + yMod),
transparency);
}
drawX += class92.maxWidth;
i_96_ = -1;
} catch (Exception exception) {
/* empty */
}
} else {
setTextEffects(effectString);
}
continue;
}
}
if (startIndex == -1) {
int width = characterWidths[character];
int height = characterHeights[character];
int xOff;
if (xModifier != null) {
xOff = xModifier[modifierOffset];
} else {
xOff = 0;
}
int yOff;
if (yModifier != null) {
yOff = yModifier[modifierOffset];
} else {
yOff = 0;
}
modifierOffset++;
if (character != 32) {
if (transparency == 256) {
if (textShadowColor != -1) {
drawCharacter(character,
(drawX + characterDrawXOffsets[character] + 1 + xOff),
(drawY + characterDrawYOffsets[character] + 1 + yOff),
width, height, textShadowColor, true);
}
drawCharacter(character,
drawX + characterDrawXOffsets[character] + xOff,
drawY + characterDrawYOffsets[character] + yOff,
width, height, textColor, false);
} else {
if (textShadowColor != -1) {
drawTransparentCharacter(character,
(drawX + characterDrawXOffsets[character] + 1 + xOff),
(drawY + characterDrawYOffsets[character] + 1 + yOff),
width, height, textShadowColor,
transparency, true);
}
drawTransparentCharacter(character,
drawX + characterDrawXOffsets[character] + xOff,
drawY + characterDrawYOffsets[character] + yOff,
width, height, textColor, transparency,
false);
}
} else if (anInt4178 > 0) {
anInt4175 += anInt4178;
drawX += anInt4175 >> 8;
anInt4175 &= 0xff;
}
int i_109_ = characterScreenWidths[character];
if (strikethroughColor != -1) {
rsDrawingArea.drawHorizontalLine(drawX,
drawY + (int) ((double) baseCharacterHeight * 0.7),
i_109_, strikethroughColor);
}
if (underlineColor != -1) {
rsDrawingArea.drawHorizontalLine(drawX, drawY + baseCharacterHeight, i_109_,
underlineColor);
}
drawX += i_109_;
i_96_ = character;
}
}
}
}

public void setTextEffects(String string) {
do {
try {
if (string.startsWith(startColor)) {
textColor = Integer.valueOf(string.substring(4));
} else if (string.equals(endColor)) {
textColor = defaultColor;
} else if (string.startsWith(startTransparency)) {
transparency = Integer.valueOf(string.substring(6));
} else if (string.equals(endTransparency)) {
transparency = defaultTransparency;
} else if (string.startsWith(startStrikethrough)) {
strikethroughColor = Integer.valueOf(string.substring(4));
} else if (string.equals(defaultStrikethrough)) {
strikethroughColor = 8388608;
} else if (string.equals(endStrikethrough)) {
strikethroughColor = -1;
} else if (string.startsWith(startUnderline)) {
underlineColor = Integer.valueOf(string.substring(2));
} else if (string.equals(startDefaultUnderline)) {
underlineColor = 0;
} else if (string.equals(endUnderline)) {
underlineColor = -1;
} else if (string.startsWith(startShadow)) {
textShadowColor = Integer.valueOf(string.substring(5));
} else if (string.equals(startDefaultShadow)) {
textShadowColor = 0;
} else if (string.equals(endShadow)) {
textShadowColor = defaultShadow;
} else {
if (!string.equals(lineBreak)) {
break;
}
setDefaultTextEffectValues(defaultColor, defaultShadow, defaultTransparency);
}
} catch (Exception exception) {
break;
}
break;
} while (false);
}

public void setColorAndShadow(int color, int shadow) {
strikethroughColor = -1;
underlineColor = -1;
textShadowColor = defaultShadow = shadow;
textColor = defaultColor = color;
transparency = defaultTransparency = 256;
anInt4178 = 0;
anInt4175 = 0;
}

public int getTextWidth(String string) {
if (string == null) {
return 0;
}
int startIndex = -1;
int i_126_ = -1;
int finalWidth = 0;
for (int currentCharacter = 0; currentCharacter < string.length(); currentCharacter++) {
int character = string.charAt(currentCharacter);
if (character > 255) {
character = 32;
}
if (character == 60) {
startIndex = currentCharacter;
} else {
if (character == 62 && startIndex != -1) {
String effectString = string.substring(startIndex + 1, currentCharacter);
startIndex = -1;
if (effectString.equals(startEffect)) {
character = 60;
} else if (effectString.equals(endEffect)) {
character = 62;
} else if (effectString.equals(aRSString_4135)) {
character = 160;
} else if (effectString.equals(aRSString_4162)) {
character = 173;
} else if (effectString.equals(aRSString_4165)) {
character = 215;
} else if (effectString.equals(aRSString_4147)) {
character = 128;
} else if (effectString.equals(aRSString_4163)) {
character = 169;
} else if (effectString.equals(aRSString_4169)) {
character = 174;
} else {
if (effectString.startsWith(startImage)) {
try {//<img=
int iconId = Integer.valueOf(effectString.substring(4));
finalWidth += chatImages[iconId].maxWidth;
i_126_ = -1;
} catch (Exception exception) {
/* empty */
}
}
continue;
}
}
if (startIndex == -1) {
finalWidth += characterScreenWidths[character];
i_126_ = character;
}
}
}
return finalWidth;
}

public void drawBasicString(String string, int drawX, int drawY, int color,
int shadow) {
if (string != null) {
setColorAndShadow(color, shadow);
drawBasicString(string, drawX, drawY);
}
}

public void drawCenteredString(String string, int drawX, int drawY, int color,
int shadow) {
if (string != null) {
setColorAndShadow(color, shadow);
drawBasicString(string, drawX - getTextWidth(string) / 2, drawY);
}
}

public static void nullLoader() {
startEffect = null;
endEffect = null;
aRSString_4135 = null;
aRSString_4162 = null;
aRSString_4165 = null;
aRSString_4147 = null;
aRSString_4163 = null;
aRSString_4169 = null;
startImage = null;
lineBreak = null;
startColor = null;
endColor = null;
startTransparency = null;
endTransparency = null;
startUnderline = null;
startDefaultUnderline = null;
endUnderline = null;
startShadow = null;
startDefaultShadow = null;
endShadow = null;
startStrikethrough = null;
defaultStrikethrough = null;
endStrikethrough = null;
aRSString_4143 = null;
splitTextStrings = null;
}

public static void createTransparentCharacterPixels(int[] is, byte[] is_0_, int i, int i_1_,
int i_2_, int i_3_, int i_4_, int i_5_,
int i_6_, int i_7_) {
i = ((i & 0xff00ff) * i_7_ & ~0xff00ff) + ((i & 0xff00) * i_7_ & 0xff0000) >> 8;
i_7_ = 256 - i_7_;
for (int i_8_ = -i_4_; i_8_ < 0; i_8_++) {
for (int i_9_ = -i_3_; i_9_ < 0; i_9_++) {
if (is_0_[i_1_++] != 0) {
int i_10_ = is[i_2_];
is[i_2_++] = ((((i_10_ & 0xff00ff) * i_7_ & ~0xff00ff) + ((i_10_ & 0xff00) * i_7_ & 0xff0000)) >> Cool Man (aka Tustin) + i;
} else {
i_2_++;
}
}
i_2_ += i_5_;
i_1_ += i_6_;
}
}

public void drawTransparentCharacter(int i, int i_11_, int i_12_, int i_13_, int i_14_,
int i_15_, int i_16_, boolean bool) {
int i_17_ = i_11_ + i_12_ * DrawingArea.width;
int i_18_ = DrawingArea.width - i_13_;
int i_19_ = 0;
int i_20_ = 0;
if (i_12_ < DrawingArea.topY) {
int i_21_ = DrawingArea.topY - i_12_;
i_14_ -= i_21_;
i_12_ = DrawingArea.topY;
i_20_ += i_21_ * i_13_;
i_17_ += i_21_ * DrawingArea.width;
}
if (i_12_ + i_14_ > DrawingArea.bottomY) {
i_14_ -= i_12_ + i_14_ - DrawingArea.bottomY;
}
if (i_11_ < DrawingArea.topX) {
int i_22_ = DrawingArea.topX - i_11_;
i_13_ -= i_22_;
i_11_ = DrawingArea.topX;
i_20_ += i_22_;
i_17_ += i_22_;
i_19_ += i_22_;
i_18_ += i_22_;
}
if (i_11_ + i_13_ > DrawingArea.bottomX) {
int i_23_ = i_11_ + i_13_ - DrawingArea.bottomX;
i_13_ -= i_23_;
i_19_ += i_23_;
i_18_ += i_23_;
}
if (i_13_ > 0 && i_14_ > 0) {
createTransparentCharacterPixels(DrawingArea.pixels, fontPixels[i], i_15_,
i_20_, i_17_, i_13_, i_14_, i_18_, i_19_, i_16_);
}
}

public static void createCharacterPixels(int[] is, byte[] is_24_, int i, int i_25_,
int i_26_, int i_27_, int i_28_, int i_29_,
int i_30_) {
int i_31_ = -(i_27_ >> 2);
i_27_ = -(i_27_ & 0x3);
for (int i_32_ = -i_28_; i_32_ < 0; i_32_++) {
for (int i_33_ = i_31_; i_33_ < 0; i_33_++) {
if (is_24_[i_25_++] != 0) {
is[i_26_++] = i;
} else {
i_26_++;
}
if (is_24_[i_25_++] != 0) {
is[i_26_++] = i;
} else {
i_26_++;
}
if (is_24_[i_25_++] != 0) {
is[i_26_++] = i;
} else {
i_26_++;
}
if (is_24_[i_25_++] != 0) {
is[i_26_++] = i;
} else {
i_26_++;
}
}
for (int i_34_ = i_27_; i_34_ < 0; i_34_++) {
if (is_24_[i_25_++] != 0) {
is[i_26_++] = i;
} else {
i_26_++;
}
}
i_26_ += i_29_;
i_25_ += i_30_;
}
}

public void drawCharacter(int character, int i_35_, int i_36_, int i_37_, int i_38_,
int i_39_, boolean bool) {
int i_40_ = i_35_ + i_36_ * DrawingArea.width;
int i_41_ = DrawingArea.width - i_37_;
int i_42_ = 0;
int i_43_ = 0;
if (i_36_ < DrawingArea.topY) {
int i_44_ = DrawingArea.topY - i_36_;
i_38_ -= i_44_;
i_36_ = DrawingArea.topY;
i_43_ += i_44_ * i_37_;
i_40_ += i_44_ * DrawingArea.width;
}
if (i_36_ + i_38_ > DrawingArea.bottomY) {
i_38_ -= i_36_ + i_38_ - DrawingArea.bottomY;
}
if (i_35_ < DrawingArea.topX) {
int i_45_ = DrawingArea.topX - i_35_;
i_37_ -= i_45_;
i_35_ = DrawingArea.topX;
i_43_ += i_45_;
i_40_ += i_45_;
i_42_ += i_45_;
i_41_ += i_45_;
}
if (i_35_ + i_37_ > DrawingArea.bottomX) {
int i_46_ = i_35_ + i_37_ - DrawingArea.bottomX;
i_37_ -= i_46_;
i_42_ += i_46_;
i_41_ += i_46_;
}
if (i_37_ > 0 && i_38_ > 0) {
createCharacterPixels(DrawingArea.pixels, fontPixels[character],
i_39_, i_43_, i_40_, i_37_, i_38_, i_41_, i_42_);

}
}

static {
startTransparency = "trans=";
startStrikethrough = "str=";
startDefaultShadow = "shad";
startColor = "col=";
lineBreak = "br";
defaultStrikethrough = "str";
endUnderline = "/u";
startImage = "img=";
startShadow = "shad=";
startUnderline = "u=";
endColor = "/col";
startDefaultUnderline = "u";
endTransparency = "/trans";

aRSString_4143 = Integer.toString(100);
aRSString_4135 = "nbsp";
aRSString_4169 = "reg";
aRSString_4165 = "times";
aRSString_4162 = "shy";
aRSString_4163 = "copy";
endEffect = "gt";
aRSString_4147 = "euro";
startEffect = "lt";
defaultTransparency = 256;
defaultShadow = -1;
anInt4175 = 0;
textShadowColor = -1;
textColor = 0;
defaultColor = 0;
strikethroughColor = -1;
splitTextStrings = new String[100];
underlineColor = -1;
anInt4178 = 0;
transparency = 256;
}
}

Replace your rsDrawingArea.Java with:
    package rs.graphics;

/* DrawingArea - Decompiled by JODE
* Visit https://jode.sourceforge.net/
*/

public class rsDrawingArea extends DrawingArea{

public static int height;
public static int bottomX;
public static int[] anIntArray1399;
public static int topX;
public static int width;
public static int[] pixels;
public static int topY;
public static int bottomY = 0;
public static int[] anIntArray1405;

public static void drawBox(int drawX, int drawY, int boxWidth, int boxHeight,
int color) {
drawHorizontalLine(drawX, drawY, boxWidth, color);
drawHorizontalLine(drawX, drawY + boxHeight - 1, boxWidth, color);
drawVerticalLine(drawX, drawY, boxHeight, color);
drawVerticalLine(drawX + boxWidth - 1, drawY, boxHeight, color);
}

public static void setDefaultDrawingArea() {
topX = 0;
topY = 0;
bottomX = width;
bottomY = height;
clear();
}

public static void method1417(int drawX, int drawY, int width, int height,
int color) {
width -= drawX;
height -= drawY;
if (height == 0) {
if (width >= 0) {
drawHorizontalLine(drawX, drawY, width + 1, color);
} else {
drawHorizontalLine(drawX + width, drawY, -width + 1, color);
}
} else if (width == 0) {
if (height >= 0) {
drawVerticalLine(drawX, drawY, height + 1, color);
} else {
drawVerticalLine(drawX, drawY + height, -height + 1, color);
}
} else {
if (width + height < 0) {
drawX += width;
width = -width;
drawY += height;
height = -height;
}
if (width > height) {
drawY <<= 16;
drawY += 32768;
height <<= 16;
int i_8_ = (int) Math.floor((double) height / (double) width + 0.5);
width += drawX;
if (drawX < topX) {
drawY += i_8_ * (topX - drawX);
drawX = topX;
}
if (width >= bottomX) {
width = bottomX - 1;
}
for (/**/; drawX <= width; drawX++) {
int i_9_ = drawY >> 16;
if (i_9_ >= topY && i_9_ < bottomY) {
pixels[drawX + i_9_ * width] = color;
}
drawY += i_8_;
}
} else {
drawX <<= 16;
drawX += 32768;
width <<= 16;
int i_10_ = (int) Math.floor((double) width / (double) height + 0.5);
height += drawY;
if (drawY < topY) {
drawX += i_10_ * (topY - drawY);
drawY = topY;
}
if (height >= bottomY) {
height = bottomY - 1;
}
for (/**/; drawY <= height; drawY++) {
int i_11_ = drawX >> 16;
if (i_11_ >= topX && i_11_ < bottomX) {
pixels[i_11_ + drawY * width] = color;
}
drawX += i_10_;
}
}
}
}

public static void clearDrawingArea() {
int i = 0;
int i_12_ = width * height - 7;
while (i < i_12_) {
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
pixels[i++] = 0;
}
i_12_ += 7;
while (i < i_12_) {
pixels[i++] = 0;
}
}

public static void method1419(int drawX, int drawY, int color, int[] is,
int[] is_15_) {
int curPixel = drawX + drawY * width;
for (drawY = 0; drawY < is.length; drawY++) {
int i_17_ = curPixel + is[drawY];
for (drawX = -is_15_[drawY]; drawX < 0; drawX++) {
pixels[i_17_++] = color;
}
curPixel += width;
}
}

public static void nullLoader() {
pixels = null;
anIntArray1399 = null;
anIntArray1405 = null;
}

public static void drawVerticalLineAlpha(int drawX, int drawY, int lineHeightI, int color,
int alpha) {
if (drawX >= topX && drawX < bottomX) {
if (drawY < topY) {
lineHeightI -= topY - drawY;
drawY = topY;
}
if (drawY + lineHeightI > bottomY) {
lineHeightI = bottomY - drawY;
}
int realAlpha = 256 - alpha;
int tempRed = (color >> 16 & 0xff) * alpha;
int tempGreen = (color >> 8 & 0xff) * alpha;
int tempblue = (color & 0xff) * alpha;
int currentPixel = drawX + drawY * width;
for (int count = 0; count < lineHeightI; count++) {
int finalRed = (pixels[currentPixel] >> 16 & 0xff) * realAlpha;
int finalGreen = (pixels[currentPixel] >> 8 & 0xff) * realAlpha;
int finalBlue = (pixels[currentPixel] & 0xff) * realAlpha;
int pixelColor = ((tempRed + finalRed >> 8 << 16) + (tempGreen + finalGreen >> 8 << Cool Man (aka Tustin) + (tempblue + finalBlue >> Cool Man (aka Tustin));
pixels[currentPixel] = pixelColor;
currentPixel += width;
}
}
}

public static void setDrawingArea(int[] is) {
topX = is[0];
topY = is[1];
bottomX = is[2];
bottomY = is[3];
clear();
}

public static void startSetAreaColor(int drawX, int drawY, int color) {
if (drawX >= topX && drawY >= topY && drawX < bottomX && drawY < bottomY) {
pixels[drawX + drawY * width] = color;
}
}

public static void method1424(int[] is, int[] is_34_) {
if (is.length != bottomY - topY || is_34_.length != bottomY - topY) {
throw new IllegalArgumentException();
}
anIntArray1399 = is;
anIntArray1405 = is_34_;
}

public static void method1425(int i, int i_35_, int i_36_, int i_37_) {
if (i_36_ == 0) {
startSetAreaColor(i, i_35_, i_37_);
} else {
if (i_36_ < 0) {
i_36_ = -i_36_;
}
int i_38_ = i_35_ - i_36_;
if (i_38_ < topY) {
i_38_ = topY;
}
int i_39_ = i_35_ + i_36_ + 1;
if (i_39_ > bottomY) {
i_39_ = bottomY;
}
int i_40_ = i_38_;
int i_41_ = i_36_ * i_36_;
int i_42_ = 0;
int i_43_ = i_35_ - i_40_;
int i_44_ = i_43_ * i_43_;
int i_45_ = i_44_ - i_43_;
if (i_35_ > i_39_) {
i_35_ = i_39_;
}
while (i_40_ < i_35_) {
for (/**/; i_45_ <= i_41_ || i_44_ <= i_41_;
i_45_ += i_42_++ + i_42_) {
i_44_ += i_42_ + i_42_;
}
int i_46_ = i - i_42_ + 1;
if (i_46_ < topX) {
i_46_ = topX;
}
int i_47_ = i + i_42_;
if (i_47_ > bottomX) {
i_47_ = bottomX;
}
int i_48_ = i_46_ + i_40_ * width;
for (int i_49_ = i_46_; i_49_ < i_47_; i_49_++) {
pixels[i_48_++] = i_37_;
}
i_40_++;
i_44_ -= i_43_-- + i_43_;
i_45_ -= i_43_ + i_43_;
}
i_42_ = i_36_;
i_43_ = i_40_ - i_35_;
i_45_ = i_43_ * i_43_ + i_41_;
i_44_ = i_45_ - i_42_;
i_45_ -= i_43_;
while (i_40_ < i_39_) {
for (/**/; i_45_ > i_41_ && i_44_ > i_41_;
i_44_ -= i_42_ + i_42_) {
i_45_ -= i_42_-- + i_42_;
}
int i_50_ = i - i_42_;
if (i_50_ < topX) {
i_50_ = topX;
}
int i_51_ = i + i_42_;
if (i_51_ > bottomX - 1) {
i_51_ = bottomX - 1;
}
int i_52_ = i_50_ + i_40_ * width;
for (int i_53_ = i_50_; i_53_ <= i_51_; i_53_++) {
pixels[i_52_++] = i_37_;
}
i_40_++;
i_45_ += i_43_ + i_43_;
i_44_ += i_43_++ + i_43_;
}
}
}

public static void createDrawingArea(int startX, int startY, int areaWidthI, int areaHeight) {
if (topX < startX) {
topX = startX;
}
if (topY < startY) {
topY = startY;
}
if (bottomX > areaWidthI) {
bottomX = areaWidthI;
}
if (bottomY > areaHeight) {
bottomY = areaHeight;
}
clear();
}

public static void setDrawingArea(int startX, int startYI, int areaWidth, int areaHeight) {
if (startX < 0) {
startX = 0;
}
if (startYI < 0) {
startYI = 0;
}
if (areaWidth > width) {
areaWidth = width;
}
if (areaHeight > height) {
areaHeight = height;
}
topX = startX;
topY = startYI;
bottomX = areaWidth;
bottomY = areaHeight;
clear();
}

public static void drawHorizontalLine(int drawX, int drawY, int lineWidth, int i_62_) {
if (drawY >= topY && drawY < bottomY) {
if (drawX < topX) {
lineWidth -= topX - drawX;
drawX = topX;
}
if (drawX + lineWidth > bottomX) {
lineWidth = bottomX - drawX;
}
int i_63_ = drawX + drawY * width;
for (int i_64_ = 0; i_64_ < lineWidth; i_64_++) {
pixels[i_63_ + i_64_] = i_62_;
}
}
}


public static void drawHorizontalLineAlpha(int i, int i_89_, int i_90_, int i_91_,
int i_92_) {
if (i_89_ >= topY && i_89_ < bottomY) {
if (i < topX) {
i_90_ -= topX - i;
i = topX;
}
if (i + i_90_ > bottomX) {
i_90_ = bottomX - i;
}
int i_93_ = 256 - i_92_;
int i_94_ = (i_91_ >> 16 & 0xff) * i_92_;
int i_95_ = (i_91_ >> 8 & 0xff) * i_92_;
int i_96_ = (i_91_ & 0xff) * i_92_;
int i_97_ = i + i_89_ * width;
for (int i_98_ = 0; i_98_ < i_90_; i_98_++) {
int i_99_ = (pixels[i_97_] >> 16 & 0xff) * i_93_;
int i_100_ = (pixels[i_97_] >> 8 & 0xff) * i_93_;
int i_101_ = (pixels[i_97_] & 0xff) * i_93_;
int i_102_ = ((i_94_ + i_99_ >> 8 << 16) + (i_95_ + i_100_ >> 8 << Cool Man (aka Tustin) + (i_96_ + i_101_ >> Cool Man (aka Tustin));
pixels[i_97_++] = i_102_;
}
}
}

public static void drawVerticalLine(int i, int i_103_, int i_104_, int i_105_) {
if (i >= topX && i < bottomX) {
if (i_103_ < topY) {
i_104_ -= topY - i_103_;
i_103_ = topY;
}
if (i_103_ + i_104_ > bottomY) {
i_104_ = bottomY - i_103_;
}
int i_106_ = i + i_103_ * width;
for (int i_107_ = 0; i_107_ < i_104_; i_107_++) {
pixels[i_106_ + i_107_ * width] = i_105_;
}
}
}

public static void initDrawingArea(int[] is, int i, int i_108_) {
pixels = is;
width = i;
height = i_108_;
setDrawingArea(0, 0, i, i_108_);
}

public static void drawBoxAlpha(int drawX, int drawY, int boxWidth, int boxHeight,
int boxColor, int alphaI) {
drawHorizontalLineAlpha(drawX, drawY, boxWidth, boxColor, alphaI);
drawHorizontalLineAlpha(drawX, drawY + boxHeight - 1, boxWidth, boxColor, alphaI);
if (boxHeight >= 3) {
drawVerticalLineAlpha(drawX, drawY + 1, boxHeight - 2, boxColor, alphaI);
drawVerticalLineAlpha(drawX + boxWidth - 1, drawY + 1, boxHeight - 2, boxColor, alphaI);
}
}

public static void method1434(int i, int i_114_, int i_115_, int i_116_,
int i_117_) {
if (i_117_ != 0) {
if (i_117_ == 256) {
method1425(i, i_114_, i_115_, i_116_);
} else {
if (i_115_ < 0) {
i_115_ = -i_115_;
}
int i_118_ = 256 - i_117_;
int i_119_ = (i_116_ >> 16 & 0xff) * i_117_;
int i_120_ = (i_116_ >> 8 & 0xff) * i_117_;
int i_121_ = (i_116_ & 0xff) * i_117_;
int i_122_ = i_114_ - i_115_;
if (i_122_ < topY) {
i_122_ = topY;
}
int i_123_ = i_114_ + i_115_ + 1;
if (i_123_ > bottomY) {
i_123_ = bottomY;
}
int i_124_ = i_122_;
int i_125_ = i_115_ * i_115_;
int i_126_ = 0;
int i_127_ = i_114_ - i_124_;
int i_128_ = i_127_ * i_127_;
int i_129_ = i_128_ - i_127_;
if (i_114_ > i_123_) {
i_114_ = i_123_;
}
while (i_124_ < i_114_) {
for (/**/; i_129_ <= i_125_ || i_128_ <= i_125_;
i_129_ += i_126_++ + i_126_) {
i_128_ += i_126_ + i_126_;
}
int i_130_ = i - i_126_ + 1;
if (i_130_ < topX) {
i_130_ = topX;
}
int i_131_ = i + i_126_;
if (i_131_ > bottomX) {
i_131_ = bottomX;
}
int i_132_ = i_130_ + i_124_ * width;
for (int i_133_ = i_130_; i_133_ < i_131_; i_133_++) {
int i_134_ = (pixels[i_132_] >> 16 & 0xff) * i_118_;
int i_135_ = (pixels[i_132_] >> 8 & 0xff) * i_118_;
int i_136_ = (pixels[i_132_] & 0xff) * i_118_;
int i_137_ = ((i_119_ + i_134_ >> 8 << 16) + (i_120_ + i_135_ >> 8 << Cool Man (aka Tustin) + (i_121_ + i_136_ >> Cool Man (aka Tustin));
pixels[i_132_++] = i_137_;
}
i_124_++;
i_128_ -= i_127_-- + i_127_;
i_129_ -= i_127_ + i_127_;
}
i_126_ = i_115_;
i_127_ = -i_127_;
i_129_ = i_127_ * i_127_ + i_125_;
i_128_ = i_129_ - i_126_;
i_129_ -= i_127_;
while (i_124_ < i_123_) {
for (/**/; i_129_ > i_125_ && i_128_ > i_125_;
i_128_ -= i_126_ + i_126_) {
i_129_ -= i_126_-- + i_126_;
}
int i_138_ = i - i_126_;
if (i_138_ < topX) {
i_138_ = topX;
}
int i_139_ = i + i_126_;
if (i_139_ > bottomX - 1) {
i_139_ = bottomX - 1;
}
int i_140_ = i_138_ + i_124_ * width;
for (int i_141_ = i_138_; i_141_ <= i_139_; i_141_++) {
int i_142_ = (pixels[i_140_] >> 16 & 0xff) * i_118_;
int i_143_ = (pixels[i_140_] >> 8 & 0xff) * i_118_;
int i_144_ = (pixels[i_140_] & 0xff) * i_118_;
int i_145_ = ((i_119_ + i_142_ >> 8 << 16) + (i_120_ + i_143_ >> 8 << Cool Man (aka Tustin) + (i_121_ + i_144_ >> Cool Man (aka Tustin));
pixels[i_140_++] = i_145_;
}
i_124_++;
i_129_ += i_127_ + i_127_;
i_128_ += i_127_++ + i_127_;
}
}
}
}

public static void fillBoxAlpha(int i, int i_146_, int i_147_, int i_148_,
int i_149_, int i_150_) {
if (i < topX) {
i_147_ -= topX - i;
i = topX;
}
if (i_146_ < topY) {
i_148_ -= topY - i_146_;
i_146_ = topY;
}
if (i + i_147_ > bottomX) {
i_147_ = bottomX - i;
}
if (i_146_ + i_148_ > bottomY) {
i_148_ = bottomY - i_146_;
}
i_149_ = (((i_149_ & 0xff00ff) * i_150_ >> 8 & 0xff00ff) + ((i_149_ & 0xff00) * i_150_ >> 8 & 0xff00));
int i_151_ = 256 - i_150_;
int i_152_ = width - i_147_;
int i_153_ = i + i_146_ * width;
for (int i_154_ = 0; i_154_ < i_148_; i_154_++) {
for (int i_155_ = -i_147_; i_155_ < 0; i_155_++) {
int i_156_ = pixels[i_153_];
i_156_ = (((i_156_ & 0xff00ff) * i_151_ >> 8 & 0xff00ff) + ((i_156_ & 0xff00) * i_151_ >> 8 & 0xff00));
pixels[i_153_++] = i_149_ + i_156_;
}
i_153_ += i_152_;
}
}

public static void method1436(int[] is) {
is[0] = topX;
is[1] = topY;
is[2] = bottomX;
is[3] = bottomY;
}

public static void method1437(int drawX, int drawY, int boxWidth, int boxHeight,
int color, int alpha) {
int i_162_ = 0;
int i_163_ = 65536 / boxHeight;
if (drawX < topX) {
boxWidth -= topX - drawX;
drawX = topX;
}
if (drawY < topY) {
i_162_ += (topY - drawY) * i_163_;
boxHeight -= topY - drawY;
drawY = topY;
}
if (drawX + boxWidth > bottomX) {
boxWidth = bottomX - drawX;
}
if (drawY + boxHeight > bottomY) {
boxHeight = bottomY - drawY;
}
int widthOffset = width - boxWidth;
int i_165_ = drawX + drawY * width;
for (int i_166_ = -boxHeight; i_166_ < 0; i_166_++) {
int i_167_ = 65536 - i_162_ >> 8;
int i_168_ = i_162_ >> 8;
int finalColor = (((color & 0xff00ff) * i_167_ + (alpha & 0xff00ff) * i_168_ & ~0xff00ff) + ((color & 0xff00) * i_167_ + (alpha & 0xff00) * i_168_ & 0xff0000)) >>> 8;
for (int i_170_ = -boxWidth; i_170_ < 0; i_170_++) {
pixels[i_165_++] = finalColor;
}
i_165_ += widthOffset;
i_162_ += i_163_;
}
}

public static void clear() {
anIntArray1399 = null;
anIntArray1405 = null;
}

public static void fillBox(int drawX, int drawY, int boxWidth, int boxHeight,
int color) {
if (drawX < topX) {
boxWidth -= topX - drawX;
drawX = topX;
}
if (drawY < topY) {
boxHeight -= topY - drawY;
drawY = topY;
}
if (drawX + boxWidth > bottomX) {
boxWidth = bottomX - drawX;
}
if (drawY + boxHeight > bottomY) {
boxHeight = bottomY - drawY;
}
int widthOffsets = width - boxWidth;
int pixelOffset = drawX + drawY * width;
for (int widthOffset = -boxHeight; widthOffset < 0; widthOffset++) {
for (int heightOffset = -boxWidth; heightOffset < 0; heightOffset++) {
pixels[pixelOffset++] = color;
}
pixelOffset += widthOffsets;
}
}

static {
bottomX = 0;
topX = 0;
topY = 0;
}
}

How to load the fonts and the images, add this in the startup method.
     newSmallFont = new TextDrawingArea(false, "p11_full", titleStreamLoader);
newRegularFont = new TextDrawingArea(false, "p12_full", titleStreamLoader);
newBoldFont = new TextDrawingArea(false, "b12_full", titleStreamLoader);
newFancyFont = new TextDrawingArea(true, "q8_full", titleStreamLoader);
UserInterface.fonts = newFonts;
for (int l4 = 0; l4 < 2; l4++) {
chatImages[l4] = new Sprite(mediaArchive, "mod_icons", l4);
}
newSmallFont.unpackChatImages(chatImages);
newRegularFont.unpackChatImages(chatImages);
newBoldFont.unpackChatImages(chatImages);
newFancyFont.unpackChatImages(chatImages);

Then declare this:
    
public TextDrawingArea newSmallFont;
public TextDrawingArea newRegularFont;
public TextDrawingArea newBoldFont;
public TextDrawingArea newFancyFont;
public Sprite[] chatImages = new Sprite[2];


You must first implement this into you're client and added the ability to use the '<' character.
Here are the features incase you don't want to read that thread.
Underline:
    
<u=######></u>


Strikethrough
    <str=######></str>


Transparency:
    
<trans=######></trans>


Underline:
    
<col=######></col>


Shadow:
    
<shad=######></shad>


Images:
    
<img=#>


The "######" represents the color of the effect.I suggest not using hex colors as it seems to bug the effects and make them not work. Try this color pic tool to get your colors:You must login or register to view this content. . When you get it, use the decimal color instead of the hex color.

To use the default settings for an effect simply use the tag by itself without any settings(ex. <trans>, <shad>, <u>, <str>, <col>Winky Winky.
Example:
You must login or register to view this content.
(adsbygoogle = window.adsbygoogle || []).push({});

The following user thanked Stunz for this useful post:

ResistThePower

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo