User Tools

Site Tools


built_in:images

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

built_in:images [2014/10/31 22:29]
stevegarman exclamation mark.
built_in:images [2018/04/19 23:23]
Line 1: Line 1:
-====== Images ====== 
-===== Create ===== 
-Create Image controls using the CreateImage method of the app object: 
  
-<code>img = app.CreateImage( file, width, height, options );</code> 
-Use the SetOnTouch method of the Image object to set the name of a function you want to be called when the Image is touched. 
- 
-When Image controls are touched, they send an event object parameter to your callback function which contains details of the touch event, for example the action property of the event object contains "Down", "Up" or "Move" as the user touches and moves their finger on the screen and the x and y properties contain arrays of touch coordinates. 
- 
-If you don't set a size, the image object will match the original image size. If you set one dimension to a positive value and leave the other dimension as -1, then the image will maintain its original aspect ratio. 
- 
-Specifying both width and height will stretch the image to fill the Image object, unless you can use the "ScaleCenter" option to keep the image at it's original size and centered within the Image object 
- 
-===== Methods ===== 
-^Method ^Description^ 
-|img.Clear| | 
-|img.Draw| | 
-|img.DrawArc| | 
-|img.DrawCircle| | 
-|img.DrawImage| | 
-|img.DrawImageMtx| | 
-|img.DrawLine| | 
-|img.DrawPoint| | 
-|img.DrawRectangle| | 
-|img.DrawText| | 
-|img.GetAbsHeight| | 
-|img.GetAbsWidth| | 
-|img.GetHeight| | 
-|img.GetName| | 
-|img.GetVisibility| | 
-|img.GetWidth| | 
-|img.Move| | 
-|img.Release| | 
-|img.Reset| | 
-|img.Rotate| | 
-|img.Save| | 
-|img.Scale| | 
-|img.SetAlpha| | 
-|img.SetAutoUpdate| | 
-|img.SetBackColor| | 
-|img.SetBackGradient| | 
-|img.SetBackGradientRadial| | 
-|img.SetBackground| | 
-|img.SetColor| | 
-|img.SetImage| | 
-|img.SetLineWidth| | 
-|img.SetMargins| | 
-|img.SetMaxRate| | 
-|img.SetName| | 
-|img.SetOnLoad| | 
-|img.SetOnLongTouch| | 
-|img.SetOnTouch| | 
-|img.SetOnTouchDown| | 
-|img.SetOnTouchMove| | 
-|img.SetOnTouchUp| | 
-|img.SetPadding| | 
-|img.SetPaintColor| | 
-|img.SetPaintStyle| | 
-|img.SetPosition| | 
-|img.SetSize| | 
-|img.SetTextSize| | 
-|img.SetTouchable| | 
-|img.SetVisibility| | 
-|img.Skew| | 
-|img.Transform| | 
-|img.Update| | 
- 
-===== Sample code ===== 
-Some say there should always be **Hello World** code. 
-<code JavaScript helloimage.js> 
-function OnStart(){ 
-  lay = app.CreateLayout( "Linear", "VCenter,FillXY" ); 
- 
-  img = app.CreateImage( null, 0.8, 0.8, "FontAwesome" ); 
-  lay.AddChild( img ); 
- 
-  img.SetColor( "#99ff99" ); 
-  img.SetPaintColor( "#0000dd" );  
-  img.SetTextSize(42); 
-  // 
-  img.DrawText( "[fa-globe] Hello World!", 0.3, 0.5 ); 
-  app.AddLayout( lay ); 
-} 
-</code> 
built_in/images.txt · Last modified: 2018/04/19 23:23 (external edit)