通过图片镜像drawString多国语言

    技术2022-05-11  70

        public static void drawImageFont(Graphics g, Image imgnum, byte[] str,            int sx, int sy, int effect, int fontSizeX, int fontSizeY) {        if (str == null)            return;

            int i = 0;        int j = 0;        int nX, nY;        Image fontImg = null;        fontImg = imgnum;        for (i = 0; i < str.length; i++) {            nX = 0;            nY = 0;            if (str[i] < 0) {                nX = 256;                nY = -1;            }            setClipImage(g, sx + i * (fontSizeX), sy, fontImg,                    ((str[i] + nX - 32) % 32) * fontSizeX,                    (nY + ((str[i] + nX - 32) >> 5)) * fontSizeY, fontSizeX,                    fontSizeY);        }    }   public static void setClipImage(Graphics g, int _i, int _j, Image image,            int _k, int _l, int _i1, int _j1) {        int clipX = g.getClipX();        int clipY = g.getClipY();        int clipWidth = g.getClipWidth();        int clipHeight = g.getClipHeight();        g.setClip(_i, _j, _i1, _j1);        g.drawImage(image, _i - _k, _j - _l, Graphics.LEFT | Graphics.TOP);        g.setClip(0, 0, WIDTH, HEIGHT);        g.setClip(clipX, clipY, clipWidth, clipHeight);    }

    //****************************************************************使用drawImageFont(_g, Constants.imgchangenum, "back"                    .getBytes(), 2, 198, 0, FONT_DEFAULT_X_SIZE,                    FONT_DEFAULT_Y_SIZE); 


    最新回复(0)