Java 类org.bukkit.map.MapFont 实例源码

项目:ChatMenuAPI    文件:ChatMenuAPI.java   
/**
 * @param c the character to get the width of
 * @return the width of the provided character in pixels
 */
public static int getCharacterWidth(char c)
{
    if(c >= '\u2588' && c <= '\u258F')
    {
        return ('\u258F' - c) + 2;
    }

    switch(c)
    {
        case ' ':
            return 4;
        case '\u2714':
            return 8;
        case '\u2718':
            return 7;
        default:
            MapFont.CharacterSprite mcChar = MinecraftFont.Font.getChar(c);
            if(mcChar != null)
                return mcChar.getWidth() + 1;
            return 0;
    }
}
项目:Uranium    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:ThermosRebased    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public void drawText(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text, byte color)
 {
     int xStart = x;
     if(!font.isValid(text))
         throw new IllegalArgumentException("text contains invalid characters");
     for(int i = 0; i < text.length(); i++)
     {
         char ch = text.charAt(i);
         if(ch == '\n')
         {
             x = xStart;
             y += font.getHeight() + 1;
             continue;
         }
         if(ch == COLOR_CHAR)
         {
             int j = text.indexOf(';', i);
             if(j >= 0)
                 try
                 {
                     color = Byte.parseByte(text.substring(i + 1, j));
                     i = j;
                     continue;
                 }
                 catch(NumberFormatException ex) { }
         }
         org.bukkit.map.MapFont.CharacterSprite sprite = font.getChar(text.charAt(i));
for(int r = 0; r < font.getHeight(); ++r)
    for(int c = 0; c < sprite.getWidth(); ++c)
        for(int xx = 0; xx < width; xx++)
            for(int yy = 0; yy < height; yy++)
                if(sprite.get(r, c))
                    canvas.setPixel(x + xx + c * width, y + yy + r * height, color);

         x += (sprite.getWidth() + 1) * width;
     }

 }
项目:Thermos    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:KCauldron    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:CauldronGit    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Cauldron-Old    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Cauldron-Reloaded    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:FFoKC    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:CraftBukkit    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public void drawText(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text, byte color)
 {
     int xStart = x;
     if(!font.isValid(text))
         throw new IllegalArgumentException("text contains invalid characters");
     for(int i = 0; i < text.length(); i++)
     {
         char ch = text.charAt(i);
         if(ch == '\n')
         {
             x = xStart;
             y += font.getHeight() + 1;
             continue;
         }
         if(ch == COLOR_CHAR)
         {
             int j = text.indexOf(';', i);
             if(j >= 0)
                 try
                 {
                     color = Byte.parseByte(text.substring(i + 1, j));
                     i = j;
                     continue;
                 }
                 catch(NumberFormatException ex) { }
         }
         org.bukkit.map.MapFont.CharacterSprite sprite = font.getChar(text.charAt(i));
for(int r = 0; r < font.getHeight(); ++r)
    for(int c = 0; c < sprite.getWidth(); ++c)
        for(int xx = 0; xx < width; xx++)
            for(int yy = 0; yy < height; yy++)
                if(sprite.get(r, c))
                    canvas.setPixel(x + xx + c * width, y + yy + r * height, color);

         x += (sprite.getWidth() + 1) * width;
     }

 }
