function draw(g, state, drawInfo) {
    var x = drawInfo.texArea[0];
    var y = drawInfo.texArea[1];
    var w = drawInfo.texArea[2] - drawInfo.texArea[0];
    var h = drawInfo.texArea[3] - drawInfo.texArea[1];
    var extraConfig = drawInfo.extraConfig;

    if (!extraConfig) {
        extraConfig = {};
    }

    var imgPath = extraConfig.imgPath ? extraConfig.imgPath : "mtr:textures/block/sign/logo_grayscale.png";
    var imgIcon = loadResource("img", imgPath);
    g.drawImage(imgIcon, widthPercent(0.865), heightPercent(0), w * 0.135, w * 0.135, null);

    g.setColor(Color.BLACK);
    var font = loadResource("font", "mtrsteamloco:fonts/source-han-sans.otf");
    var fontBold = loadResource("font", "mtrsteamloco:fonts/source-han-sans-bold.otf");
    // g.drawString(JSON.stringify(drawInfo), 10, 10);

    if (drawInfo.station) {
        g.setColor(Color.WHITE);
        var finalStationName = addSuffix(addPrefix(drawInfo.station.name, "地铁|", false), "站|Station");
        drawStrDL(g, fontBold, fontBold, finalStationName, widthPercent(0), heightPercent(0.3), h * 0.3, 0, 0);
        drawStrDL(g, fontBold, fontBold, finalStationName, widthPercent(0.8), heightPercent(0.3), h * 0.3, 2, 2);
        if (drawInfo.routes) {
            var routeObj = {};
            var routeArr = [];
            for (var i = 0; i < drawInfo.routes.length; i++) {
                var thisRoute = routeToObj(drawInfo.routes[i]);
                routeObj[thisRoute.routeName] = thisRoute.routeColor;
            }
            for (var key in routeObj) {
                if (routeObj.hasOwnProperty(key)) {
                    routeArr.push({ name: key, color: routeObj[key] });
                }
            }
            routeArr.sort(function (a, b) {
                return a.name.localeCompare(b.name);
            });

            var currentX1 = widthPercent(0.4);
            var currentX2 = widthPercent(0.4);
            for (var i = 0; i < routeArr.length; i++) {
                g.setColor(routeArr[i].color);
                g.fillRect(currentX1 - w * 0.05, heightPercent(0), w * 0.05, h);
                g.fillRect(currentX2, heightPercent(0), w * 0.05, h);
                g.setColor(isLightColor(routeArr[i].color) ? Color.BLACK : Color.WHITE);
                if (isNumLine(routeArr[i].name)) {
                    drawStrUnified(g, fontBold, String(getCJKLineName(getMatching(routeArr[i].name, true))), currentX1 - w * 0.025, heightPercent(0.55), h * 0.25, 1);
                    drawStrDL(g, font, font, `号线|${getMatching(routeArr[i].name, false)}`, currentX1 - w * 0.025, heightPercent(0.6), h * 0.15, 1, 1);
                    drawStrUnified(g, fontBold, String(getCJKLineName(getMatching(routeArr[i].name, true))), currentX2 + w * 0.025, heightPercent(0.55), h * 0.25, 1);
                    drawStrDL(g, font, font, `号线|${getMatching(routeArr[i].name, false)}`, currentX2 + w * 0.025, heightPercent(0.6), h * 0.15, 1, 1);
                } else {
                    var cjkName = getMatching(routeArr[i].name, true);
                    var cjkChrHeight = (h * 0.5) / String(cjkName).length;
                    for (var j = 0; j < String(cjkName).length; j++) {
                        drawStrUnified(g, fontBold, String(cjkName).charAt(j), currentX1 - w * 0.025, heightPercent(0.15) + cjkChrHeight * (j + 1), cjkChrHeight, 1);
                        drawStrUnified(g, fontBold, String(cjkName).charAt(j), currentX2 + w * 0.025, heightPercent(0.15) + cjkChrHeight * (j + 1), cjkChrHeight, 1);
                    }
                    drawStrUnified(g, font, getMatching(routeArr[i].name, false), currentX1 - w * 0.025, heightPercent(0.75), h * 0.035, 1);
                    drawStrUnified(g, font, getMatching(routeArr[i].name, false), currentX2 + w * 0.025, heightPercent(0.75), h * 0.035, 1);
                }
                currentX1 -= w * 0.05;
                currentX2 += w * 0.05;
            }
        }
    }

    g.setColor(Color.BLACK);
    var exitName = extraConfig.exitName ? extraConfig.exitName : "A";
    drawStrDL(g, fontBold, fontBold, exitName, widthPercent(0.8325), heightPercent(0.3), h * 0.4, 1, 1);

    function widthPercent(p) {
        return x + w * p;
    }
    function heightPercent(p) {
        return y + h * p;
    }
}
