xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
xcimg.xcs
浏览该文件的文档.
1//xlang
2package XCImg{
3 public class VCodeGen : Library{
4 long nativehandle;
5 static bool loaded = false;
6 static bool load(){
7 if (loaded == false){
8 try{
9 int osid = _system_.getPlatformId();
10 String module_name = "xcimg.dll";
11 if (osid == 1){
12 module_name = ("xcimg.so");
13 }else
14 if (osid == 2){
15 module_name = ("xcimg.dylib");
16 }
17 loadLibrary(module_name);
18 loaded = true;
19 }catch(Exception e){
21 }
22 }
23 return loaded;
24 }
25
26 import{
27 Pointer cdecl alloc_vcode(String text, int length, int height);
28 int cdecl get_buffer_req(Pointer img);
29 int cdecl get_data(Pointer img, ObjectPtr, int length);
30 void cdecl delloc_vcode(Pointer img);
31 };
32
33 public VCodeGen(String text, int length, int height){
34 if (load()){
35 nativehandle = alloc_vcode(text, length, height);
36 }else{
37 throw new IllegalArgumentException("can not load Native Module: xcimg");
38 }
39
40 }
41
42 void finalize(){
43 delloc_vcode(nativehandle);
44 }
45
46 public byte[] getData(){
47 int length = get_buffer_req(nativehandle);
48 byte[] data = new byte[length];
49 get_data(nativehandle, data, length);
50 return data;
51 }
52
53 public int length(){
54 return get_buffer_req(nativehandle);
55 }
56 };
57};
58
59/*
60int main(String[] args){
61 //TODO:...
62 XCImg.VCodeGen gen = new XCImg.VCodeGen("dcsr", 160, 40);
63 byte[] data = gen.getData();
64 return 0;
65}
66*/
系统和IO相关
static final int getPlatformId()
static final void output(String)
异常类
final String getMessage()
字符串类
static bool load()
Definition xcimg.xcs:6