项目:Craftbukkit    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Almura-Server    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:MagicLib    文件:BufferedMapCanvas.java   
@SuppressWarnings("deprecation")
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Tweakkit-Server    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Cauldron    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:SpigotSource    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Craft-city    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:MCPBukkit    文件:CraftMapCanvas.java   
public void drawText(int x, int y, MapFont font, String text) {
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
    if (!font.isValid(text)) {
        throw new IllegalArgumentException("text contains invalid characters");
    }

    for (int i = 0; i < text.length(); ++i) {
        char ch = text.charAt(i);
        if (ch == '\n') {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        } else if (ch == '\u00A7') {
            int j = text.indexOf(';', i);
            if (j >= 0) {
                try {
                    color = Byte.parseByte(text.substring(i + 1, j));
                    i = j;
                    continue;
                }
                catch (NumberFormatException ex) {}
            }
        }

        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r) {
            for (int c = 0; c < sprite.getWidth(); ++c) {
                if (sprite.get(r, c)) {
                    setPixel(x + c, y + r, color);
                }
            }
        }
        x += sprite.getWidth() + 1;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public void drawText(Byte[][] canvas, int x, int y, int width, int height, MapFont font, String text, byte color)
 {
     int xStart = x;
     if(!font.isValid(text))
         throw new IllegalArgumentException("text contains invalid characters");
     for(int i = 0; i < text.length(); i++)
     {
         char ch = text.charAt(i);
         if(ch == '\n')
         {
             x = xStart;
             y += font.getHeight() + 1;
             continue;
         }
         if(ch == COLOR_CHAR)
         {
             int j = text.indexOf(';', i);
             if(j >= 0)
                 try
                 {
                     color = Byte.parseByte(text.substring(i + 1, j));
                     i = j;
                     continue;
                 }
                 catch(NumberFormatException ex) { }
         }
         org.bukkit.map.MapFont.CharacterSprite sprite = font.getChar(text.charAt(i));
for(int r = 0; r < font.getHeight(); ++r)
    for(int c = 0; c < sprite.getWidth(); ++c)
        for(int xx = 0; xx < width; xx++)
            for(int yy = 0; yy < height; yy++)
                if(sprite.get(r, c))
                {
                    int absX = x + xx + c * width;
                    int absY = y + yy + r * height;

                    if(canvas.length > absX && canvas[absX].length > absY)
                        canvas[absX][absY] = color;
                }

         x += (sprite.getWidth() + 1) * width;
     }

 }
项目:Breakpoint    文件:BPMapRenderer.java   
public static void drawTextOld(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text)
{
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
/*  String text = "";

    for(char c : rawText.toCharArray())
        if(MinecraftFont.Font.getChar(c) != null)
            text += c;*/

    if(!MinecraftFont.Font.isValid(text))
        return;

    for (int i = 0; i < text.length(); ++i)
    {
        char ch = text.charAt(i);
        if (ch == '\n')
        {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        }
        else
            if (ch == '§')
            {
                int j = text.indexOf(';', i);
                if (j >= 0)
                    try
                    {
                        color = Byte.parseByte(text.substring(i + 1, j));
                        i = j;
                        continue;
                    }
                    catch (NumberFormatException ex)
                    {
                    }
            }
        CharacterSprite sprite = font.getChar(text.charAt(i));
        for(int r = 0; r < font.getHeight(); ++r)
            for(int c = 0; c < sprite.getWidth(); ++c)
                for(int xx = 0; xx < width; xx++)
                    for(int yy = 0; yy < height; yy++)
                        if(sprite.get(r, c))
                            canvas.setPixel(x + xx + c * width, y + yy + r * height, color);
        x += (sprite.getWidth() + 1) * width;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public static void drawTextOld(Byte[][] canvas, int x, int y, int width, int height, MapFont font, String text)
{
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
/*  String text = "";

    for(char c : rawText.toCharArray())
        if(MinecraftFont.Font.getChar(c) != null)
            text += c;*/

    if(!MinecraftFont.Font.isValid(text))
        return;

    for (int i = 0; i < text.length(); ++i)
    {
        char ch = text.charAt(i);
        if (ch == '\n')
        {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        }
        else
            if (ch == '§')
            {
                int j = text.indexOf(';', i);
                if (j >= 0)
                    try
                    {
                        color = Byte.parseByte(text.substring(i + 1, j));
                        i = j;
                        continue;
                    }
                    catch (NumberFormatException ex)
                    {
                    }
            }
        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r)
            for (int c = 0; c < sprite.getWidth(); ++c)
                for (int xx = 0; xx < width; xx++)
                    for (int yy = 0; yy < height; yy++)
                        if (sprite.get(r, c))
                        {
                            int absX = x + xx + c * width;
                            int absY = y + yy + r * height;

                            if(canvas.length > absX && canvas[absX].length > absY)
                                canvas[absX][absY] = color;
                        }

        x += (sprite.getWidth() + 1) * width;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public void drawText(Byte[][] canvas, int x, int y, int width, int height, MapFont font, String text, byte color)
 {
     int xStart = x;
     if(!font.isValid(text))
         throw new IllegalArgumentException("text contains invalid characters");
     for(int i = 0; i < text.length(); i++)
     {
         char ch = text.charAt(i);
         if(ch == '\n')
         {
             x = xStart;
             y += font.getHeight() + 1;
             continue;
         }
         if(ch == COLOR_CHAR)
         {
             int j = text.indexOf(';', i);
             if(j >= 0)
                 try
                 {
                     color = Byte.parseByte(text.substring(i + 1, j));
                     i = j;
                     continue;
                 }
                 catch(NumberFormatException ex) { }
         }
         org.bukkit.map.MapFont.CharacterSprite sprite = font.getChar(text.charAt(i));
for(int r = 0; r < font.getHeight(); ++r)
    for(int c = 0; c < sprite.getWidth(); ++c)
        for(int xx = 0; xx < width; xx++)
            for(int yy = 0; yy < height; yy++)
                if(sprite.get(r, c))
                {
                    int absX = x + xx + c * width;
                    int absY = y + yy + r * height;

                    if(canvas.length > absX && canvas[absX].length > absY)
                        canvas[absX][absY] = color;
                }

         x += (sprite.getWidth() + 1) * width;
     }

 }
项目:Breakpoint    文件:BPMapRenderer.java   
public static void drawTextOld(MapCanvas canvas, int x, int y, int width, int height, MapFont font, String text)
{
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
/*  String text = "";

    for(char c : rawText.toCharArray())
        if(MinecraftFont.Font.getChar(c) != null)
            text += c;*/

    if(!MinecraftFont.Font.isValid(text))
        return;

    for (int i = 0; i < text.length(); ++i)
    {
        char ch = text.charAt(i);
        if (ch == '\n')
        {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        }
        else
            if (ch == '§')
            {
                int j = text.indexOf(';', i);
                if (j >= 0)
                    try
                    {
                        color = Byte.parseByte(text.substring(i + 1, j));
                        i = j;
                        continue;
                    }
                    catch (NumberFormatException ex)
                    {
                    }
            }
        CharacterSprite sprite = font.getChar(text.charAt(i));
        for(int r = 0; r < font.getHeight(); ++r)
            for(int c = 0; c < sprite.getWidth(); ++c)
                for(int xx = 0; xx < width; xx++)
                    for(int yy = 0; yy < height; yy++)
                        if(sprite.get(r, c))
                            canvas.setPixel(x + xx + c * width, y + yy + r * height, color);
        x += (sprite.getWidth() + 1) * width;
    }
}
项目:Breakpoint    文件:BPMapRenderer.java   
public static void drawTextOld(Byte[][] canvas, int x, int y, int width, int height, MapFont font, String text)
{
    int xStart = x;
    byte color = MapPalette.DARK_GRAY;
/*  String text = "";

    for(char c : rawText.toCharArray())
        if(MinecraftFont.Font.getChar(c) != null)
            text += c;*/

    if(!MinecraftFont.Font.isValid(text))
        return;

    for (int i = 0; i < text.length(); ++i)
    {
        char ch = text.charAt(i);
        if (ch == '\n')
        {
            x = xStart;
            y += font.getHeight() + 1;
            continue;
        }
        else
            if (ch == '§')
            {
                int j = text.indexOf(';', i);
                if (j >= 0)
                    try
                    {
                        color = Byte.parseByte(text.substring(i + 1, j));
                        i = j;
                        continue;
                    }
                    catch (NumberFormatException ex)
                    {
                    }
            }
        CharacterSprite sprite = font.getChar(text.charAt(i));
        for (int r = 0; r < font.getHeight(); ++r)
            for (int c = 0; c < sprite.getWidth(); ++c)
                for (int xx = 0; xx < width; xx++)
                    for (int yy = 0; yy < height; yy++)
                        if (sprite.get(r, c))
                        {
                            int absX = x + xx + c * width;
                            int absY = y + yy + r * height;

                            if(canvas.length > absX && canvas[absX].length > absY)
                                canvas[absX][absY] = color;
                        }

        x += (sprite.getWidth() + 1) * width;
    }
}
项目:Pore    文件:PoreMapCanvas.java   
@Override
public void drawText(int x, int y, MapFont font, String text) {
    throw new NotImplementedException("TODO");
}
项目:BedrockAPI    文件:MapFont.java   
public MapFont() {
}
项目:BedrockAPI    文件:MapFont.java   
public void setChar(char ch, MapFont.CharacterSprite sprite) {
}
项目:BedrockAPI    文件:MapFont.java   
public MapFont.CharacterSprite getChar(char ch) {
    return null;
}
项目:BedrockAPI    文件:MapCanvas.java   
void drawText(int x, int y, MapFont font, String text);