@Override
    public int getPixel(int x, int y)
    {
        int bx = x / 8;
        int by = y / 8;

        int offs = bx + by * (width / 8) - tileOffset;
        if (offs < 0)
            return 0;
        offs *= 64;
        offs += x % 8 + 8 * (y % 8);
        if (offs < 0)
            return 0;
        if (offs >= data.length)
            return 0;
        return data[offs] & 0xFF;
    }