通过图片镜像drawString多国语言
2007-02-28 18:59
281 查看
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);
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);
相关文章推荐
- C++ GDI+ DrawString 保存字符串文字为透明图片
- CCTexture2D(CCTexture2D类可以方便的从图片,文本或raw数据文件中创建OpenGL所用贴图 initWithData drawAtPoint initWithString)
- (转)使用SE String Resouce制作多国语言程序资源文件
- C++ GDI+ DrawString 保存字符串文字为透明图片
- android开发:如何通过drawable中的图片名字(String类型)来获得它的Id
- Flex配置通过配置语言环境实现多国语言
- 基于javascript代码实现通过点击图片显示原图片
- JS中通过url动态获取图片大小的方法小结(两种方法)
- 易语言-循环读取图片颜色
- Android多国语言和地区资源文件夹
- Eclipse多国语言包的安装(转)
- react多国语言——react-intl
- 基于Every thing is string(一切都是字符串)来改善Java等强类型语言的开发体验
- qt多国语言及其动态切换的学习笔记
- 通过AsyncTask异步获取网络图片
- 通过鼠标滑轮控制图片大小
- Swiper 通过ajax加载图片轮播后,导航点失效问题处理。
- 通过java调用Http接口上传图片到服务器
- go语言实现通过FTP库自动上传web日志
- go语言读取json并下载高清妹子图片