| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 文件名:Image_Class.nut | 
					
						
							|  |  |  | 路径:Base/_Tool/Image_Class.nut | 
					
						
							|  |  |  | 创建日期:2024-10-21	16:58 | 
					
						
							|  |  |  | 文件用途: 图片类 | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | class Rindro_Png { | 
					
						
							|  |  |  |     C_Object = null; | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |     Path = null; | 
					
						
							|  |  |  |     Idx = null; | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |     constructor(Object, Path, Idx) { | 
					
						
							|  |  |  |         this.Path = Path; | 
					
						
							|  |  |  |         this.Idx = Idx; | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  |         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); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-30 00:24:38 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     function GetWidth() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return NativePointer(this.C_Object + 0x1C).readShort(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function GetHeight() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return NativePointer(this.C_Object + 0x1E).readShort(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  | } | 
					
						
							|  |  |  | class Rindro_Image { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     Img = null; | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |     Path = null; | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     constructor(Path) { | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |         this.Path = Path; | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  |         //读取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) { | 
					
						
							| 
									
										
										
										
											2025-05-27 21:24:22 +08:00
										 |  |  |             local PngObject = L_Sq_CallFunc(0x11AA190, "int", FFI_THISCALL, ["int", "int"], Img, Idx); | 
					
						
							|  |  |  |             return Rindro_Png(PngObject, Path, Idx); | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     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]; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-06-30 00:24:38 +08:00
										 |  |  | Rindro_Image_GlobalMap <- {}; | 
					
						
							|  |  |  | Rindro_Image_GlobalMap["lenheartui"] <- Rindro_Image("interface/lenheartwindowcommon.img"); | 
					
						
							| 
									
										
										
										
											2024-11-15 10:32:19 +08:00
										 |  |  | /* | 
					
						
							|  |  |  |     local Png = TestImg.GetPng(0); | 
					
						
							|  |  |  |     Png.Draw(200, 200); | 
					
						
							|  |  |  |     Png.DrawEx(100, 400, 0, sq_RGBA(255, 255, 255, 255), 1.5, 1.5); | 
					
						
							|  |  |  | */ |