fork/m-overlay
git clone https://git.julia.blue/fork/m-overlay
ecd189b
v2.1.5
1local PANEL =class . create ( "Image" , "Panel" ) 2 3function PANEL : Image () 4self : super () 5self : SetDrawPanel ( false ) 6end 7 8local CACHE ={} 9 10function PANEL : SetImage ( file ) 11if not CACHE [ file ] then 12CACHE [ file ] =graphics . newImage ( file ) 13end 14self . m_pImage =CACHE [ file ] 15end 16 17function PANEL : Paint ( w , h ) 18if not self . m_pImage then return end 19graphics . draw ( self . m_pImage , 0 , 0 , 0 , w / self . m_pImage : getWidth (), h / self . m_pImage : getHeight ()) 20end 21 22function PANEL : SizeToContents () 23self : SetSize ( self . m_pImage : getDimensions ()) 24end