69 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| /*
 | |
| 文件名:Image_Class.nut
 | |
| 路径:Base/_Tool/Image_Class.nut
 | |
| 创建日期:2024-10-21	16:58
 | |
| 文件用途: 图片类
 | |
| */
 | |
| class Rindro_Png {
 | |
|     C_Object = null;
 | |
|     Path = null;
 | |
|     Idx = null;
 | |
| 
 | |
|     constructor(Object, Path, Idx) {
 | |
|         this.Path = Path;
 | |
|         this.Idx = Idx;
 | |
|         this.C_Object = Object;
 | |
|     }
 | |
| 
 | |
|     function Draw(X, Y) {
 | |
|         L_Sq_CallFunc(0x11A8F60, "int", FFI_THISCALL, ["int", "int", "int", "int"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object);
 | |
|     }
 | |
| 
 | |
|     function DrawEx(X, Y, Model, Rgba, Xrate, Yrate) {
 | |
|         L_Sq_CallFunc(0x11A97E0, "int", FFI_THISCALL, ["int", "int", "int", "int", "float", "float", "float", "int", "float", "float"], NativePointer(0x1B45B94).readInt(), X, Y, this.C_Object, Xrate, Yrate, Model, Rgba, 0, 0);
 | |
|     }
 | |
| }
 | |
| class Rindro_Image {
 | |
| 
 | |
|     Img = null;
 | |
|     Path = null;
 | |
| 
 | |
|     constructor(Path) {
 | |
|         this.Path = Path;
 | |
|         //读取Img
 | |
|         Img = L_Sq_CallFunc(0x11C0410, "int", FFI_THISCALL, ["int", "int", "int"], NativePointer(0x1B4684C).readInt(), 0, L_sq_P2I(Memory.allocUtf8String(Path).C_Object));
 | |
|     }
 | |
| 
 | |
|     function GetPng(Idx) {
 | |
|         if (Img) {
 | |
|             local PngObject = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx);
 | |
|             return Rindro_Png(PngObject, Path, Idx);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     function DrawPng(Idx, X, Y) {
 | |
|         local Buffer = GetPng(Idx);
 | |
|         Buffer.Draw(X, Y);
 | |
|     }
 | |
| 
 | |
|     function DrawExPng(Idx, X, Y, Model, Rgba, Xrate, Yrate) {
 | |
|         local Buffer = GetPng(Idx);
 | |
|         Buffer.DrawEx(X, Y, Model, Rgba, Xrate, Yrate)
 | |
|     }
 | |
| 
 | |
|     //加载
 | |
|     function Load(Path) {
 | |
|         if (!(getroottable().rawin("Rindro_Image_Map"))) getroottable().Rindro_Image_Map <- {};
 | |
|         if (getroottable().Rindro_Image_Map.rawin(Path)) return getroottable().Rindro_Image_Map[Path];
 | |
|         else {
 | |
|             getroottable().Rindro_Image_Map[Path] <- Rindro_Image(Path);
 | |
|             return getroottable().Rindro_Image_Map[Path];
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| /*
 | |
|     local Png = TestImg.GetPng(0);
 | |
|     Png.Draw(200, 200);
 | |
|     Png.DrawEx(100, 400, 0, sq_RGBA(255, 255, 255, 255), 1.5, 1.5);
 | |
| */ |